From ef39553502d9380eebf494a1de48b9bfa32c5df4 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Wed, 7 Oct 2009 12:12:59 +0200
Subject: [PATCH] Regenerated the JS parser to incorporate a bug fix.
 Reviewed-by: Roberto Raggi

---
 src/plugins/qtscripteditor/parser/cmd.sed     | 16 ------
 src/plugins/qtscripteditor/parser/gen.sh      | 49 -------------------
 .../parser/javascriptgrammar.cpp              | 41 ++++++++++++++++
 .../parser/javascriptgrammar_p.h              | 36 ++++++++++++--
 .../parser/javascriptparser.cpp               |  2 +-
 5 files changed, 74 insertions(+), 70 deletions(-)
 delete mode 100644 src/plugins/qtscripteditor/parser/cmd.sed
 delete mode 100644 src/plugins/qtscripteditor/parser/gen.sh

diff --git a/src/plugins/qtscripteditor/parser/cmd.sed b/src/plugins/qtscripteditor/parser/cmd.sed
deleted file mode 100644
index d9ffe43a9fd..00000000000
--- a/src/plugins/qtscripteditor/parser/cmd.sed
+++ /dev/null
@@ -1,16 +0,0 @@
-s/#include "qscriptcontext_p.h"//g
-s/#include "qscriptcontext.h"//g
-s/#include "qscriptengine.h"//g
-s/#include "qscriptmember_p.h"//g
-s/#include "qscriptobject_p.h"//g
-s/#include "qscriptvalueimpl_p.h"//g
-
-s/#ifndef QT_NO_SCRIPT//g
-s,#endif // QT_NO_SCRIPT,,g
-
-s/QScript/JavaScript/g
-s/QSCRIPT/JAVASCRIPT/g
-s/qscript/javascript/g
-s/Q_SCRIPT/J_SCRIPT/g
-
-s/qsreal/qjsreal/g
\ No newline at end of file
diff --git a/src/plugins/qtscripteditor/parser/gen.sh b/src/plugins/qtscripteditor/parser/gen.sh
deleted file mode 100644
index cc4054e06ad..00000000000
--- a/src/plugins/qtscripteditor/parser/gen.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-me=$(dirname $0)
-
-rm -f javascript.g
-rm -f javascriptast.cpp
-rm -f javascriptast_p.h
-rm -f javascriptastfwd_p.h
-rm -f javascriptastvisitor.cpp
-rm -f javascriptastvisitor_p.h
-rm -f javascriptlexer.cpp
-rm -f javascriptlexer_p.h
-rm -f javascriptmemorypool_p.h
-rm -f javascriptnodepool_p.h
-
-rm -f javascriptgrammar_p.h
-rm -f javascriptgrammar.cpp
-rm -f javascriptparser_p.h
-rm -f javascriptparser.cpp
-
-sed -f $me/cmd.sed $QTDIR/src/script/qscript.g > javascript.g
-
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptast.cpp > javascriptast.cpp
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptast_p.h > javascriptast_p.h
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptastfwd_p.h > javascriptastfwd_p.h
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor.cpp > javascriptastvisitor.cpp
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor_p.h > javascriptastvisitor_p.h
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer_p.h > javascriptlexer_p.h
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer.cpp > javascriptlexer.cpp
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptmemorypool_p.h > javascriptmemorypool_p.h
-sed -f $me/cmd.sed $QTDIR/src/script/qscriptnodepool_p.h > javascriptnodepool_p.h
-
-qlalr --troll --no-lines --no-debug $me/javascript.g
-
-chmod ugo-w javascript.g
-chmod ugo-w javascriptast.cpp
-chmod ugo-w javascriptast_p.h
-chmod ugo-w javascriptastfwd_p.h
-chmod ugo-w javascriptastvisitor.cpp
-chmod ugo-w javascriptastvisitor_p.h
-chmod ugo-w javascriptlexer_p.h
-chmod ugo-w javascriptlexer.cpp
-chmod ugo-w javascriptmemorypool_p.h
-chmod ugo-w javascriptnodepool_p.h
-
-chmod ugo-w javascriptgrammar_p.h
-chmod ugo-w javascriptgrammar.cpp
-chmod ugo-w javascriptparser_p.h
-chmod ugo-w javascriptparser.cpp
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
index 1c46c75562f..aaa8cd092b5 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
@@ -1,4 +1,45 @@
 // This file was generated by qlalr - DO NOT EDIT!
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
 #include "javascriptgrammar_p.h"
 
 const char *const JavaScriptGrammar::spell [] = {
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
index 8e62d4abd06..3126ed08cf1 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
@@ -2,13 +2,41 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
 **
-** $TROLLTECH_DUAL_LICENSE$
+** $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 Technology Preview License Agreement accompanying
+** this package.
 **
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
 **
 ****************************************************************************/
 
diff --git a/src/plugins/qtscripteditor/parser/javascriptparser.cpp b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
index 66acc68e6b1..b63a9fbe93a 100644
--- a/src/plugins/qtscripteditor/parser/javascriptparser.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
@@ -1122,7 +1122,7 @@ case 266: {
         token_buffer[1].dval  = yylval  = lexer->dval();
         token_buffer[1].loc   = yylloc  = location(lexer);
 
-        if (t_action(errorState, yytoken)) {
+        if (token_buffer[0].token != -1 && t_action(errorState, yytoken)) {
             QString msg = QString::fromUtf8("Removed token");
             if (const char *tokenSpell = spell[token_buffer[0].token]) {
                 msg += QLatin1String(": `");
-- 
GitLab