diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2011-09-15 17:08:22 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-19 12:07:46 +0200 |
commit | 823dc78d3c0b22f2b5fecf3cb5be49e3ba0c2f56 (patch) | |
tree | c9b933b902d24f26b0f1b3a293fa4093ba66720c /tools/qmlmin/main.cpp | |
parent | b6719dc655485624a5e7acca80e01da9f47dd61d (diff) |
Fix automatic insertion of semicolons.
Use Lexer::canInsertAutomaticSemicolon() when recovering from errors
generated by missing T_SEMICOLON tokens.
Change-Id: Ie4011d8d3e02b02a7dccd0a09ffa28b1ec9e654d
Reviewed-on: http://codereview.qt-project.org/5017
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tools/qmlmin/main.cpp')
-rw-r--r-- | tools/qmlmin/main.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/qmlmin/main.cpp b/tools/qmlmin/main.cpp index 61223add2c..7a5b8f9457 100644 --- a/tools/qmlmin/main.cpp +++ b/tools/qmlmin/main.cpp @@ -122,11 +122,6 @@ public: } protected: - bool automatic(int token) const - { - return token == T_RBRACE || token == 0 || prevTerminator(); - } - virtual bool parse(int startToken) = 0; static QString quote(const QString &string) @@ -346,7 +341,7 @@ bool Minify::parse(int startToken) const int yyerrorstate = _stateStack[yytos]; // automatic insertion of `;' - if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && automatic(yytoken)) { + if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) { _tokens.prepend(yytoken); _tokenStrings.prepend(yytokentext); yyaction = yyerrorstate; @@ -461,7 +456,7 @@ bool Tokenize::parse(int startToken) const int yyerrorstate = _stateStack[yytos]; // automatic insertion of `;' - if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && automatic(yytoken)) { + if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) { _tokens.prepend(yytoken); _tokenStrings.prepend(yytokentext); yyaction = yyerrorstate; |