Commit 73a447ff authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed fix for QTCREATORBUG-509.

parent e5abb34d
......@@ -167,6 +167,7 @@
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g
//
#ifndef JAVASCRIPTPARSER_P_H
......@@ -327,6 +328,7 @@ inline void JavaScriptParser::reallocateStack()
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g
//
QT_BEGIN_NAMESPACE
......@@ -2159,11 +2161,13 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
QString msg = QString::fromUtf8("Unexpected token");
if (const char *tokenSpell = spell[token_buffer[0].token]) {
msg += QLatin1String(": `");
msg += QLatin1String(tokenSpell);
msg += QLatin1Char('\'');
}
if (token_buffer[0].token >= 0 && token_buffer[0].token < TERMINAL_COUNT) {
if (const char *tokenSpell = spell[token_buffer[0].token]) {
msg += QLatin1String(": `");
msg += QLatin1String(tokenSpell);
msg += QLatin1Char('\'');
}
} // ### FIXME: at this point, we should give more information than just "Unexpected token". However, we need more error recovery support from qlalr.
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
......
......@@ -41,7 +41,7 @@ const char *const JavaScriptGrammar::spell [] = {
"try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true",
"false", "const", "debugger", "reserved word"};
const int JavaScriptGrammar::lhs [] = {
const short JavaScriptGrammar::lhs [] = {
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 87, 87, 92, 92, 86,
86, 89, 89, 93, 93, 93, 93, 94, 94, 94,
......@@ -70,7 +70,7 @@ const int JavaScriptGrammar::lhs [] = {
163, 97, 167, 167, 164, 164, 165, 165, 168, 84,
169, 169, 170, 170, 166, 166, 88, 88, 171};
const int JavaScriptGrammar:: rhs[] = {
const short JavaScriptGrammar::rhs [] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
3, 5, 3, 4, 3, 2, 4, 1, 2, 0,
1, 3, 5, 1, 1, 1, 1, 1, 1, 1,
......@@ -99,7 +99,7 @@ const int JavaScriptGrammar:: rhs[] = {
8, 8, 1, 3, 0, 1, 0, 1, 1, 1,
1, 2, 1, 1, 0, 1, 0, 1, 2};
const int JavaScriptGrammar::action_default [] = {
const short JavaScriptGrammar::action_default [] = {
0, 98, 165, 129, 137, 133, 173, 180, 77, 149,
179, 187, 175, 125, 0, 176, 264, 62, 177, 178,
183, 78, 141, 145, 66, 95, 76, 81, 61, 0,
......@@ -148,7 +148,7 @@ const int JavaScriptGrammar::action_default [] = {
15, 88, 86, 90, 87, 85, 89, 204, 197, 0,
205, 201, 0, 203, 193, 0, 194, 198};
const int JavaScriptGrammar::goto_default [] = {
const short JavaScriptGrammar::goto_default [] = {
29, 28, 439, 437, 113, 112, 14, 2, 438, 111,
114, 194, 24, 17, 190, 26, 8, 201, 21, 27,
77, 25, 1, 32, 30, 270, 13, 264, 3, 260,
......@@ -159,7 +159,7 @@ const int JavaScriptGrammar::goto_default [] = {
460, 324, 395, 399, 402, 398, 397, 417, 418, 16,
100, 107, 96, 99, 106, 108, 33, 0};
const int JavaScriptGrammar::action_index [] = {
const short JavaScriptGrammar::action_index [] = {
1318, 79, -84, 56, 39, -17, -84, -84, 169, -84,
-84, -84, -84, 216, 149, -84, -84, -84, -84, -84,
-84, 475, 68, 100, 180, 184, -84, -84, -84, 99,
......@@ -256,7 +256,7 @@ const int JavaScriptGrammar::action_index [] = {
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, 5, -88, -88, -56, -88, -88};
const int JavaScriptGrammar::action_info [] = {
const short JavaScriptGrammar::action_info [] = {
305, 307, 109, 400, 400, 400, 273, 105, 416, 302,
297, 295, 293, 423, 273, 151, 313, 321, 406, 407,
424, 295, 422, 198, 420, 149, 313, 353, -47, 396,
......@@ -447,7 +447,7 @@ const int JavaScriptGrammar::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
const int JavaScriptGrammar::action_check [] = {
const short JavaScriptGrammar::action_check [] = {
61, 60, 55, 5, 5, 5, 1, 33, 33, 61,
8, 76, 48, 29, 1, 8, 2, 29, 55, 7,
60, 76, 36, 8, 20, 7, 2, 16, 7, 33,
......
// This file was generated by qlalr - DO NOT EDIT!
/**************************************************************************
**
** This file is part of Qt Creator
......@@ -141,27 +142,22 @@ public:
GOTO_CHECK_OFFSET = 1562
};
static const char *const spell [];
static const int lhs [];
static const int rhs [];
static const int goto_default [];
static const int action_default [];
static const int action_index [];
static const int action_info [];
static const int action_check [];
static const char *const spell [];
static const short lhs [];
static const short rhs [];
static const short goto_default [];
static const short action_default [];
static const short action_index [];
static const short action_info [];
static const short action_check [];
static inline int nt_action (int state, int nt)
{
const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];
const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];
const int yyn = goto_index [state] + nt;
if (yyn < 0 || goto_check [yyn] != nt)
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
return goto_default [nt];
const int *const goto_info = &action_info [GOTO_INFO_OFFSET];
return goto_info [yyn];
return action_info [GOTO_INFO_OFFSET + yyn];
}
static inline int t_action (int state, int token)
......
......@@ -48,6 +48,7 @@
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g
//
QT_BEGIN_NAMESPACE
......@@ -1180,13 +1181,13 @@ case 266: {
}
QString msg = QString::fromUtf8("Unexpected token");
if (token_buffer[0].token >= 0 && token_buffer[0].token < TERMINAL_COUNT) { // ### FIXME: band-aid, see QTCREATORBUG-509.
if (token_buffer[0].token >= 0 && token_buffer[0].token < TERMINAL_COUNT) {
if (const char *tokenSpell = spell[token_buffer[0].token]) {
msg += QLatin1String(": `");
msg += QLatin1String(tokenSpell);
msg += QLatin1Char('\'');
}
}
} // ### FIXME: at this point, we should give more information than just "Unexpected token". However, we need more error recovery support from qlalr.
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
......
......@@ -43,15 +43,13 @@
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g
//
#ifndef JAVASCRIPTPARSER_P_H
#define JAVASCRIPTPARSER_P_H
#include "javascriptgrammar_p.h"
#include "javascriptastfwd_p.h"
#include <QtCore/QList>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment