46 #include "private/qdeclarativejslexer_p.h" 48 #include "private/qdeclarativejsglobal_p.h" 49 #include "private/qdeclarativejsengine_p.h" 50 #include "private/qdeclarativejsgrammar_p.h" 52 #include <QtCore/qcoreapplication.h> 65 #define shiftWindowsLineBreak() \ 67 if (((current == '\r') && (next1 == '\n')) \ 68 || ((current == '\n') && (next1 == '\r'))) { \ 84 size8(128), size16(128),
95 startlineno(0), startcolumn(0),
97 current(0), next1(0), next2(0), next3(0),
100 check_reserved(true),
101 parenthesesState(IgnoreParentheses),
103 prohibitAutomaticSemicolon(false),
104 tokenizeComments(tokenizeComments)
474 bool multiLineString =
false;
487 bool identifierWithEscapedUnicode =
false;
529 multiLineString =
false;
532 identifierWithEscapedUnicode =
true;
550 identifierWithEscapedUnicode =
false;
591 multiLineString =
true;
645 }
else if (
current == stringType) {
661 }
else if (
current == stringType) {
711 identifierWithEscapedUnicode =
true;
807 Q_ASSERT_X(0,
"Lexer::lex",
"Unhandled state in switch statement");
868 if (! identifierWithEscapedUnicode)
902 Q_ASSERT(!
"unhandled numeration value in switch");
922 if ((c >=
'a' && c <=
'z')
923 || (c >=
'A' && c <=
'Z')
934 return (c >=
'0' && c <=
'9');
939 return ((c >=
'0' && c <=
'9')
940 || (c >=
'a' && c <=
'f')
941 || (c >=
'A' && c <=
'F'));
946 return (c >=
'0' && c <=
'7');
952 if (c1 ==
'>' && c2 ==
'>' && c3 ==
'>' && c4 ==
'=') {
955 }
else if (c1 ==
'=' && c2 ==
'=' && c3 ==
'=') {
958 }
else if (c1 ==
'!' && c2 ==
'=' && c3 ==
'=') {
961 }
else if (c1 ==
'>' && c2 ==
'>' && c3 ==
'>') {
964 }
else if (c1 ==
'<' && c2 ==
'<' && c3 ==
'=') {
967 }
else if (c1 ==
'>' && c2 ==
'>' && c3 ==
'=') {
970 }
else if (c1 ==
'<' && c2 ==
'=') {
973 }
else if (c1 ==
'>' && c2 ==
'=') {
976 }
else if (c1 ==
'!' && c2 ==
'=') {
979 }
else if (c1 ==
'+' && c2 ==
'+') {
982 }
else if (c1 ==
'-' && c2 ==
'-') {
985 }
else if (c1 ==
'=' && c2 ==
'=') {
988 }
else if (c1 ==
'+' && c2 ==
'=') {
991 }
else if (c1 ==
'-' && c2 ==
'=') {
994 }
else if (c1 ==
'*' && c2 ==
'=') {
997 }
else if (c1 ==
'/' && c2 ==
'=') {
1000 }
else if (c1 ==
'&' && c2 ==
'=') {
1003 }
else if (c1 ==
'^' && c2 ==
'=') {
1006 }
else if (c1 ==
'%' && c2 ==
'=') {
1009 }
else if (c1 ==
'|' && c2 ==
'=') {
1012 }
else if (c1 ==
'<' && c2 ==
'<') {
1015 }
else if (c1 ==
'>' && c2 ==
'>') {
1018 }
else if (c1 ==
'&' && c2 ==
'&') {
1021 }
else if (c1 ==
'|' && c2 ==
'|') {
1085 return ((c1 -
'0') * 64 + (c2 -
'0') * 8 + c3 -
'0');
1090 if (c >=
'0' && c <=
'9')
1092 else if (c >=
'a' && c <=
'f')
1093 return (c -
'a' + 10);
1095 return (c -
'A' + 10);
1116 char *tmp =
new char[2 *
size8];
1159 case '\n':
case '\r':
static unsigned char convertHex(ushort c1)
static bool isIdentLetter(ushort c)
Lexer(Engine *eng, bool tokenizeComments=false)
static int flagFromChar(const QChar &)
#define QT_END_NAMESPACE
This macro expands to.
bool isWhiteSpace() const
bool isLineTerminator() const
NameId * intern(const QChar *u, int s)
int length() const
Returns the number of characters in this string.
static bool isDecimalDigit(ushort c)
The QString class provides a Unicode character string.
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok)
The QChar class provides a 16-bit Unicode character.
static QChar convertUnicode(ushort c1, ushort c2, ushort c3, ushort c4)
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
bool scanRegExp(RegExpBodyPrefix prefix=NoPrefix)
void syncProhibitAutomaticSemicolon()
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define shiftWindowsLineBreak()
bool prohibitAutomaticSemicolon
int findReservedWord(const QChar *buffer, int size) const
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
#define QT_QML_END_NAMESPACE
void setLexer(Lexer *lexer)
#define QT_QML_BEGIN_NAMESPACE
The State element defines configurations of objects and properties.
ushort singleEscape(ushort c) const
bool isHexDigit(ushort c) const
#define Q_ASSERT_X(cond, where, what)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
union QDeclarativeJS::Lexer::@103 qsyylval
void clear()
Clears the contents of the string and makes it empty.
ParenthesesState parenthesesState
ushort convertOctal(ushort c1, ushort c2, ushort c3) const
void addComment(int pos, int len, int line, int col)
int matchPunctuator(ushort c1, ushort c2, ushort c3, ushort c4)
double integerFromString(const char *buf, int size, int radix)
bool isOctalDigit(ushort c) const
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool isLetterOrNumber() const
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
void setCode(const QString &c, int lineno)