27 #include <QtCore/QtDebug> 31 #define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \ 32 node->startLine = startloc.startLine; \ 33 node->startColumn = startloc.startColumn; \ 34 node->endLine = endloc.endLine; \ 35 node->endColumn = endloc.endColumn; \ 53 || driver->lexer()->prevTerminator();
87 const int INITIAL_STATE = 0;
91 int saved_yytoken = -1;
103 if (saved_yytoken == -1)
105 yytoken = lexer->
lex();
110 yytoken = saved_yytoken;
115 int act =
t_action (state, yytoken);
141 sym(1).
Node = QScript::makeAstNode<QScript::AST::ThisExpression> (driver->nodePool());
146 sym(1).
Node = QScript::makeAstNode<QScript::AST::IdentifierExpression> (driver->nodePool(),
sym(1).
sval);
151 sym(1).
Node = QScript::makeAstNode<QScript::AST::NullExpression> (driver->nodePool());
156 sym(1).
Node = QScript::makeAstNode<QScript::AST::TrueLiteral> (driver->nodePool());
161 sym(1).
Node = QScript::makeAstNode<QScript::AST::FalseLiteral> (driver->nodePool());
166 sym(1).
Node = QScript::makeAstNode<QScript::AST::NumericLiteral> (driver->nodePool(),
sym(1).
dval);
171 sym(1).
Node = QScript::makeAstNode<QScript::AST::StringLiteral> (driver->nodePool(),
sym(1).
sval);
183 sym(1).
Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->
pattern, lexer->
flags);
195 sym(1).
Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->
pattern, lexer->
flags);
200 sym(1).
Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(),
sym(2).
Elision);
218 sym(1).
Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool());
243 sym(1).
Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool());
248 sym(1).
Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool(),
sym(1).
Elision);
272 sym(1).
Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(),
sym(1).
sval);
277 sym(1).
Node = QScript::makeAstNode<QScript::AST::StringLiteralPropertyName> (driver->nodePool(),
sym(1).
sval);
282 sym(1).
Node = QScript::makeAstNode<QScript::AST::NumericLiteralPropertyName> (driver->nodePool(),
sym(1).
dval);
287 sym(1).
Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(),
sym(1).
sval);
372 sym(1).
Node = QScript::makeAstNode<QScript::AST::NewExpression> (driver->nodePool(),
sym(2).
Expression);
406 sym(1).
Node = QScript::makeAstNode<QScript::AST::ArgumentList> (driver->nodePool(),
sym(1).
Expression);
416 sym(1).
Node = QScript::makeAstNode<QScript::AST::PostIncrementExpression> (driver->nodePool(),
sym(1).
Expression);
421 sym(1).
Node = QScript::makeAstNode<QScript::AST::PostDecrementExpression> (driver->nodePool(),
sym(1).
Expression);
426 sym(1).
Node = QScript::makeAstNode<QScript::AST::DeleteExpression> (driver->nodePool(),
sym(2).
Expression);
431 sym(1).
Node = QScript::makeAstNode<QScript::AST::VoidExpression> (driver->nodePool(),
sym(2).
Expression);
436 sym(1).
Node = QScript::makeAstNode<QScript::AST::TypeOfExpression> (driver->nodePool(),
sym(2).
Expression);
441 sym(1).
Node = QScript::makeAstNode<QScript::AST::PreIncrementExpression> (driver->nodePool(),
sym(2).
Expression);
446 sym(1).
Node = QScript::makeAstNode<QScript::AST::PreDecrementExpression> (driver->nodePool(),
sym(2).
Expression);
451 sym(1).
Node = QScript::makeAstNode<QScript::AST::UnaryPlusExpression> (driver->nodePool(),
sym(2).
Expression);
456 sym(1).
Node = QScript::makeAstNode<QScript::AST::UnaryMinusExpression> (driver->nodePool(),
sym(2).
Expression);
461 sym(1).
Node = QScript::makeAstNode<QScript::AST::TildeExpression> (driver->nodePool(),
sym(2).
Expression);
466 sym(1).
Node = QScript::makeAstNode<QScript::AST::NotExpression> (driver->nodePool(),
sym(2).
Expression);
747 sym(1).
Node = QScript::makeAstNode<QScript::AST::StatementList> (driver->nodePool(),
sym(1).
Statement);
826 sym(1).
Node = QScript::makeAstNode<QScript::AST::EmptyStatement> (driver->nodePool());
831 sym(1).
Node = QScript::makeAstNode<QScript::AST::ExpressionStatement> (driver->nodePool(),
sym(1).
Expression);
876 sym(1).
Node = QScript::makeAstNode<QScript::AST::ContinueStatement> (driver->nodePool());
881 sym(1).
Node = QScript::makeAstNode<QScript::AST::ContinueStatement> (driver->nodePool(),
sym(2).
sval);
886 sym(1).
Node = QScript::makeAstNode<QScript::AST::BreakStatement> (driver->nodePool());
891 sym(1).
Node = QScript::makeAstNode<QScript::AST::BreakStatement> (driver->nodePool(),
sym(2).
sval);
896 sym(1).
Node = QScript::makeAstNode<QScript::AST::ReturnStatement> (driver->nodePool(),
sym(2).
Expression);
911 sym(1).
Node = QScript::makeAstNode<QScript::AST::CaseBlock> (driver->nodePool(),
sym(2).
CaseClauses);
921 sym(1).
Node = QScript::makeAstNode<QScript::AST::CaseClauses> (driver->nodePool(),
sym(1).
CaseClause);
955 sym(1).
Node = QScript::makeAstNode<QScript::AST::ThrowStatement> (driver->nodePool(),
sym(2).
Expression);
980 sym(1).
Node = QScript::makeAstNode<QScript::AST::Finally> (driver->nodePool(),
sym(2).
Statement);
985 sym(1).
Node = QScript::makeAstNode<QScript::AST::DebuggerStatement> (driver->nodePool());
1000 sym(1).
Node = QScript::makeAstNode<QScript::AST::FormalParameterList> (driver->nodePool(),
sym(1).
sval);
1029 driver->changeAbstractSyntaxTree(
sym(1).
Node);
1044 sym(1).
Node = QScript::makeAstNode<QScript::AST::StatementSourceElement> (driver->nodePool(),
sym(1).
Statement);
1076 saved_yytoken = yytoken;
1081 else if ((state == INITIAL_STATE) && (yytoken == 0)) {
1090 int expected_tokens [3];
1099 else if (
spell [tk])
1102 expected_tokens [shifts] = tk;
1108 if (shifts && shifts < 3)
1112 for (
int s = 0; s < shifts; ++s)
QScript::AST::Statement * Statement
#define QT_END_NAMESPACE
This macro expands to.
QScript::AST::FunctionDeclaration * FunctionDeclaration
bool parse(QScriptEnginePrivate *driver)
Q_CORE_EXPORT void qFree(void *ptr)
static int t_action(int state, int token)
static int nt_action(int state, int nt)
QScript::AST::Finally * Finally
VariableDeclarationList * finish(bool readOnly)
QScript::AST::VariableDeclaration * VariableDeclaration
Location * location_stack
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static bool automatic(QScriptEnginePrivate *driver, int token)
int characterCount() const
QScript::AST::ExpressionNode * Expression
QScript::AST::Catch * Catch
QScript::AST::StatementList * StatementList
Location & loc(int index)
#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc)
QScript::AST::CaseClause * CaseClause
#define QT_BEGIN_NAMESPACE
This macro expands to.
QScript::AST::SourceElement * SourceElement
QString errorMessage() const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QScript::AST::ElementList * ElementList
QScriptNameIdImpl * pattern
QScript::AST::ArgumentList * ArgumentList
bool scanRegExp(RegExpBodyPrefix prefix=NoPrefix)
static QScriptParser::Location location(QScript::Lexer *lexer)
QScript::AST::DefaultClause * DefaultClause
QScript::AST::SourceElements * SourceElements
static const short action_index[]
QScript::AST::FunctionBody * FunctionBody
QScript::AST::PropertyName * PropertyName
PropertyNameAndValueList * finish()
void clear()
Clears the contents of the string and makes it empty.
const QChar * characterBuffer() const
QScript::AST::Node * Node
QScript::AST::CaseClauses * CaseClauses
static const char *const spell[]
SourceElements * finish()
QScript::AST::CaseBlock * CaseBlock
QScript::AST::Elision * Elision
QScript::AST::VariableDeclarationList * VariableDeclarationList
int startColumnNo() const
QScript::AST::PropertyNameAndValueList * PropertyNameAndValueList
QScript::AST::FormalParameterList * FormalParameterList