summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2009-10-29 13:15:59 (GMT)
committerPeter Hartmann <peter.hartmann@nokia.com>2009-11-11 10:12:12 (GMT)
commit1502df3ddedc5a4365e12bce570d946744259785 (patch)
tree977757c93743bce8df23a180e64a08f749935ba7 /src/script
parentc412b5f144ea99ea70f4df291678631e13900962 (diff)
downloadQt-1502df3ddedc5a4365e12bce570d946744259785.zip
Qt-1502df3ddedc5a4365e12bce570d946744259785.tar.gz
Qt-1502df3ddedc5a4365e12bce570d946744259785.tar.bz2
utils/qlalr generator: adapt changes to xmlstream and script files
some changes were made to qxmlstream_p.h and script files directly; however, those files are generated automatically by src/corelib/xml/make-parser.sh and src/script/parser/make-parser.sh, respectively, so the generator would overwrite the manual changes to the files the next time it is run. This patch integrates those changes into the generator rather than into the files directly. Reviewed-by: Roberto Raggi Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rwxr-xr-xsrc/script/parser/make-parser.sh53
-rw-r--r--src/script/parser/qscript.g62
-rw-r--r--src/script/parser/qscriptgrammar.cpp16
-rw-r--r--src/script/parser/qscriptgrammar_p.h39
-rw-r--r--src/script/parser/qscriptparser.cpp11
-rw-r--r--src/script/parser/qscriptparser_p.h1
6 files changed, 126 insertions, 56 deletions
diff --git a/src/script/parser/make-parser.sh b/src/script/parser/make-parser.sh
new file mode 100755
index 0000000..d0c71fb
--- /dev/null
+++ b/src/script/parser/make-parser.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
+me=$(dirname $0)
+mkdir -p $me/out
+(cd $me/out && ../../../../util/qlalr/qlalr --qt --no-lines ../qscript.g)
+
+for f in $me/out/*.h $me/out/*.cpp; do
+ n=$(basename $f)
+ cp $f $n
+done
+
+git diff .
+
diff --git a/src/script/parser/qscript.g b/src/script/parser/qscript.g
index b0b0cdf..7e5568a 100644
--- a/src/script/parser/qscript.g
+++ b/src/script/parser/qscript.g
@@ -78,8 +78,7 @@
%start Program
-/.
-/****************************************************************************
+/./****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
@@ -87,12 +86,24 @@
**
** This file is part of the QtScript 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.
-** 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.
+**
+** 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.
@@ -108,20 +119,13 @@
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
#include <QtCore/QtDebug>
#include <string.h>
-#include "qscriptengine.h"
-#include "qscriptengine_p.h"
-#include "qscriptvalueimpl_p.h"
-#include "qscriptcontext_p.h"
-#include "qscriptmember_p.h"
-#include "qscriptobject_p.h"
-#include "qscriptlexer_p.h"
-#include "qscriptast_p.h"
-#include "qscriptnodepool_p.h"
-
#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
node->startLine = startloc.startLine; \
node->startColumn = startloc.startColumn; \
@@ -131,8 +135,7 @@
./
-/:
-/****************************************************************************
+/:/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
@@ -140,10 +143,25 @@
**
** This file is part of the QtScript 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.
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+**
+** 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.
**
@@ -153,10 +171,14 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
//
// W A R N I N G
// -------------
diff --git a/src/script/parser/qscriptgrammar.cpp b/src/script/parser/qscriptgrammar.cpp
index cbb1ab8..c7f661b 100644
--- a/src/script/parser/qscriptgrammar.cpp
+++ b/src/script/parser/qscriptgrammar.cpp
@@ -1,4 +1,3 @@
-// This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -40,6 +39,7 @@
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
#include "qscriptgrammar_p.h"
QT_BEGIN_NAMESPACE
@@ -68,7 +68,7 @@ const char *const QScriptGrammar::spell [] = {
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
};
-const int QScriptGrammar::lhs [] = {
+const short QScriptGrammar::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,
@@ -97,7 +97,7 @@ const int QScriptGrammar::lhs [] = {
163, 97, 167, 167, 164, 164, 165, 165, 168, 84,
169, 169, 170, 170, 166, 166, 88, 88, 171};
-const int QScriptGrammar:: rhs[] = {
+const short QScriptGrammar::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,
@@ -429,7 +429,7 @@ const int QScriptGrammar::rule_index [] = {
803, 805, 808, 810, 812, 813, 815, 816, 818};
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
-const int QScriptGrammar::action_default [] = {
+const short QScriptGrammar::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,
@@ -478,7 +478,7 @@ const int QScriptGrammar::action_default [] = {
15, 88, 86, 90, 87, 85, 89, 204, 197, 0,
205, 201, 0, 203, 193, 0, 194, 198};
-const int QScriptGrammar::goto_default [] = {
+const short QScriptGrammar::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,
@@ -489,7 +489,7 @@ const int QScriptGrammar::goto_default [] = {
460, 324, 395, 399, 402, 398, 397, 417, 418, 16,
100, 107, 96, 99, 106, 108, 33, 0};
-const int QScriptGrammar::action_index [] = {
+const short QScriptGrammar::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,
@@ -586,7 +586,7 @@ const int QScriptGrammar::action_index [] = {
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, 5, -88, -88, -56, -88, -88};
-const int QScriptGrammar::action_info [] = {
+const short QScriptGrammar::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,
@@ -777,7 +777,7 @@ const int QScriptGrammar::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
-const int QScriptGrammar::action_check [] = {
+const short QScriptGrammar::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,
diff --git a/src/script/parser/qscriptgrammar_p.h b/src/script/parser/qscriptgrammar_p.h
index 9e0f4f8..0cb6d22 100644
--- a/src/script/parser/qscriptgrammar_p.h
+++ b/src/script/parser/qscriptgrammar_p.h
@@ -39,11 +39,6 @@
**
****************************************************************************/
-// This file was generated by qlalr - DO NOT EDIT!
-
-#ifndef QSCRIPTGRAMMAR_P_H
-#define QSCRIPTGRAMMAR_P_H
-
//
// W A R N I N G
// -------------
@@ -55,6 +50,10 @@
// We mean it.
//
+// This file was generated by qlalr - DO NOT EDIT!
+#ifndef QSCRIPTGRAMMAR_P_H
+#define QSCRIPTGRAMMAR_P_H
+
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
@@ -159,33 +158,28 @@ public:
GOTO_CHECK_OFFSET = 1562
};
- static const char *const spell [];
- static const int lhs [];
- static const int rhs [];
+ static const char *const spell [];
+ static const short lhs [];
+ static const short rhs [];
#ifndef QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
static const int rule_index [];
static const int rule_info [];
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
- 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 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)
@@ -199,6 +193,7 @@ public:
}
};
-QT_END_NAMESPACE
+QT_END_NAMESPACE
#endif // QSCRIPTGRAMMAR_P_H
+
diff --git a/src/script/parser/qscriptparser.cpp b/src/script/parser/qscriptparser.cpp
index 197a486..5ea6c17 100644
--- a/src/script/parser/qscriptparser.cpp
+++ b/src/script/parser/qscriptparser.cpp
@@ -1,5 +1,3 @@
-// This file was generated by qlalr - DO NOT EDIT!
-
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -41,12 +39,13 @@
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
#include <QtCore/QtDebug>
#include <string.h>
-#include "qscriptast_p.h"
-
#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
node->startLine = startloc.startLine; \
node->startColumn = startloc.startColumn; \
@@ -1136,9 +1135,9 @@ case 266: {
error_message += QLatin1String (", ");
first = false;
- error_message += QLatin1Char('`');
+ error_message += QLatin1String("`");
error_message += QLatin1String (spell [expected_tokens [s]]);
- error_message += QLatin1Char('\'');
+ error_message += QLatin1String("'");
}
}
diff --git a/src/script/parser/qscriptparser_p.h b/src/script/parser/qscriptparser_p.h
index 5f62db7..c940e1e 100644
--- a/src/script/parser/qscriptparser_p.h
+++ b/src/script/parser/qscriptparser_p.h
@@ -41,6 +41,7 @@
// This file was generated by qlalr - DO NOT EDIT!
+
//
// W A R N I N G
// -------------