[556] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[556] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
| 6 | **
|
---|
| 7 | ** This file is part of the QtScript module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL-ONLY$
|
---|
| 10 | ** GNU Lesser General Public License Usage
|
---|
| 11 | ** This file may be used under the terms of the GNU Lesser
|
---|
| 12 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 13 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 14 | ** packaging of this file. Please review the following information to
|
---|
| 15 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 16 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 17 | **
|
---|
| 18 | ** If you have questions regarding the use of this file, please contact
|
---|
| 19 | ** Nokia at [email protected].
|
---|
| 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 |
|
---|
| 50 | QT_BEGIN_NAMESPACE
|
---|
| 51 |
|
---|
| 52 | class QString;
|
---|
| 53 | class QScriptEnginePrivate;
|
---|
| 54 | class QScriptNameIdImpl;
|
---|
| 55 |
|
---|
| 56 | class QScriptParser: protected QScriptGrammar
|
---|
| 57 | {
|
---|
| 58 | public:
|
---|
| 59 | union Value {
|
---|
| 60 | int ival;
|
---|
| 61 | double dval;
|
---|
| 62 | QScriptNameIdImpl *sval;
|
---|
| 63 | QScript::AST::ArgumentList *ArgumentList;
|
---|
| 64 | QScript::AST::CaseBlock *CaseBlock;
|
---|
| 65 | QScript::AST::CaseClause *CaseClause;
|
---|
| 66 | QScript::AST::CaseClauses *CaseClauses;
|
---|
| 67 | QScript::AST::Catch *Catch;
|
---|
| 68 | QScript::AST::DefaultClause *DefaultClause;
|
---|
| 69 | QScript::AST::ElementList *ElementList;
|
---|
| 70 | QScript::AST::Elision *Elision;
|
---|
| 71 | QScript::AST::ExpressionNode *Expression;
|
---|
| 72 | QScript::AST::Finally *Finally;
|
---|
| 73 | QScript::AST::FormalParameterList *FormalParameterList;
|
---|
| 74 | QScript::AST::FunctionBody *FunctionBody;
|
---|
| 75 | QScript::AST::FunctionDeclaration *FunctionDeclaration;
|
---|
| 76 | QScript::AST::Node *Node;
|
---|
| 77 | QScript::AST::PropertyName *PropertyName;
|
---|
| 78 | QScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
|
---|
| 79 | QScript::AST::SourceElement *SourceElement;
|
---|
| 80 | QScript::AST::SourceElements *SourceElements;
|
---|
| 81 | QScript::AST::Statement *Statement;
|
---|
| 82 | QScript::AST::StatementList *StatementList;
|
---|
| 83 | QScript::AST::VariableDeclaration *VariableDeclaration;
|
---|
| 84 | QScript::AST::VariableDeclarationList *VariableDeclarationList;
|
---|
| 85 | };
|
---|
| 86 |
|
---|
| 87 | struct Location {
|
---|
| 88 | int startLine;
|
---|
| 89 | int startColumn;
|
---|
| 90 | int endLine;
|
---|
| 91 | int endColumn;
|
---|
| 92 | };
|
---|
| 93 |
|
---|
| 94 | public:
|
---|
| 95 | QScriptParser();
|
---|
| 96 | ~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;
|
---|
| 118 | int stack_size;
|
---|
| 119 | Value *sym_stack;
|
---|
| 120 | int *state_stack;
|
---|
| 121 | Location *location_stack;
|
---|
| 122 | QString error_message;
|
---|
| 123 | int error_lineno;
|
---|
| 124 | int error_column;
|
---|
| 125 | };
|
---|
| 126 |
|
---|
| 127 | inline void QScriptParser::reallocateStack()
|
---|
| 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 |
|
---|
| 144 | QT_END_NAMESPACE
|
---|
| 145 |
|
---|
| 146 | #endif // QSCRIPTPARSER_P_H
|
---|