Commit 62d5b16a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed QScriptParser::loc(n)

parent 979d9b36
......@@ -316,7 +316,7 @@ protected:
{ return sym_stack [tos + index - 1]; }
inline Location &loc(int index)
{ return location_stack [tos + index - 2]; }
{ return location_stack [tos + index - 1]; }
protected:
int tos;
......@@ -336,6 +336,7 @@ protected:
double yylval;
Location yylloc;
Location yyprevlloc;
SavedToken token_buffer[TOKEN_BUFFER_SIZE];
SavedToken *first_token;
......@@ -427,6 +428,8 @@ bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
_Lcheck_token:
if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
yyprevlloc = yylloc;
if (first_token == last_token) {
yytoken = lexer->lex();
yylval = lexer->dval();
......@@ -2092,7 +2095,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
const QString msg = QString::fromUtf8("Missing `;'");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
yylloc.startLine, yylloc.startColumn, msg));
yyprevlloc.startLine, yyprevlloc.startColumn, msg));
first_token = &token_buffer[0];
last_token = &token_buffer[1];
......
......@@ -2,41 +2,13 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
** This file is part of the $MODULE$ of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
** $TROLLTECH_DUAL_LICENSE$
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
......
......@@ -2,41 +2,13 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
** This file is part of the $MODULE$ of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
** $TROLLTECH_DUAL_LICENSE$
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
......
......@@ -132,6 +132,8 @@ bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
_Lcheck_token:
if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
yyprevlloc = yylloc;
if (first_token == last_token) {
yytoken = lexer->lex();
yylval = lexer->dval();
......@@ -1097,7 +1099,7 @@ case 266: {
const QString msg = QString::fromUtf8("Missing `;'");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
yylloc.startLine, yylloc.startColumn, msg));
yyprevlloc.startLine, yyprevlloc.startColumn, msg));
first_token = &token_buffer[0];
last_token = &token_buffer[1];
......
......@@ -167,7 +167,7 @@ protected:
{ return sym_stack [tos + index - 1]; }
inline Location &loc(int index)
{ return location_stack [tos + index - 2]; }
{ return location_stack [tos + index - 1]; }
protected:
int tos;
......@@ -187,6 +187,7 @@ protected:
double yylval;
Location yylloc;
Location yyprevlloc;
SavedToken token_buffer[TOKEN_BUFFER_SIZE];
SavedToken *first_token;
......
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