diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-07-24 04:15:06 (GMT) |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-07-24 04:15:06 (GMT) |
commit | 60cd50b800b6e6cf185df170c1b2cb41108a82b6 (patch) | |
tree | b8995d6668d5f3a4f03bd31745f1be03a0da4080 /src/declarative/qml/parser | |
parent | e6f14d21fa03d4301fcb7d7de1733bc65fe59e43 (diff) | |
download | Qt-60cd50b800b6e6cf185df170c1b2cb41108a82b6.zip Qt-60cd50b800b6e6cf185df170c1b2cb41108a82b6.tar.gz Qt-60cd50b800b6e6cf185df170c1b2cb41108a82b6.tar.bz2 |
Removed support for CSS-like literals.
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r-- | src/declarative/qml/parser/qmljs.g | 2 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljsast.cpp | 38 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljsast_p.h | 29 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljslexer.cpp | 58 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljslexer_p.h | 19 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljsparser.cpp | 2 |
6 files changed, 5 insertions, 143 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index 20ee27d..5f0fe8f 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -1021,7 +1021,7 @@ case $rule_number: { PrimaryExpression: T_NUMERIC_LITERAL ; /. case $rule_number: { - AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval, lexer->flags); + AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qmljsast.cpp index d10c071..52f19e2 100644 --- a/src/declarative/qml/parser/qmljsast.cpp +++ b/src/declarative/qml/parser/qmljsast.cpp @@ -49,44 +49,6 @@ QT_BEGIN_NAMESPACE namespace QmlJS { namespace AST { -int NumericLiteral::suffixLength[] = { - 0, // noSuffix - 2, // emSuffix - 2, // exSuffix - 2, // pxSuffix - 2, // cmSuffix - 2, // mmSuffix - 2, // inSuffix - 2, // ptSuffix - 2, // pcSuffix - 3, // degSuffix - 3, // radSuffix - 4, // gradSuffix - 2, // msSuffix - 1, // sSuffix - 2, // hzSuffix - 3 // khzSuffix -}; - -const char *const NumericLiteral::suffixSpell[] = { - "", - "em", - "ex", - "px", - "cm", - "mm", - "in", - "pt", - "pc", - "deg", - "rad", - "grad", - "ms", - "s", - "hz", - "khz" -}; - ExpressionNode *Node::expressionCast() { return 0; diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h index 6d269ac..eba9202 100644 --- a/src/declarative/qml/parser/qmljsast_p.h +++ b/src/declarative/qml/parser/qmljsast_p.h @@ -104,7 +104,7 @@ enum Op { } // namespace QSOperator -namespace QmlJS { +namespace QmlJS { class NameId; namespace AST { @@ -400,30 +400,8 @@ class NumericLiteral: public ExpressionNode public: QMLJS_DECLARE_AST_NODE(NumericLiteral) - enum Suffix { // ### keep it in sync with the Suffix enum in qmljslexer_p.h - noSuffix, - emSuffix, - exSuffix, - pxSuffix, - cmSuffix, - mmSuffix, - inSuffix, - ptSuffix, - pcSuffix, - degSuffix, - radSuffix, - gradSuffix, - msSuffix, - sSuffix, - hzSuffix, - khzSuffix - }; - - static int suffixLength[]; - static const char *const suffixSpell[]; - - NumericLiteral(double v, int suffix): - value(v), suffix(suffix) { kind = K; } + NumericLiteral(double v): + value(v) { kind = K; } virtual ~NumericLiteral() {} virtual void accept0(Visitor *visitor); @@ -436,7 +414,6 @@ public: // attributes: double value; - int suffix; SourceLocation literalToken; }; diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index a22169d..beb5ebd 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -755,64 +755,6 @@ int Lexer::lex() bol = false; } - if (state == Number) { - // CSS-style suffix for numeric literals - - flags = noSuffix; - - const ushort c = QChar::toLower(current); - const ushort n1 = QChar::toLower(next1); - const ushort n2 = QChar::toLower(next2); - const ushort n3 = QChar::toLower(next3); - - if (c == 'e' && n1 == 'm') { - flags = emSuffix; - shift(2); - } else if (c == 'e' && n1 == 'x') { - flags = exSuffix; - shift(2); - } else if (c == 'p' && n1 == 'x') { - flags = pxSuffix; - shift(2); - } else if (c == 'c' && n1 == 'm') { - flags = cmSuffix; - shift(2); - } else if (c == 'm' && n1 == 'm') { - flags = mmSuffix; - shift(2); - } else if (c == 'i' && n1 == 'n') { - flags = inSuffix; - shift(2); - } else if (c == 'p' && n1 == 't') { - flags = ptSuffix; - shift(2); - } else if (c == 'p' && n1 == 'c') { - flags = pcSuffix; - shift(1); - } else if (c == 'd' && n1 == 'e' && n2 == 'g') { - flags = degSuffix; - shift(3); - } else if (c == 'r' && n1 == 'a' && n2 == 'd') { - flags = radSuffix; - shift(3); - } else if (c == 'g' && n1 == 'r' && n2 == 'a' && n3 == 'd') { - flags = gradSuffix; - shift(4); - } else if (c == 'm' && n1 == 's') { - flags = msSuffix; - shift(2); - } else if (c == 's') { - flags = sSuffix; - shift(1); - } else if (c == 'h' && n1 == 'z') { - flags = hzSuffix; - shift(2); - } else if (c == 'k' && n1 == 'h' && n2 == 'z') { - flags = khzSuffix; - shift(3); - } - } - // no identifiers allowed directly after numeric literal, e.g. "3in" is bad if ((state == Number || state == Octal || state == Hex) && isIdentLetter(current)) { diff --git a/src/declarative/qml/parser/qmljslexer_p.h b/src/declarative/qml/parser/qmljslexer_p.h index e1ff23e..5817868 100644 --- a/src/declarative/qml/parser/qmljslexer_p.h +++ b/src/declarative/qml/parser/qmljslexer_p.h @@ -112,25 +112,6 @@ public: Other, Bad }; - enum Suffix { - noSuffix, - emSuffix, - exSuffix, - pxSuffix, - cmSuffix, - mmSuffix, - inSuffix, - ptSuffix, - pcSuffix, - degSuffix, - radSuffix, - gradSuffix, - msSuffix, - sSuffix, - hzSuffix, - khzSuffix - }; - enum Error { NoError, IllegalCharacter, diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp index a1236d5..e64774e 100644 --- a/src/declarative/qml/parser/qmljsparser.cpp +++ b/src/declarative/qml/parser/qmljsparser.cpp @@ -517,7 +517,7 @@ case 64: { } break; case 65: { - AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval, lexer->flags); + AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; |