Qt 4.8
qscriptparser_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtScript module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL-ONLY$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.LGPL included in the
13 ** packaging of this file. Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** If you have questions regarding the use of this file, please contact
18 ** us via http://www.qt-project.org/.
19 **
20 ** $QT_END_LICENSE$
21 **
22 ****************************************************************************/
23 
24 // This file was generated by qlalr - DO NOT EDIT!
25 
26 
27 //
28 // W A R N I N G
29 // -------------
30 //
31 // This file is not part of the Qt API. It exists purely as an
32 // implementation detail. This header file may change from version to
33 // version without notice, or even be removed.
34 //
35 // We mean it.
36 //
37 
38 //
39 // This file is automatically generated from qscript.g.
40 // Changes will be lost.
41 //
42 
43 #ifndef QSCRIPTPARSER_P_H
44 #define QSCRIPTPARSER_P_H
45 
46 #include "qscriptgrammar_p.h"
47 
48 #include "qscriptastfwd_p.h"
49 
51 
52 class QString;
54 class QScriptNameIdImpl;
55 
56 class QScriptParser: protected QScriptGrammar
57 {
58 public:
59  union Value {
60  int ival;
61  double dval;
62  QScriptNameIdImpl *sval;
85  };
86 
87  struct Location {
88  int startLine;
90  int endLine;
91  int endColumn;
92  };
93 
94 public:
95  QScriptParser();
97 
98  bool parse(QScriptEnginePrivate *driver);
99 
100  inline QString errorMessage() const
101  { return error_message; }
102  inline int errorLineNumber() const
103  { return error_lineno; }
104  inline int errorColumnNumber() const
105  { return error_column; }
106 
107 protected:
108  inline void reallocateStack();
109 
110  inline Value &sym(int index)
111  { return sym_stack [tos + index - 1]; }
112 
113  inline Location &loc(int index)
114  { return location_stack [tos + index - 2]; }
115 
116 protected:
117  int tos;
125 };
126 
128 {
129  if (! stack_size)
130  stack_size = 128;
131  else
132  stack_size <<= 1;
133 
134  sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
135  state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
136  location_stack = reinterpret_cast<Location*> (qRealloc(location_stack, stack_size * sizeof(Location)));
137 }
138 
139 
140 #define Q_SCRIPT_REGEXPLITERAL_RULE1 7
141 
142 #define Q_SCRIPT_REGEXPLITERAL_RULE2 8
143 
145 
146 #endif // QSCRIPTPARSER_P_H
QScript::AST::Statement * Statement
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QScript::AST::FunctionDeclaration * FunctionDeclaration
QString error_message
bool parse(QScriptEnginePrivate *driver)
QScript::AST::Finally * Finally
QScript::AST::VariableDeclaration * VariableDeclaration
Location * location_stack
Q_CORE_EXPORT void * qRealloc(void *ptr, size_t size)
Definition: qmalloc.cpp:63
The QString class provides a Unicode character string.
Definition: qstring.h:83
QScript::AST::ExpressionNode * Expression
QScript::AST::Catch * Catch
QScript::AST::StatementList * StatementList
Location & loc(int index)
QScript::AST::CaseClause * CaseClause
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Value & sym(int index)
QScript::AST::SourceElement * SourceElement
QScript::AST::ElementList * ElementList
QScript::AST::ArgumentList * ArgumentList
QScript::AST::DefaultClause * DefaultClause
QScript::AST::SourceElements * SourceElements
QScript::AST::FunctionBody * FunctionBody
void reallocateStack()
int errorColumnNumber() const
QScript::AST::PropertyName * PropertyName
QString errorMessage() const
QScriptNameIdImpl * sval
quint16 index
QScript::AST::Node * Node
QScript::AST::CaseClauses * CaseClauses
QScript::AST::CaseBlock * CaseBlock
QScript::AST::Elision * Elision
QScript::AST::VariableDeclarationList * VariableDeclarationList
QScript::AST::PropertyNameAndValueList * PropertyNameAndValueList
int errorLineNumber() const
QScript::AST::FormalParameterList * FormalParameterList