QmlJS: Update parser from Qt5.

Change-Id: I26a5fb6a1eb99a777e4f1e01fb7b19e559c9bce7
Reviewed-on: http://codereview.qt-project.org/5143
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Christian Kamm
2011-09-19 14:09:26 +02:00
parent dbfae9fb28
commit 25f37732b0
7 changed files with 182 additions and 152 deletions

View File

@@ -31,7 +31,7 @@
**************************************************************************/
#include <QtCore/QtDebug>
#include <QtGui/QApplication>
#include <QtCore/QCoreApplication>
#include <string.h>
@@ -67,14 +67,6 @@ void Parser::reallocateStack()
string_stack = reinterpret_cast<QStringRef*> (qRealloc(string_stack, stack_size * sizeof(QStringRef)));
}
inline static bool automatic(Engine *driver, int token)
{
return token == QmlJSGrammar::T_RBRACE
|| token == 0
|| driver->lexer()->prevTerminator();
}
Parser::Parser(Engine *engine):
driver(engine),
pool(engine->pool()),
@@ -1687,7 +1679,7 @@ case 342: {
const int errorState = state_stack[tos];
// automatic insertion of `;'
if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;