source: trunk/src/script/qscript.g@ 450

Last change on this file since 450 was 2, checked in by Dmitry A. Kuminov, 17 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 63.8 KB
Line 
1----------------------------------------------------------------------------
2--
3-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4-- Contact: Qt Software Information ([email protected])
5--
6-- This file is part of the QtScript module of the Qt Toolkit.
7--
8-- $QT_BEGIN_LICENSE:LGPL$
9-- Commercial Usage
10-- Licensees holding valid Qt Commercial licenses may use this file in
11-- accordance with the Qt Commercial License Agreement provided with the
12-- Software or, alternatively, in accordance with the terms contained in
13-- a written agreement between you and Nokia.
14--
15-- GNU Lesser General Public License Usage
16-- Alternatively, this file may be used under the terms of the GNU Lesser
17-- General Public License version 2.1 as published by the Free Software
18-- Foundation and appearing in the file LICENSE.LGPL included in the
19-- packaging of this file. Please review the following information to
20-- ensure the GNU Lesser General Public License version 2.1 requirements
21-- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22--
23-- In addition, as a special exception, Nokia gives you certain
24-- additional rights. These rights are described in the Nokia Qt LGPL
25-- Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26-- package.
27--
28-- GNU General Public License Usage
29-- Alternatively, this file may be used under the terms of the GNU
30-- General Public License version 3.0 as published by the Free Software
31-- Foundation and appearing in the file LICENSE.GPL included in the
32-- packaging of this file. Please review the following information to
33-- ensure the GNU General Public License version 3.0 requirements will be
34-- met: http://www.gnu.org/copyleft/gpl.html.
35--
36-- If you are unsure which license is appropriate for your use, please
37-- contact the sales department at [email protected].
38-- $QT_END_LICENSE$
39--
40-- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
41-- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42--
43----------------------------------------------------------------------------
44
45%parser QScriptGrammar
46%decl qscriptparser_p.h
47%impl qscriptparser.cpp
48%expect 3
49%expect-rr 1
50
51%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&="
52%token T_BREAK "break" T_CASE "case" T_CATCH "catch"
53%token T_COLON ":" T_COMMA ";" T_CONTINUE "continue"
54%token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/"
55%token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "."
56%token T_ELSE "else" T_EQ "=" T_EQ_EQ "=="
57%token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for"
58%token T_FUNCTION "function" T_GE ">=" T_GT ">"
59%token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>"
60%token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if"
61%token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{"
62%token T_LBRACKET "[" T_LE "<=" T_LPAREN "("
63%token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<="
64%token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--"
65%token T_NEW "new" T_NOT "!" T_NOT_EQ "!="
66%token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|"
67%token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+"
68%token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?"
69%token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%"
70%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")"
71%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*"
72%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal"
73%token T_SWITCH "switch" T_THIS "this" T_THROW "throw"
74%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof"
75%token T_VAR "var" T_VOID "void" T_WHILE "while"
76%token T_WITH "with" T_XOR "^" T_XOR_EQ "^="
77%token T_NULL "null" T_TRUE "true" T_FALSE "false"
78%token T_CONST "const"
79%token T_DEBUGGER "debugger"
80%token T_RESERVED_WORD "reserved word"
81
82%start Program
83
84/.
85/****************************************************************************
86**
87** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
88** Contact: Qt Software Information ([email protected])
89**
90** This file is part of the QtScript module of the Qt Toolkit.
91**
92** $QT_BEGIN_LICENSE:LGPL$
93** Commercial Usage
94** Licensees holding valid Qt Commercial licenses may use this file in
95** accordance with the Qt Commercial License Agreement provided with the
96** Software or, alternatively, in accordance with the terms contained in
97** a written agreement between you and Nokia.
98**
99** GNU Lesser General Public License Usage
100** Alternatively, this file may be used under the terms of the GNU Lesser
101** General Public License version 2.1 as published by the Free Software
102** Foundation and appearing in the file LICENSE.LGPL included in the
103** packaging of this file. Please review the following information to
104** ensure the GNU Lesser General Public License version 2.1 requirements
105** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
106**
107** In addition, as a special exception, Nokia gives you certain
108** additional rights. These rights are described in the Nokia Qt LGPL
109** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
110** package.
111**
112** GNU General Public License Usage
113** Alternatively, this file may be used under the terms of the GNU
114** General Public License version 3.0 as published by the Free Software
115** Foundation and appearing in the file LICENSE.GPL included in the
116** packaging of this file. Please review the following information to
117** ensure the GNU General Public License version 3.0 requirements will be
118** met: http://www.gnu.org/copyleft/gpl.html.
119**
120** If you are unsure which license is appropriate for your use, please
121** contact the sales department at [email protected].
122** $QT_END_LICENSE$
123**
124****************************************************************************/
125
126#include <QtCore/QtDebug>
127
128#ifndef QT_NO_SCRIPT
129
130#include <string.h>
131
132#include "qscriptengine.h"
133#include "qscriptengine_p.h"
134#include "qscriptvalueimpl_p.h"
135#include "qscriptcontext_p.h"
136#include "qscriptmember_p.h"
137#include "qscriptobject_p.h"
138#include "qscriptlexer_p.h"
139#include "qscriptast_p.h"
140#include "qscriptnodepool_p.h"
141
142#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
143 node->startLine = startloc.startLine; \
144 node->startColumn = startloc.startColumn; \
145 node->endLine = endloc.endLine; \
146 node->endColumn = endloc.endColumn; \
147} while (0)
148
149./
150
151/:
152/****************************************************************************
153**
154** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
155** Contact: Qt Software Information ([email protected])
156**
157** This file is part of the QtScript module of the Qt Toolkit.
158**
159** $QT_BEGIN_LICENSE:LGPL$
160** Commercial Usage
161** Licensees holding valid Qt Commercial licenses may use this file in
162** accordance with the Qt Commercial License Agreement provided with the
163** Software or, alternatively, in accordance with the terms contained in
164** a written agreement between you and Nokia.
165**
166** GNU Lesser General Public License Usage
167** Alternatively, this file may be used under the terms of the GNU Lesser
168** General Public License version 2.1 as published by the Free Software
169** Foundation and appearing in the file LICENSE.LGPL included in the
170** packaging of this file. Please review the following information to
171** ensure the GNU Lesser General Public License version 2.1 requirements
172** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
173**
174** In addition, as a special exception, Nokia gives you certain
175** additional rights. These rights are described in the Nokia Qt LGPL
176** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
177** package.
178**
179** GNU General Public License Usage
180** Alternatively, this file may be used under the terms of the GNU
181** General Public License version 3.0 as published by the Free Software
182** Foundation and appearing in the file LICENSE.GPL included in the
183** packaging of this file. Please review the following information to
184** ensure the GNU General Public License version 3.0 requirements will be
185** met: http://www.gnu.org/copyleft/gpl.html.
186**
187** If you are unsure which license is appropriate for your use, please
188** contact the sales department at [email protected].
189** $QT_END_LICENSE$
190**
191****************************************************************************/
192
193//
194// W A R N I N G
195// -------------
196//
197// This file is not part of the Qt API. It exists purely as an
198// implementation detail. This header file may change from version to
199// version without notice, or even be removed.
200//
201// We mean it.
202//
203
204//
205// This file is automatically generated from qscript.g.
206// Changes will be lost.
207//
208
209#ifndef QSCRIPTPARSER_P_H
210#define QSCRIPTPARSER_P_H
211
212#include "qscriptgrammar_p.h"
213
214#ifndef QT_NO_SCRIPT
215
216#include "qscriptastfwd_p.h"
217
218QT_BEGIN_NAMESPACE
219
220class QString;
221class QScriptEnginePrivate;
222class QScriptNameIdImpl;
223
224class QScriptParser: protected $table
225{
226public:
227 union Value {
228 int ival;
229 double dval;
230 QScriptNameIdImpl *sval;
231 QScript::AST::ArgumentList *ArgumentList;
232 QScript::AST::CaseBlock *CaseBlock;
233 QScript::AST::CaseClause *CaseClause;
234 QScript::AST::CaseClauses *CaseClauses;
235 QScript::AST::Catch *Catch;
236 QScript::AST::DefaultClause *DefaultClause;
237 QScript::AST::ElementList *ElementList;
238 QScript::AST::Elision *Elision;
239 QScript::AST::ExpressionNode *Expression;
240 QScript::AST::Finally *Finally;
241 QScript::AST::FormalParameterList *FormalParameterList;
242 QScript::AST::FunctionBody *FunctionBody;
243 QScript::AST::FunctionDeclaration *FunctionDeclaration;
244 QScript::AST::Node *Node;
245 QScript::AST::PropertyName *PropertyName;
246 QScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
247 QScript::AST::SourceElement *SourceElement;
248 QScript::AST::SourceElements *SourceElements;
249 QScript::AST::Statement *Statement;
250 QScript::AST::StatementList *StatementList;
251 QScript::AST::VariableDeclaration *VariableDeclaration;
252 QScript::AST::VariableDeclarationList *VariableDeclarationList;
253 };
254
255 struct Location {
256 int startLine;
257 int startColumn;
258 int endLine;
259 int endColumn;
260 };
261
262public:
263 QScriptParser();
264 ~QScriptParser();
265
266 bool parse(QScriptEnginePrivate *driver);
267
268 inline QString errorMessage() const
269 { return error_message; }
270 inline int errorLineNumber() const
271 { return error_lineno; }
272 inline int errorColumnNumber() const
273 { return error_column; }
274
275protected:
276 inline void reallocateStack();
277
278 inline Value &sym(int index)
279 { return sym_stack [tos + index - 1]; }
280
281 inline Location &loc(int index)
282 { return location_stack [tos + index - 2]; }
283
284protected:
285 int tos;
286 int stack_size;
287 Value *sym_stack;
288 int *state_stack;
289 Location *location_stack;
290 QString error_message;
291 int error_lineno;
292 int error_column;
293};
294
295inline void QScriptParser::reallocateStack()
296{
297 if (! stack_size)
298 stack_size = 128;
299 else
300 stack_size <<= 1;
301
302 sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
303 state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
304 location_stack = reinterpret_cast<Location*> (qRealloc(location_stack, stack_size * sizeof(Location)));
305}
306
307:/
308
309
310/.
311
312#include "qscriptparser_p.h"
313
314//
315// This file is automatically generated from qscript.g.
316// Changes will be lost.
317//
318
319QT_BEGIN_NAMESPACE
320
321inline static bool automatic(QScriptEnginePrivate *driver, int token)
322{
323 return token == $table::T_RBRACE
324 || token == 0
325 || driver->lexer()->prevTerminator();
326}
327
328
329QScriptParser::QScriptParser():
330 tos(0),
331 stack_size(0),
332 sym_stack(0),
333 state_stack(0),
334 location_stack(0),
335 error_lineno(0),
336 error_column(0)
337{
338}
339
340QScriptParser::~QScriptParser()
341{
342 if (stack_size) {
343 qFree(sym_stack);
344 qFree(state_stack);
345 qFree(location_stack);
346 }
347}
348
349static inline QScriptParser::Location location(QScript::Lexer *lexer)
350{
351 QScriptParser::Location loc;
352 loc.startLine = lexer->startLineNo();
353 loc.startColumn = lexer->startColumnNo();
354 loc.endLine = lexer->endLineNo();
355 loc.endColumn = lexer->endColumnNo();
356 return loc;
357}
358
359bool QScriptParser::parse(QScriptEnginePrivate *driver)
360{
361 const int INITIAL_STATE = 0;
362 QScript::Lexer *lexer = driver->lexer();
363
364 int yytoken = -1;
365 int saved_yytoken = -1;
366
367 reallocateStack();
368
369 tos = 0;
370 state_stack[++tos] = INITIAL_STATE;
371
372 while (true)
373 {
374 const int state = state_stack [tos];
375 if (yytoken == -1 && - TERMINAL_COUNT != action_index [state])
376 {
377 if (saved_yytoken == -1)
378 {
379 yytoken = lexer->lex();
380 location_stack [tos] = location(lexer);
381 }
382 else
383 {
384 yytoken = saved_yytoken;
385 saved_yytoken = -1;
386 }
387 }
388
389 int act = t_action (state, yytoken);
390
391 if (act == ACCEPT_STATE)
392 return true;
393
394 else if (act > 0)
395 {
396 if (++tos == stack_size)
397 reallocateStack();
398
399 sym_stack [tos].dval = lexer->dval ();
400 state_stack [tos] = act;
401 location_stack [tos] = location(lexer);
402 yytoken = -1;
403 }
404
405 else if (act < 0)
406 {
407 int r = - act - 1;
408
409 tos -= rhs [r];
410 act = state_stack [tos++];
411
412 switch (r) {
413./
414
415PrimaryExpression: T_THIS ;
416/.
417case $rule_number: {
418 sym(1).Node = QScript::makeAstNode<QScript::AST::ThisExpression> (driver->nodePool());
419 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
420} break;
421./
422
423PrimaryExpression: T_IDENTIFIER ;
424/.
425case $rule_number: {
426 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
427 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
428} break;
429./
430
431PrimaryExpression: T_NULL ;
432/.
433case $rule_number: {
434 sym(1).Node = QScript::makeAstNode<QScript::AST::NullExpression> (driver->nodePool());
435 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
436} break;
437./
438
439PrimaryExpression: T_TRUE ;
440/.
441case $rule_number: {
442 sym(1).Node = QScript::makeAstNode<QScript::AST::TrueLiteral> (driver->nodePool());
443 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
444} break;
445./
446
447PrimaryExpression: T_FALSE ;
448/.
449case $rule_number: {
450 sym(1).Node = QScript::makeAstNode<QScript::AST::FalseLiteral> (driver->nodePool());
451 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
452} break;
453./
454
455PrimaryExpression: T_NUMERIC_LITERAL ;
456/.
457case $rule_number: {
458 sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
459 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
460} break;
461./
462
463PrimaryExpression: T_STRING_LITERAL ;
464/.
465case $rule_number: {
466 sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteral> (driver->nodePool(), sym(1).sval);
467 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
468} break;
469./
470
471PrimaryExpression: T_DIVIDE_ ;
472/:
473#define Q_SCRIPT_REGEXPLITERAL_RULE1 $rule_number
474:/
475/.
476case $rule_number: {
477 bool rx = lexer->scanRegExp(QScript::Lexer::NoPrefix);
478 if (!rx) {
479 error_message = lexer->errorMessage();
480 error_lineno = lexer->startLineNo();
481 error_column = lexer->startColumnNo();
482 return false;
483 }
484 sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
485 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
486} break;
487./
488
489PrimaryExpression: T_DIVIDE_EQ ;
490/:
491#define Q_SCRIPT_REGEXPLITERAL_RULE2 $rule_number
492:/
493/.
494case $rule_number: {
495 bool rx = lexer->scanRegExp(QScript::Lexer::EqualPrefix);
496 if (!rx) {
497 error_message = lexer->errorMessage();
498 error_lineno = lexer->startLineNo();
499 error_column = lexer->startColumnNo();
500 return false;
501 }
502 sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
503 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
504} break;
505./
506
507PrimaryExpression: T_LBRACKET ElisionOpt T_RBRACKET ;
508/.
509case $rule_number: {
510 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision);
511 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
512} break;
513./
514
515PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ;
516/.
517case $rule_number: {
518 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
519 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
520} break;
521./
522
523PrimaryExpression: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET ;
524/.
525case $rule_number: {
526 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision);
527 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5));
528} break;
529./
530
531-- PrimaryExpression: T_LBRACE T_RBRACE ;
532-- /.
533-- case $rule_number: {
534-- sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool());
535-- Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
536-- } break;
537-- ./
538
539PrimaryExpression: T_LBRACE PropertyNameAndValueListOpt T_RBRACE ;
540/.
541case $rule_number: {
542 if (sym(2).Node)
543 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ());
544 else
545 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool());
546 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
547} break;
548./
549
550PrimaryExpression: T_LBRACE PropertyNameAndValueList T_COMMA T_RBRACE ;
551/.
552case $rule_number: {
553 sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ());
554 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
555} break;
556./
557
558PrimaryExpression: T_LPAREN Expression T_RPAREN ;
559/.
560case $rule_number: {
561 sym(1) = sym(2);
562 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
563} break;
564./
565
566ElementList: ElisionOpt AssignmentExpression ;
567/.
568case $rule_number: {
569 sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression);
570 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
571} break;
572./
573
574ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression ;
575/.
576case $rule_number: {
577 sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression);
578 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
579} break;
580./
581
582Elision: T_COMMA ;
583/.
584case $rule_number: {
585 sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool());
586 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
587} break;
588./
589
590Elision: Elision T_COMMA ;
591/.
592case $rule_number: {
593 sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool(), sym(1).Elision);
594 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2));
595} break;
596./
597
598ElisionOpt: ;
599/.
600case $rule_number: {
601 sym(1).Node = 0;
602} break;
603./
604
605ElisionOpt: Elision ;
606/.
607case $rule_number: {
608 sym(1).Elision = sym(1).Elision->finish ();
609 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
610} break;
611./
612
613PropertyNameAndValueList: PropertyName T_COLON AssignmentExpression ;
614/.
615case $rule_number: {
616 sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression);
617 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3));
618} break;
619./
620
621PropertyNameAndValueList: PropertyNameAndValueList T_COMMA PropertyName T_COLON AssignmentExpression ;
622/.
623case $rule_number: {
624 sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
625 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5));
626} break;
627./
628
629PropertyName: T_IDENTIFIER ;
630/.
631case $rule_number: {
632 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
633 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
634} break;
635./
636
637PropertyName: T_STRING_LITERAL ;
638/.
639case $rule_number: {
640 sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
641 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
642} break;
643./
644
645PropertyName: T_NUMERIC_LITERAL ;
646/.
647case $rule_number: {
648 sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
649 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
650} break;
651./
652
653PropertyName: ReservedIdentifier ;
654/.
655case $rule_number: {
656 sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
657 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1));
658} break;
659./
660
661ReservedIdentifier: T_BREAK ;
662/.
663case $rule_number:
664./
665ReservedIdentifier: T_CASE ;
666/.
667case $rule_number:
668./
669ReservedIdentifier: T_CATCH ;
670/.
671case $rule_number:
672./
673ReservedIdentifier: T_CONTINUE ;
674/.
675case $rule_number:
676./
677ReservedIdentifier: T_DEFAULT ;
678/.
679case $rule_number:
680./
681ReservedIdentifier: T_DELETE ;
682/.
683case $rule_number:
684./
685ReservedIdentifier: T_DO ;
686/.
687case $rule_number:
688./
689ReservedIdentifier: T_ELSE ;
690/.
691case $rule_number:
692./
693ReservedIdentifier: T_FALSE ;
694/.
695case $rule_number:
696./
697ReservedIdentifier: T_FINALLY ;
698/.
699case $rule_number:
700./
701ReservedIdentifier: T_FOR ;
702/.
703case $rule_number:
704./
705ReservedIdentifier: T_FUNCTION ;
706/.
707case $rule_number:
708./
709ReservedIdentifier: T_IF ;
710/.
711case $rule_number:
712./
713ReservedIdentifier: T_IN ;
714/.
715case $rule_number:
716./
717ReservedIdentifier: T_INSTANCEOF ;
718/.
719case $rule_number:
720./
721ReservedIdentifier: T_NEW ;
722/.
723case $rule_number:
724./
725ReservedIdentifier: T_NULL ;
726/.
727case $rule_number:
728./
729ReservedIdentifier: T_RETURN ;
730/.
731case $rule_number:
732./
733ReservedIdentifier: T_SWITCH ;
734/.
735case $rule_number:
736./
737ReservedIdentifier: T_THIS ;
738/.
739case $rule_number:
740./
741ReservedIdentifier: T_THROW ;
742/.
743case $rule_number:
744./
745ReservedIdentifier: T_TRUE ;
746/.
747case $rule_number:
748./
749ReservedIdentifier: T_TRY ;
750/.
751case $rule_number:
752./
753ReservedIdentifier: T_TYPEOF ;
754/.
755case $rule_number:
756./
757ReservedIdentifier: T_VAR ;
758/.
759case $rule_number:
760./
761ReservedIdentifier: T_VOID ;
762/.
763case $rule_number:
764./
765ReservedIdentifier: T_WHILE ;
766/.
767case $rule_number:
768./
769ReservedIdentifier: T_CONST ;
770/.
771case $rule_number:
772./
773ReservedIdentifier: T_DEBUGGER ;
774/.
775case $rule_number:
776./
777ReservedIdentifier: T_RESERVED_WORD ;
778/.
779case $rule_number:
780./
781ReservedIdentifier: T_WITH ;
782/.
783case $rule_number:
784{
785 sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
786} break;
787./
788
789PropertyIdentifier: T_IDENTIFIER ;
790PropertyIdentifier: ReservedIdentifier ;
791
792MemberExpression: PrimaryExpression ;
793MemberExpression: FunctionExpression ;
794
795MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ;
796/.
797case $rule_number: {
798 sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
799 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
800} break;
801./
802
803MemberExpression: MemberExpression T_DOT PropertyIdentifier ;
804/.
805case $rule_number: {
806 sym(1).Node = QScript::makeAstNode<QScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
807 Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4));
808} break;