diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/parser/ParserTokens.h | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/parser/ParserTokens.h')
-rw-r--r-- | Source/JavaScriptCore/parser/ParserTokens.h | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/Source/JavaScriptCore/parser/ParserTokens.h b/Source/JavaScriptCore/parser/ParserTokens.h index 14191b95d..ed9780b52 100644 --- a/Source/JavaScriptCore/parser/ParserTokens.h +++ b/Source/JavaScriptCore/parser/ParserTokens.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +27,8 @@ #define ParserTokens_h #include "ParserModes.h" +#include <limits.h> +#include <stdint.h> namespace JSC { @@ -38,6 +40,8 @@ enum { BinaryOpTokenPrecedenceShift = 8, BinaryOpTokenAllowsInPrecedenceAdditionalShift = 4, BinaryOpTokenPrecedenceMask = 15 << BinaryOpTokenPrecedenceShift, + ErrorTokenFlag = 1 << (BinaryOpTokenAllowsInPrecedenceAdditionalShift + BinaryOpTokenPrecedenceShift + 7), + UnterminatedErrorTokenFlag = ErrorTokenFlag << 1 }; #define BINARY_OP_PRECEDENCE(prec) (((prec) << BinaryOpTokenPrecedenceShift) | ((prec) << (BinaryOpTokenPrecedenceShift + BinaryOpTokenAllowsInPrecedenceAdditionalShift))) @@ -85,7 +89,6 @@ enum JSTokenType { SEMICOLON, COLON, DOT, - ERRORTOK, EOFTOK, EQUAL, PLUSEQUAL, @@ -133,28 +136,44 @@ enum JSTokenType { MINUS = 19 | BINARY_OP_PRECEDENCE(9) | UnaryOpTokenFlag, TIMES = 20 | BINARY_OP_PRECEDENCE(10), DIVIDE = 21 | BINARY_OP_PRECEDENCE(10), - MOD = 22 | BINARY_OP_PRECEDENCE(10) + MOD = 22 | BINARY_OP_PRECEDENCE(10), + ERRORTOK = 0 | ErrorTokenFlag, + UNTERMINATED_IDENTIFIER_ESCAPE_ERRORTOK = 0 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + INVALID_IDENTIFIER_ESCAPE_ERRORTOK = 1 | ErrorTokenFlag, + UNTERMINATED_IDENTIFIER_UNICODE_ESCAPE_ERRORTOK = 2 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + INVALID_IDENTIFIER_UNICODE_ESCAPE_ERRORTOK = 3 | ErrorTokenFlag, + UNTERMINATED_MULTILINE_COMMENT_ERRORTOK = 4 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + UNTERMINATED_NUMERIC_LITERAL_ERRORTOK = 5 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + INVALID_OCTAL_NUMBER_ERRORTOK = 6 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + INVALID_NUMERIC_LITERAL_ERRORTOK = 7 | ErrorTokenFlag, + UNTERMINATED_STRING_LITERAL_ERRORTOK = 8 | ErrorTokenFlag | UnterminatedErrorTokenFlag, + INVALID_STRING_LITERAL_ERRORTOK = 9 | ErrorTokenFlag, }; union JSTokenData { - int intValue; + struct { + uint32_t line; + uint32_t offset; + uint32_t lineStartOffset; + }; double doubleValue; const Identifier* ident; }; struct JSTokenLocation { - JSTokenLocation() : line(0), column(0) { } + JSTokenLocation() : line(0), lineStartOffset(0), startOffset(0) { } JSTokenLocation(const JSTokenLocation& location) { line = location.line; + lineStartOffset = location.lineStartOffset; startOffset = location.startOffset; endOffset = location.endOffset; - column = location.column; } + int line; - int startOffset; - int endOffset; - int column; + unsigned lineStartOffset; + unsigned startOffset; + unsigned endOffset; }; struct JSToken { @@ -163,7 +182,6 @@ struct JSToken { JSTokenLocation m_location; }; -} - +} // namespace JSC #endif // ParserTokens_h |