source: trunk/src/script/parser/qscript.g@ 1036

Last change on this file since 1036 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 62.4 KB
Line 
1----------------------------------------------------------------------------
2--
3-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
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%parser QScriptGrammar
25%decl qscriptparser_p.h
26%impl qscriptparser.cpp
27%expect 3
28%expect-rr 1
29
30%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&="
31%token T_BREAK "break" T_CASE "case" T_CATCH "catch"
32%token T_COLON ":" T_COMMA ";" T_CONTINUE "continue"
33%token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/"
34%token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "."
35%token T_ELSE "else" T_EQ "=" T_EQ_EQ "=="
36%token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for"
37%token T_FUNCTION "function" T_GE ">=" T_GT ">"
38%token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>"
39%token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if"
40%token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{"
41%token T_LBRACKET "[" T_LE "<=" T_LPAREN "("
42%token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<="
43%token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--"
44%token T_NEW "new" T_NOT "!" T_NOT_EQ "!="
45%token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|"
46%token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+"
47%token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?"
48%token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%"
49%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")"
50%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*"
51%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal"
52%token T_SWITCH "switch" T_THIS "this" T_THROW "throw"
53%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof"
54%token T_VAR "var" T_VOID "void" T_WHILE "while"
55%token T_WITH "with" T_XOR "^" T_XOR_EQ "^="
56%token T_NULL "null" T_TRUE "true" T_FALSE "false"
57%token T_CONST "const"
58%token T_DEBUGGER "debugger"
59%token T_RESERVED_WORD "reserved word"
60
61%start Program
62
63/./****************************************************************************
64**
65** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
66** All rights reserved.
67** Contact: Nokia Corporation ([email protected])
68**
69** This file is part of the QtScript module of the Qt Toolkit.
70**
71** $QT_BEGIN_LICENSE:LGPL$
72** Commercial Usage
73** Licensees holding valid Qt Commercial licenses may use this file in
74** accordance with the Qt Commercial License Agreement provided with the
75** Software or, alternatively, in accordance with the terms contained in
76** a written agreement between you and Nokia.
77**
78** GNU Lesser General Public License Usage
79** Alternatively, this file may be used under the terms of the GNU Lesser
80** General Public License version 2.1 as published by the Free Software
81** Foundation and appearing in the file LICENSE.LGPL included in the
82** packaging of this file. Please review the following information to
83** ensure the GNU Lesser General Public License version 2.1 requirements
84** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
85**
86** In addition, as a special exception, Nokia gives you certain additional
87** rights. These rights are described in the Nokia Qt LGPL Exception
88** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
89**
90** GNU General Public License Usage
91** Alternatively, this file may be used under the terms of the GNU
92** General Public License version 3.0 as published by the Free Software
93** Foundation and appearing in the file LICENSE.GPL included in the
94** packaging of this file. Please review the following information to
95** ensure the GNU General Public License version 3.0 requirements will be
96** met: http://www.gnu.org/copyleft/gpl.html.
97**
98** If you have questions regarding the use of this file, please contact
99** Nokia at [email protected].
100** $QT_END_LICENSE$
101**
102****************************************************************************/
103
104// This file was generated by qlalr - DO NOT EDIT!
105
106
107#include <QtCore/QtDebug>
108
109#include <string.h>
110
111#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
112 node->startLine = startloc.startLine; \
113 node->startColumn = startloc.startColumn; \
114 node->endLine = endloc.endLine; \
115 node->endColumn = endloc.endColumn; \
116} while (0)
117
118./
119
120/:/****************************************************************************
121**
122** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
123** All rights reserved.
124** Contact: Nokia Corporation ([email protected])
125**
126** This file is part of the QtScript module of the Qt Toolkit.
127**
128** $QT_BEGIN_LICENSE:LGPL$
129** Commercial Usage
130** Licensees holding valid Qt Commercial licenses may use this file in
131** accordance with the Qt Commercial License Agreement provided with the
132** Software or, alternatively, in accordance with the terms contained in
133** a written agreement between you and Nokia.
134**
135** GNU Lesser General Public License Usage
136** Alternatively, this file may be used under the terms of the GNU Lesser
137** General Public License version 2.1 as published by the Free Software
138** Foundation and appearing in the file LICENSE.LGPL included in the
139** packaging of this file. Please review the following information to
140** ensure the GNU Lesser General Public License version 2.1 requirements
141** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
142**
143** In addition, as a special exception, Nokia gives you certain additional
144** rights. These rights are described in the Nokia Qt LGPL Exception
145** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
146**
147** GNU General Public License Usage
148** Alternatively, this file may be used under the terms of the GNU
149** General Public License version 3.0 as published by the Free Software
150** Foundation and appearing in the file LICENSE.GPL included in the
151** packaging of this file. Please review the following information to
152** ensure the GNU General Public License version 3.0 requirements will be
153** met: http://www.gnu.org/copyleft/gpl.html.
154**
155** If you have questions regarding the use of this file, please contact
156** Nokia at [email protected].
157** $QT_END_LICENSE$
158**
159****************************************************************************/
160
161// This file was generated by qlalr - DO NOT EDIT!
162
163
164//
165// W A R N I N G
166// -------------
167//
168// This file is not part of the Qt API. It exists purely as an
169// implementation detail. This header file may change from version to
170// version without notice, or even be removed.
171//
172// We mean it.
173//
174
175//
176// This file is automatically generated from qscript.g.
177// Changes will be lost.
178//
179
180#ifndef QSCRIPTPARSER_P_H
181#define QSCRIPTPARSER_P_H
182
183#include "qscriptgrammar_p.h"
184
185#include "qscriptastfwd_p.h"
186
187QT_BEGIN_NAMESPACE
188
189class QString;
190class QScriptEnginePrivate;
191class QScriptNameIdImpl;
192
193class QScriptParser: protected $table
194{
195public:
196 union Value {
197 int ival;
198 double dval;
199 QScriptNameIdImpl *sval;
200 QScript::AST::ArgumentList *ArgumentList;
201 QScript::AST::CaseBlock *CaseBlock;
202 QScript::AST::CaseClause *CaseClause;
203 QScript::AST::CaseClauses *CaseClauses;
204 QScript::AST::Catch *Catch;
205 QScript::AST::DefaultClause *DefaultClause;
206 QScript::AST::ElementList *ElementList;
207 QScript::AST::Elision *Elision;
208 QScript::AST::ExpressionNode *Expression;
209 QScript::AST::Finally *Finally;
210 QScript::AST::FormalParameterList *FormalParameterList;
211 QScript::AST::FunctionBody *FunctionBody;
212 QScript::AST::FunctionDeclaration *FunctionDeclaration;
213 QScript::AST::Node *Node;
214 QScript::AST::PropertyName *PropertyName;
215 QScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
216 QScript::AST::SourceElement *SourceElement;
217 QScript::AST::SourceElements *SourceElements;
218 QScript::AST::Statement *Statement;
219 QScript::AST::StatementList *StatementList;
220 QScript::AST::VariableDeclaration *VariableDeclaration;
221 QScript::AST::VariableDeclarationList *VariableDeclarationList;
222 };
223
224 struct Location {
225 int startLine;
226 int startColumn;
227 int endLine;
228 int endColumn;
229 };
230
231public:
232 QScriptParser();
233 ~QScriptParser();
234
235 bool parse(QScriptEnginePrivate *driver);
236
237 inline QString errorMessage() const
238 { return error_message; }
239 inline int errorLineNumber() const
240 { return error_lineno; }
241 inline int errorColumnNumber() const
242 { return error_column; }
243
244protected:
245 inline void reallocateStack();
246
247 inline Value &sym(int index)
248 { return sym_stack [tos + index - 1]; }
249
250 inline Location &loc(int index)
251 { return location_stack [tos + index - 2]; }
252
253protected:
254 int tos;
255 int stack_size;
256 Value *sym_stack;
257 int *state_stack;
258 Location *location_stack;
259 QString error_message;
260 int error_lineno;
261 int error_column;
262};
263
264inline void QScriptParser::reallocateStack()
265{
266 if (! stack_size)
267 stack_size = 128;
268 else
269 stack_size <<= 1;
270
271 sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
272 state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
273 location_stack = reinterpret_cast<Location*> (qRealloc(location_stack, stack_size * sizeof(Location)));
274}
275
276:/
277
278
279/.
280
281#include "qscriptparser_p.h"
282
283//
284// This file is automatically generated from qscript.g.
285// Changes will be lost.
286//
287
288QT_BEGIN_NAMESPACE
289
290inline static bool automatic(QScriptEnginePrivate *driver, int token)
291{
292 return token == $table::T_RBRACE
293 || token == 0
294 || driver->lexer()->prevTerminator();
295}
296
297
298QScriptParser::QScriptParser():
299 tos(0),
300 stack_size(0),
301 sym_stack(0),
302 state_stack(0),
303 location_stack(0)
304{
305}
306
307QScriptParser::~QScriptParser()
308{
309 if (stack_size) {
310 qFree(sym_stack);
311 qFree(state_stack);
312 qFree(location_stack);
313 }
314}
315
316static inline QScriptParser::Location location(QScript::Lexer *lexer)
317{
318 QScriptParser::Location loc;
319 loc.startLine = lexer->startLineNo();
320 loc.startColumn = lexer->startColumnNo();
321 loc.endLine = lexer->endLineNo();
322 loc.endColumn = lexer->endColumnNo();
323 return loc;
324}
325
326bool QScriptParser::parse(QScriptEnginePrivate *driver)
327{
328 const int INITIAL_STATE = 0;
329 QScript::Lexer *lexer = driver->lexer();
330
331 int yytoken = -1;
332 int saved_yytoken = -1;
333
334 reallocateStack();
335
336 tos = 0;
337 state_stack[++tos] = INITIAL_STATE;
338
339 while (true)
340 {
341 const int state = state_stack [tos];
342 if (yytoken == -1 && - TERMINAL_COUNT != action_index [state])
343 {
344 if (saved_yytoken == -1)
345 {
346 yytoken = lexer->lex();
347 location_stack [tos] = location(lexer);
348 }
349 else
350 {
351 yytoken = saved_yytoken;
352 saved_yytoken = -1;
353 }
354 }
355
356 int act = t_action (state, yytoken);
357
358 if (act == ACCEPT_STATE)
359 return true;
360
361 else if (act > 0)
362 {
363 if (++tos == stack_size)
364 reallocateStack();
365
366 sym_stack [tos].dval = lexer->dval ();
367 state_stack [tos] = act;
368 location_stack [tos] = location(lexer);
369 yytoken = -1;
370 }
371
372 else if (act < 0)
373 {
374 int r = - act - 1;
375
376 tos -= rhs [r];
377 act = state_stack [tos++];
378
379 switch (r) {
380./
381
382PrimaryExpression: T_THIS ;
383/.
384case $rule_number: {
385 sym(1).Node = QScript::makeAstNode<QScript::AST::ThisExpression> (driver->nodePool());
386 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
387} break;
388./
389
390PrimaryExpression: T_IDENTIFIER ;
391/.
392case $rule_number: {
393 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
394 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
395} break;
396./
397
398PrimaryExpression: T_NULL ;
399/.
400case $rule_number: {
401 sym(1).Node = QScript::makeAstNode<QScript::AST::NullExpression> (driver->nodePool());
402 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
403} break;
404./
405
406PrimaryExpression: T_TRUE ;
407/.
408case $rule_number: {
409 sym(1).Node = QScript::makeAstNode<QScript::AST::TrueLiteral> (driver->nodePool());
410 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
411} break;
412./
413
414PrimaryExpression: T_FALSE ;
415/.
416case $rule_number: {
417 sym(1).Node = QScript::makeAstNode<QScript::AST::FalseLiteral> (driver->nodePool());
418 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
419} break;
420./
421
422PrimaryExpression: T_NUMERIC_LITERAL ;
423/.
424case $rule_number: {
425 sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
426 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
427} break;
428./
429
430PrimaryExpression: T_STRING_LITERAL ;
431/.
432case $rule_number: {
433 sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteral> (driver->nodePool(), sym(1).sval);
434 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
435} break;
436./
437
438PrimaryExpression: T_DIVIDE_ ;
439/:
440#define Q_SCRIPT_REGEXPLITERAL_RULE1 $rule_number
441:/
442/.
443case $rule_number: {
444 bool rx = lexer->scanRegExp(QScript::Lexer::NoPrefix);
445 if (!rx) {
446 error_message = lexer->errorMessage();
447 error_lineno = lexer->startLineNo();
448 error_column = lexer->startColumnNo();
449 return false;
450 }
451 sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
452 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
453} break;
454./
455
456PrimaryExpression: T_DIVIDE_EQ ;
457/:
458#define Q_SCRIPT_REGEXPLITERAL_RULE2 $rule_number
459:/
460/.
461case $rule_number: {
462 bool rx = lexer->scanRegExp(QScript::Lexer::EqualPrefix);
463 if (!rx) {
464 error_message = lexer->errorMessage();
465 error_lineno = lexer->startLineNo();
466 error_column = lexer->startColumnNo();
467 return false;
468 }
469 sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
470 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
471} break;
472./
473
474PrimaryExpression: T_LBRACKET ElisionOpt T_RBRACKET ;
475/.
476case $rule_number: {
477 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision);
478 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
479} break;
480./
481
482PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ;
483/.
484case $rule_number: {
485 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
486 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
487} break;
488./
489
490PrimaryExpression: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET ;
491/.
492case $rule_number: {
493 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision);
494 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5));
495} break;
496./
497
498-- PrimaryExpression: T_LBRACE T_RBRACE ;
499-- /.
500-- case $rule_number: {
501-- sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool());
502-- Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
503-- } break;
504-- ./
505
506PrimaryExpression: T_LBRACE PropertyNameAndValueListOpt T_RBRACE ;
507/.
508case $rule_number: {
509 if (sym(2).Node)
510 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ());
511 else
512 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool());
513 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
514} break;
515./
516
517PrimaryExpression: T_LBRACE PropertyNameAndValueList T_COMMA T_RBRACE ;
518/.
519case $rule_number: {
520 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ());
521 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
522} break;
523./
524
525PrimaryExpression: T_LPAREN Expression T_RPAREN ;
526/.
527case $rule_number: {
528 sym(1) = sym(2);
529 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
530} break;
531./
532
533ElementList: ElisionOpt AssignmentExpression ;
534/.
535case $rule_number: {
536 sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression);
537 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
538} break;
539./
540
541ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression ;
542/.
543case $rule_number: {
544 sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression);
545 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
546} break;
547./
548
549Elision: T_COMMA ;
550/.
551case $rule_number: {
552 sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool());
553 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
554} break;
555./
556
557Elision: Elision T_COMMA ;
558/.
559case $rule_number: {
560 sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool(), sym(1).Elision);
561 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
562} break;
563./
564
565ElisionOpt: ;
566/.
567case $rule_number: {
568 sym(1).Node = 0;
569} break;
570./
571
572ElisionOpt: Elision ;
573/.
574case $rule_number: {
575 sym(1).Elision = sym(1).Elision->finish ();
576 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
577} break;
578./
579
580PropertyNameAndValueList: PropertyName T_COLON AssignmentExpression ;
581/.
582case $rule_number: {
583 sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression);
584 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
585} break;
586./
587
588PropertyNameAndValueList: PropertyNameAndValueList T_COMMA PropertyName T_COLON AssignmentExpression ;
589/.
590case $rule_number: {
591 sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
592 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5));
593} break;
594./
595
596PropertyName: T_IDENTIFIER ;
597/.
598case $rule_number: {
599 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
600 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
601} break;
602./
603
604PropertyName: T_STRING_LITERAL ;
605/.
606case $rule_number: {
607 sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
608 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
609} break;
610./
611
612PropertyName: T_NUMERIC_LITERAL ;
613/.
614case $rule_number: {
615 sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
616 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
617} break;
618./
619
620PropertyName: ReservedIdentifier ;
621/.
622case $rule_number: {
623 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
624 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
625} break;
626./
627
628ReservedIdentifier: T_BREAK ;
629/.
630case $rule_number:
631./
632ReservedIdentifier: T_CASE ;
633/.
634case $rule_number:
635./
636ReservedIdentifier: T_CATCH ;
637/.
638case $rule_number:
639./
640ReservedIdentifier: T_CONTINUE ;
641/.
642case $rule_number:
643./
644ReservedIdentifier: T_DEFAULT ;
645/.
646case $rule_number:
647./
648ReservedIdentifier: T_DELETE ;
649/.
650case $rule_number:
651./
652ReservedIdentifier: T_DO ;
653/.
654case $rule_number:
655./
656ReservedIdentifier: T_ELSE ;
657/.
658case $rule_number:
659./
660ReservedIdentifier: T_FALSE ;
661/.
662case $rule_number:
663./
664ReservedIdentifier: T_FINALLY ;
665/.
666case $rule_number:
667./
668ReservedIdentifier: T_FOR ;
669/.
670case $rule_number:
671./
672ReservedIdentifier: T_FUNCTION ;
673/.
674case $rule_number:
675./
676ReservedIdentifier: T_IF ;
677/.
678case $rule_number:
679./
680ReservedIdentifier: T_IN ;
681/.
682case $rule_number:
683./
684ReservedIdentifier: T_INSTANCEOF ;
685/.
686case $rule_number:
687./
688ReservedIdentifier: T_NEW ;
689/.
690case $rule_number:
691./
692ReservedIdentifier: T_NULL ;
693/.
694case $rule_number:
695./
696ReservedIdentifier: T_RETURN ;
697/.
698case $rule_number:
699./
700ReservedIdentifier: T_SWITCH ;
701/.
702case $rule_number:
703./
704ReservedIdentifier: T_THIS ;
705/.
706case $rule_number:
707./
708ReservedIdentifier: T_THROW ;
709/.
710case $rule_number:
711./
712ReservedIdentifier: T_TRUE ;
713/.
714case $rule_number:
715./
716ReservedIdentifier: T_TRY ;
717/.
718case $rule_number:
719./
720ReservedIdentifier: T_TYPEOF ;
721/.
722case $rule_number:
723./
724ReservedIdentifier: T_VAR ;
725/.
726case $rule_number:
727./
728ReservedIdentifier: T_VOID ;
729/.
730case $rule_number:
731./
732ReservedIdentifier: T_WHILE ;
733/.
734case $rule_number:
735./
736ReservedIdentifier: T_CONST ;
737/.
738case $rule_number:
739./
740ReservedIdentifier: T_DEBUGGER ;
741/.
742case $rule_number:
743./
744ReservedIdentifier: T_RESERVED_WORD ;
745/.
746case $rule_number:
747./
748ReservedIdentifier: T_WITH ;
749/.
750case $rule_number:
751{
752 sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
753} break;
754./
755
756PropertyIdentifier: T_IDENTIFIER ;
757PropertyIdentifier: ReservedIdentifier ;
758
759MemberExpression: PrimaryExpression ;
760MemberExpression: FunctionExpression ;
761
762MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ;
763/.
764case $rule_number: {
765 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
766 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
767} break;
768./
769
770MemberExpression: MemberExpression T_DOT PropertyIdentifier ;
771/.
772case $rule_number: {
773 sym(1).Node = QScript::makeAstNode<QScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
774 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
775} break;
776./
777
778MemberExpression: T_NEW MemberExpression Arguments ;
779/.
780case $rule_number: {
781 sym(1).Node = QScript::makeAstNode<QScript::AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(3).ArgumentList);
782 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
783} break;
784./
785
786NewExpression: MemberExpression ;
787
788NewExpression: T_NEW NewExpression ;
789/.
790case $rule_number: {
791 sym(1).Node = QScript::makeAstNode<QScript::AST::NewExpression> (driver->nodePool(), sym(2).Expression);
792 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
793} break;
794./
795
796CallExpression: MemberExpression Arguments ;
797/.
798case $rule_number: {
799 sym(1).Node = QScript::makeAstNode<QScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList);
800 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
801} break;
802./
803
804CallExpression: CallExpression Arguments ;
805/.
806case $rule_number: {
807 sym(1).Node = QScript::makeAstNode<QScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList);
808 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
809} break;
810./
811
812CallExpression: CallExpression T_LBRACKET Expression T_RBRACKET ;
813/.
814case $rule_number: {
815 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
816 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
817} break;
818./
819
820CallExpression: CallExpression T_DOT PropertyIdentifier ;
821/.
822case $rule_number: {
823 sym(1).Node = QScript::makeAstNode<QScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
824 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
825} break;
826./
827
828Arguments: T_LPAREN T_RPAREN ;
829/.
830case $rule_number: {
831 sym(1).Node = 0;
832} break;
833./
834
835Arguments: T_LPAREN ArgumentList T_RPAREN ;
836/.
837case $rule_number: {
838 sym(1).Node = sym(2).ArgumentList->finish ();
839 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
840} break;
841./
842
843ArgumentList: AssignmentExpression ;
844/.
845case $rule_number: {
846 sym(1).Node = QScript::makeAstNode<QScript::AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
847 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
848} break;
849./
850
851ArgumentList: ArgumentList T_COMMA AssignmentExpression ;
852/.
853case $rule_number: {
854 sym(1).Node = QScript::makeAstNode<QScript::AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
855 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
856} break;
857./
858
859LeftHandSideExpression: NewExpression ;
860LeftHandSideExpression: CallExpression ;
861PostfixExpression: LeftHandSideExpression ;
862
863PostfixExpression: LeftHandSideExpression T_PLUS_PLUS ;
864/.
865case $rule_number: {
866 sym(1).Node = QScript::makeAstNode<QScript::AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
867 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
868} break;
869./
870
871PostfixExpression: LeftHandSideExpression T_MINUS_MINUS ;
872/.
873case $rule_number: {
874 sym(1).Node = QScript::makeAstNode<QScript::AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
875 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
876} break;
877./
878
879UnaryExpression: PostfixExpression ;
880
881UnaryExpression: T_DELETE UnaryExpression ;
882/.
883case $rule_number: {
884 sym(1).Node = QScript::makeAstNode<QScript::AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
885 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
886} break;
887./
888
889UnaryExpression: T_VOID UnaryExpression ;
890/.
891case $rule_number: {
892 sym(1).Node = QScript::makeAstNode<QScript::AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
893 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
894} break;
895./
896
897UnaryExpression: T_TYPEOF UnaryExpression ;
898/.
899case $rule_number: {
900 sym(1).Node = QScript::makeAstNode<QScript::AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
901 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
902} break;
903./
904
905UnaryExpression: T_PLUS_PLUS UnaryExpression ;
906/.
907case $rule_number: {
908 sym(1).Node = QScript::makeAstNode<QScript::AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
909 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
910} break;
911./
912
913UnaryExpression: T_MINUS_MINUS UnaryExpression ;
914/.
915case $rule_number: {
916 sym(1).Node = QScript::makeAstNode<QScript::AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
917 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
918} break;
919./
920
921UnaryExpression: T_PLUS UnaryExpression ;
922/.
923case $rule_number: {
924 sym(1).Node = QScript::makeAstNode<QScript::AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
925 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
926} break;
927./
928
929UnaryExpression: T_MINUS UnaryExpression ;
930/.
931case $rule_number: {
932 sym(1).Node = QScript::makeAstNode<QScript::AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
933 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
934} break;
935./
936
937UnaryExpression: T_TILDE UnaryExpression ;
938/.
939case $rule_number: {
940 sym(1).Node = QScript::makeAstNode<QScript::AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
941 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
942} break;
943./
944
945UnaryExpression: T_NOT UnaryExpression ;
946/.
947case $rule_number: {
948 sym(1).Node = QScript::makeAstNode<QScript::AST::NotExpression> (driver->nodePool(), sym(2).Expression);
949 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
950} break;
951./
952
953MultiplicativeExpression: UnaryExpression ;
954
955MultiplicativeExpression: MultiplicativeExpression T_STAR UnaryExpression ;
956/.
957case $rule_number: {
958 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression);
959 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
960} break;
961./
962
963MultiplicativeExpression: MultiplicativeExpression T_DIVIDE_ UnaryExpression ;
964/.
965case $rule_number: {
966 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression);
967 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
968} break;
969./
970
971MultiplicativeExpression: MultiplicativeExpression T_REMAINDER UnaryExpression ;
972/.
973case $rule_number: {
974 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression);
975 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
976} break;
977./
978
979AdditiveExpression: MultiplicativeExpression ;
980
981AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression ;
982/.
983case $rule_number: {
984 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression);
985 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
986} break;
987./
988
989AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression ;
990/.
991case $rule_number: {
992 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression);
993 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
994} break;
995./
996
997ShiftExpression: AdditiveExpression ;
998
999ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression ;
1000/.
1001case $rule_number: {
1002 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression);
1003 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1004} break;
1005./
1006
1007ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression ;
1008/.
1009case $rule_number: {
1010 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression);
1011 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1012} break;
1013./
1014
1015ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression ;
1016/.
1017case $rule_number: {
1018 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression);
1019 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1020} break;
1021./
1022
1023RelationalExpression: ShiftExpression ;
1024
1025RelationalExpression: RelationalExpression T_LT ShiftExpression ;
1026/.
1027case $rule_number: {
1028 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression);
1029 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1030} break;
1031./
1032
1033RelationalExpression: RelationalExpression T_GT ShiftExpression ;
1034/.
1035case $rule_number: {
1036 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression);
1037 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1038} break;
1039./
1040
1041RelationalExpression: RelationalExpression T_LE ShiftExpression ;
1042/.
1043case $rule_number: {
1044 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression);
1045 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1046} break;
1047./
1048
1049RelationalExpression: RelationalExpression T_GE ShiftExpression ;
1050/.
1051case $rule_number: {
1052 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression);
1053 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1054} break;
1055./
1056
1057RelationalExpression: RelationalExpression T_INSTANCEOF ShiftExpression ;
1058/.
1059case $rule_number: {
1060 sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression);
1061 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
1062} break;
1063./
1064
1065RelationalExpression: RelationalExpression T_IN ShiftExpression ;
1066/.
1067case $rule_number: {