From 823dc78d3c0b22f2b5fecf3cb5be49e3ba0c2f56 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 15 Sep 2011 17:08:22 +0200 Subject: 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 Reviewed-by: Kent Hansen --- tools/qmlmin/main.cpp | 9 ++------- 1 file 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; -- cgit v1.2.3