summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-04-24 09:53:32 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-04-24 09:53:32 (GMT)
commit732f54672e886ac535ed3af7b46b68d6cf44461c (patch)
tree8a19de0568bcf30b38f575ae0a93ab77e6a7a7e7
parentee2af7b5de4d8cfc7db31a389b400ce5420f501b (diff)
downloadQt-732f54672e886ac535ed3af7b46b68d6cf44461c.zip
Qt-732f54672e886ac535ed3af7b46b68d6cf44461c.tar.gz
Qt-732f54672e886ac535ed3af7b46b68d6cf44461c.tar.bz2
Don't generate T_AUTOMATIC_SEMICOLON when recovering from a syntax error.
-rw-r--r--src/declarative/qml/parser/javascript.g11
-rw-r--r--src/declarative/qml/parser/javascriptparser.cpp11
2 files changed, 14 insertions, 8 deletions
diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g
index 3686aac..b1bd49f 100644
--- a/src/declarative/qml/parser/javascript.g
+++ b/src/declarative/qml/parser/javascript.g
@@ -2564,7 +2564,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Removed token: `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -2594,7 +2594,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Inserted token: `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -2612,9 +2612,12 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
for (int tk = 1; tk < TERMINAL_COUNT; ++tk) {
+ if (tk == T_AUTOMATIC_SEMICOLON)
+ continue;
+
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Inserted token: `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -2627,7 +2630,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
}
- const QString msg = QString::fromUtf8("Unexpected token");
+ const QString msg = QString::fromUtf8("Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
}
diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp
index ea65267..9959e58 100644
--- a/src/declarative/qml/parser/javascriptparser.cpp
+++ b/src/declarative/qml/parser/javascriptparser.cpp
@@ -1478,7 +1478,7 @@ case 293: {
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Removed token: `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -1508,7 +1508,7 @@ case 293: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Inserted token: `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -1526,9 +1526,12 @@ case 293: {
}
for (int tk = 1; tk < TERMINAL_COUNT; ++tk) {
+ if (tk == T_AUTOMATIC_SEMICOLON)
+ continue;
+
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Inserted token: `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
@@ -1541,7 +1544,7 @@ case 293: {
}
}
- const QString msg = QString::fromUtf8("Unexpected token");
+ const QString msg = QString::fromUtf8("Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
}