author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 20:15:53 +0300 | |
branch | RCL_3 |
changeset 13 | c0432d11811c |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtScript module of the Qt Toolkit. |
|
8 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:LGPL-ONLY$ |
0 | 10 |
** GNU Lesser General Public License Usage |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
11 |
** This file may be used under the terms of the GNU Lesser |
0 | 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 qt-info@nokia.com. |
|
20 |
** $QT_END_LICENSE$ |
|
21 |
** |
|
22 |
****************************************************************************/ |
|
23 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
// This file was generated by qlalr - DO NOT EDIT! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
|
0 | 27 |
#include <QtCore/QtDebug> |
28 |
||
29 |
#include <string.h> |
|
30 |
||
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; \ |
|
36 |
} while (0) |
|
37 |
||
38 |
||
39 |
||
40 |
#include "qscriptparser_p.h" |
|
41 |
||
42 |
// |
|
43 |
// This file is automatically generated from qscript.g. |
|
44 |
// Changes will be lost. |
|
45 |
// |
|
46 |
||
47 |
QT_BEGIN_NAMESPACE |
|
48 |
||
49 |
inline static bool automatic(QScriptEnginePrivate *driver, int token) |
|
50 |
{ |
|
51 |
return token == QScriptGrammar::T_RBRACE |
|
52 |
|| token == 0 |
|
53 |
|| driver->lexer()->prevTerminator(); |
|
54 |
} |
|
55 |
||
56 |
||
57 |
QScriptParser::QScriptParser(): |
|
58 |
tos(0), |
|
59 |
stack_size(0), |
|
60 |
sym_stack(0), |
|
61 |
state_stack(0), |
|
62 |
location_stack(0) |
|
63 |
{ |
|
64 |
} |
|
65 |
||
66 |
QScriptParser::~QScriptParser() |
|
67 |
{ |
|
68 |
if (stack_size) { |
|
69 |
qFree(sym_stack); |
|
70 |
qFree(state_stack); |
|
71 |
qFree(location_stack); |
|
72 |
} |
|
73 |
} |
|
74 |
||
75 |
static inline QScriptParser::Location location(QScript::Lexer *lexer) |
|
76 |
{ |
|
77 |
QScriptParser::Location loc; |
|
78 |
loc.startLine = lexer->startLineNo(); |
|
79 |
loc.startColumn = lexer->startColumnNo(); |
|
80 |
loc.endLine = lexer->endLineNo(); |
|
81 |
loc.endColumn = lexer->endColumnNo(); |
|
82 |
return loc; |
|
83 |
} |
|
84 |
||
85 |
bool QScriptParser::parse(QScriptEnginePrivate *driver) |
|
86 |
{ |
|
87 |
const int INITIAL_STATE = 0; |
|
88 |
QScript::Lexer *lexer = driver->lexer(); |
|
89 |
||
90 |
int yytoken = -1; |
|
91 |
int saved_yytoken = -1; |
|
92 |
||
93 |
reallocateStack(); |
|
94 |
||
95 |
tos = 0; |
|
96 |
state_stack[++tos] = INITIAL_STATE; |
|
97 |
||
98 |
while (true) |
|
99 |
{ |
|
100 |
const int state = state_stack [tos]; |
|
101 |
if (yytoken == -1 && - TERMINAL_COUNT != action_index [state]) |
|
102 |
{ |
|
103 |
if (saved_yytoken == -1) |
|
104 |
{ |
|
105 |
yytoken = lexer->lex(); |
|
106 |
location_stack [tos] = location(lexer); |
|
107 |
} |
|
108 |
else |
|
109 |
{ |
|
110 |
yytoken = saved_yytoken; |
|
111 |
saved_yytoken = -1; |
|
112 |
} |
|
113 |
} |
|
114 |
||
115 |
int act = t_action (state, yytoken); |
|
116 |
||
117 |
if (act == ACCEPT_STATE) |
|
118 |
return true; |
|
119 |
||
120 |
else if (act > 0) |
|
121 |
{ |
|
122 |
if (++tos == stack_size) |
|
123 |
reallocateStack(); |
|
124 |
||
125 |
sym_stack [tos].dval = lexer->dval (); |
|
126 |
state_stack [tos] = act; |
|
127 |
location_stack [tos] = location(lexer); |
|
128 |
yytoken = -1; |
|
129 |
} |
|
130 |
||
131 |
else if (act < 0) |
|
132 |
{ |
|
133 |
int r = - act - 1; |
|
134 |
||
135 |
tos -= rhs [r]; |
|
136 |
act = state_stack [tos++]; |
|
137 |
||
138 |
switch (r) { |
|
139 |
||
140 |
case 0: { |
|
141 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ThisExpression> (driver->nodePool()); |
|
142 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
143 |
} break; |
|
144 |
||
145 |
case 1: { |
|
146 |
sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); |
|
147 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
148 |
} break; |
|
149 |
||
150 |
case 2: { |
|
151 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NullExpression> (driver->nodePool()); |
|
152 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
153 |
} break; |
|
154 |
||
155 |
case 3: { |
|
156 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TrueLiteral> (driver->nodePool()); |
|
157 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
158 |
} break; |
|
159 |
||
160 |
case 4: { |
|
161 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FalseLiteral> (driver->nodePool()); |
|
162 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
163 |
} break; |
|
164 |
||
165 |
case 5: { |
|
166 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteral> (driver->nodePool(), sym(1).dval); |
|
167 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
168 |
} break; |
|
169 |
||
170 |
case 6: { |
|
171 |
sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteral> (driver->nodePool(), sym(1).sval); |
|
172 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
173 |
} break; |
|
174 |
||
175 |
case 7: { |
|
176 |
bool rx = lexer->scanRegExp(QScript::Lexer::NoPrefix); |
|
177 |
if (!rx) { |
|
178 |
error_message = lexer->errorMessage(); |
|
179 |
error_lineno = lexer->startLineNo(); |
|
180 |
error_column = lexer->startColumnNo(); |
|
181 |
return false; |
|
182 |
} |
|
183 |
sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); |
|
184 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
185 |
} break; |
|
186 |
||
187 |
case 8: { |
|
188 |
bool rx = lexer->scanRegExp(QScript::Lexer::EqualPrefix); |
|
189 |
if (!rx) { |
|
190 |
error_message = lexer->errorMessage(); |
|
191 |
error_lineno = lexer->startLineNo(); |
|
192 |
error_column = lexer->startColumnNo(); |
|
193 |
return false; |
|
194 |
} |
|
195 |
sym(1).Node = QScript::makeAstNode<QScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); |
|
196 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
197 |
} break; |
|
198 |
||
199 |
case 9: { |
|
200 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision); |
|
201 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
202 |
} break; |
|
203 |
||
204 |
case 10: { |
|
205 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); |
|
206 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
207 |
} break; |
|
208 |
||
209 |
case 11: { |
|
210 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); |
|
211 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
212 |
} break; |
|
213 |
||
214 |
case 12: { |
|
215 |
if (sym(2).Node) |
|
216 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); |
|
217 |
else |
|
218 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool()); |
|
219 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
220 |
} break; |
|
221 |
||
222 |
case 13: { |
|
223 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); |
|
224 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
225 |
} break; |
|
226 |
||
227 |
case 14: { |
|
228 |
sym(1) = sym(2); |
|
229 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
230 |
} break; |
|
231 |
||
232 |
case 15: { |
|
233 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression); |
|
234 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
235 |
} break; |
|
236 |
||
237 |
case 16: { |
|
238 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); |
|
239 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
240 |
} break; |
|
241 |
||
242 |
case 17: { |
|
243 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool()); |
|
244 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
245 |
} break; |
|
246 |
||
247 |
case 18: { |
|
248 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Elision> (driver->nodePool(), sym(1).Elision); |
|
249 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
250 |
} break; |
|
251 |
||
252 |
case 19: { |
|
253 |
sym(1).Node = 0; |
|
254 |
} break; |
|
255 |
||
256 |
case 20: { |
|
257 |
sym(1).Elision = sym(1).Elision->finish (); |
|
258 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
259 |
} break; |
|
260 |
||
261 |
case 21: { |
|
262 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); |
|
263 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
264 |
} break; |
|
265 |
||
266 |
case 22: { |
|
267 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); |
|
268 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
269 |
} break; |
|
270 |
||
271 |
case 23: { |
|
272 |
sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); |
|
273 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
274 |
} break; |
|
275 |
||
276 |
case 24: { |
|
277 |
sym(1).Node = QScript::makeAstNode<QScript::AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); |
|
278 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
279 |
} break; |
|
280 |
||
281 |
case 25: { |
|
282 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); |
|
283 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
284 |
} break; |
|
285 |
||
286 |
case 26: { |
|
287 |
sym(1).Node = QScript::makeAstNode<QScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); |
|
288 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
289 |
} break; |
|
290 |
||
291 |
case 27: |
|
292 |
||
293 |
case 28: |
|
294 |
||
295 |
case 29: |
|
296 |
||
297 |
case 30: |
|
298 |
||
299 |
case 31: |
|
300 |
||
301 |
case 32: |
|
302 |
||
303 |
case 33: |
|
304 |
||
305 |
case 34: |
|
306 |
||
307 |
case 35: |
|
308 |
||
309 |
case 36: |
|
310 |
||
311 |
case 37: |
|
312 |
||
313 |
case 38: |
|
314 |
||
315 |
case 39: |
|
316 |
||
317 |
case 40: |
|
318 |
||
319 |
case 41: |
|
320 |
||
321 |
case 42: |
|
322 |
||
323 |
case 43: |
|
324 |
||
325 |
case 44: |
|
326 |
||
327 |
case 45: |
|
328 |
||
329 |
case 46: |
|
330 |
||
331 |
case 47: |
|
332 |
||
333 |
case 48: |
|
334 |
||
335 |
case 49: |
|
336 |
||
337 |
case 50: |
|
338 |
||
339 |
case 51: |
|
340 |
||
341 |
case 52: |
|
342 |
||
343 |
case 53: |
|
344 |
||
345 |
case 54: |
|
346 |
||
347 |
case 55: |
|
348 |
||
349 |
case 56: |
|
350 |
||
351 |
case 57: |
|
352 |
{ |
|
353 |
sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); |
|
354 |
} break; |
|
355 |
||
356 |
case 62: { |
|
357 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); |
|
358 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
359 |
} break; |
|
360 |
||
361 |
case 63: { |
|
362 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); |
|
363 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
364 |
} break; |
|
365 |
||
366 |
case 64: { |
|
367 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(3).ArgumentList); |
|
368 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
369 |
} break; |
|
370 |
||
371 |
case 66: { |
|
372 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NewExpression> (driver->nodePool(), sym(2).Expression); |
|
373 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
374 |
} break; |
|
375 |
||
376 |
case 67: { |
|
377 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); |
|
378 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
379 |
} break; |
|
380 |
||
381 |
case 68: { |
|
382 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); |
|
383 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
384 |
} break; |
|
385 |
||
386 |
case 69: { |
|
387 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); |
|
388 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
389 |
} break; |
|
390 |
||
391 |
case 70: { |
|
392 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); |
|
393 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
394 |
} break; |
|
395 |
||
396 |
case 71: { |
|
397 |
sym(1).Node = 0; |
|
398 |
} break; |
|
399 |
||
400 |
case 72: { |
|
401 |
sym(1).Node = sym(2).ArgumentList->finish (); |
|
402 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
403 |
} break; |
|
404 |
||
405 |
case 73: { |
|
406 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArgumentList> (driver->nodePool(), sym(1).Expression); |
|
407 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
408 |
} break; |
|
409 |
||
410 |
case 74: { |
|
411 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); |
|
412 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
413 |
} break; |
|
414 |
||
415 |
case 78: { |
|
416 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); |
|
417 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
418 |
} break; |
|
419 |
||
420 |
case 79: { |
|
421 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); |
|
422 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
423 |
} break; |
|
424 |
||
425 |
case 81: { |
|
426 |
sym(1).Node = QScript::makeAstNode<QScript::AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); |
|
427 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
428 |
} break; |
|
429 |
||
430 |
case 82: { |
|
431 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VoidExpression> (driver->nodePool(), sym(2).Expression); |
|
432 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
433 |
} break; |
|
434 |
||
435 |
case 83: { |
|
436 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); |
|
437 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
438 |
} break; |
|
439 |
||
440 |
case 84: { |
|
441 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); |
|
442 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
443 |
} break; |
|
444 |
||
445 |
case 85: { |
|
446 |
sym(1).Node = QScript::makeAstNode<QScript::AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); |
|
447 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
448 |
} break; |
|
449 |
||
450 |
case 86: { |
|
451 |
sym(1).Node = QScript::makeAstNode<QScript::AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); |
|
452 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
453 |
} break; |
|
454 |
||
455 |
case 87: { |
|
456 |
sym(1).Node = QScript::makeAstNode<QScript::AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); |
|
457 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
458 |
} break; |
|
459 |
||
460 |
case 88: { |
|
461 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TildeExpression> (driver->nodePool(), sym(2).Expression); |
|
462 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
463 |
} break; |
|
464 |
||
465 |
case 89: { |
|
466 |
sym(1).Node = QScript::makeAstNode<QScript::AST::NotExpression> (driver->nodePool(), sym(2).Expression); |
|
467 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
468 |
} break; |
|
469 |
||
470 |
case 91: { |
|
471 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); |
|
472 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
473 |
} break; |
|
474 |
||
475 |
case 92: { |
|
476 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); |
|
477 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
478 |
} break; |
|
479 |
||
480 |
case 93: { |
|
481 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); |
|
482 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
483 |
} break; |
|
484 |
||
485 |
case 95: { |
|
486 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); |
|
487 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
488 |
} break; |
|
489 |
||
490 |
case 96: { |
|
491 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); |
|
492 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
493 |
} break; |
|
494 |
||
495 |
case 98: { |
|
496 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); |
|
497 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
498 |
} break; |
|
499 |
||
500 |
case 99: { |
|
501 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); |
|
502 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
503 |
} break; |
|
504 |
||
505 |
case 100: { |
|
506 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); |
|
507 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
508 |
} break; |
|
509 |
||
510 |
case 102: { |
|
511 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); |
|
512 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
513 |
} break; |
|
514 |
||
515 |
case 103: { |
|
516 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); |
|
517 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
518 |
} break; |
|
519 |
||
520 |
case 104: { |
|
521 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); |
|
522 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
523 |
} break; |
|
524 |
||
525 |
case 105: { |
|
526 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); |
|
527 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
528 |
} break; |
|
529 |
||
530 |
case 106: { |
|
531 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); |
|
532 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
533 |
} break; |
|
534 |
||
535 |
case 107: { |
|
536 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); |
|
537 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
538 |
} break; |
|
539 |
||
540 |
case 109: { |
|
541 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); |
|
542 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
543 |
} break; |
|
544 |
||
545 |
case 110: { |
|
546 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); |
|
547 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
548 |
} break; |
|
549 |
||
550 |
case 111: { |
|
551 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); |
|
552 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
553 |
} break; |
|
554 |
||
555 |
case 112: { |
|
556 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); |
|
557 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
558 |
} break; |
|
559 |
||
560 |
case 113: { |
|
561 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); |
|
562 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
563 |
} break; |
|
564 |
||
565 |
case 115: { |
|
566 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); |
|
567 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
568 |
} break; |
|
569 |
||
570 |
case 116: { |
|
571 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); |
|
572 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
573 |
} break; |
|
574 |
||
575 |
case 117: { |
|
576 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); |
|
577 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
578 |
} break; |
|
579 |
||
580 |
case 118: { |
|
581 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); |
|
582 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
583 |
} break; |
|
584 |
||
585 |
case 120: { |
|
586 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); |
|
587 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
588 |
} break; |
|
589 |
||
590 |
case 121: { |
|
591 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); |
|
592 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
593 |
} break; |
|
594 |
||
595 |
case 122: { |
|
596 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); |
|
597 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
598 |
} break; |
|
599 |
||
600 |
case 123: { |
|
601 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); |
|
602 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
603 |
} break; |
|
604 |
||
605 |
case 125: { |
|
606 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); |
|
607 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
608 |
} break; |
|
609 |
||
610 |
case 127: { |
|
611 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); |
|
612 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
613 |
} break; |
|
614 |
||
615 |
case 129: { |
|
616 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); |
|
617 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
618 |
} break; |
|
619 |
||
620 |
case 131: { |
|
621 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); |
|
622 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
623 |
} break; |
|
624 |
||
625 |
case 133: { |
|
626 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); |
|
627 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
628 |
} break; |
|
629 |
||
630 |
case 135: { |
|
631 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); |
|
632 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
633 |
} break; |
|
634 |
||
635 |
case 137: { |
|
636 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); |
|
637 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
638 |
} break; |
|
639 |
||
640 |
case 139: { |
|
641 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); |
|
642 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
643 |
} break; |
|
644 |
||
645 |
case 141: { |
|
646 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); |
|
647 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
648 |
} break; |
|
649 |
||
650 |
case 143: { |
|
651 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); |
|
652 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
653 |
} break; |
|
654 |
||
655 |
case 145: { |
|
656 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); |
|
657 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
658 |
} break; |
|
659 |
||
660 |
case 147: { |
|
661 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); |
|
662 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
663 |
} break; |
|
664 |
||
665 |
case 149: { |
|
666 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); |
|
667 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
668 |
} break; |
|
669 |
||
670 |
case 151: { |
|
671 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); |
|
672 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
673 |
} break; |
|
674 |
||
675 |
case 152: { |
|
676 |
sym(1).ival = QSOperator::Assign; |
|
677 |
} break; |
|
678 |
||
679 |
case 153: { |
|
680 |
sym(1).ival = QSOperator::InplaceMul; |
|
681 |
} break; |
|
682 |
||
683 |
case 154: { |
|
684 |
sym(1).ival = QSOperator::InplaceDiv; |
|
685 |
} break; |
|
686 |
||
687 |
case 155: { |
|
688 |
sym(1).ival = QSOperator::InplaceMod; |
|
689 |
} break; |
|
690 |
||
691 |
case 156: { |
|
692 |
sym(1).ival = QSOperator::InplaceAdd; |
|
693 |
} break; |
|
694 |
||
695 |
case 157: { |
|
696 |
sym(1).ival = QSOperator::InplaceSub; |
|
697 |
} break; |
|
698 |
||
699 |
case 158: { |
|
700 |
sym(1).ival = QSOperator::InplaceLeftShift; |
|
701 |
} break; |
|
702 |
||
703 |
case 159: { |
|
704 |
sym(1).ival = QSOperator::InplaceRightShift; |
|
705 |
} break; |
|
706 |
||
707 |
case 160: { |
|
708 |
sym(1).ival = QSOperator::InplaceURightShift; |
|
709 |
} break; |
|
710 |
||
711 |
case 161: { |
|
712 |
sym(1).ival = QSOperator::InplaceAnd; |
|
713 |
} break; |
|
714 |
||
715 |
case 162: { |
|
716 |
sym(1).ival = QSOperator::InplaceXor; |
|
717 |
} break; |
|
718 |
||
719 |
case 163: { |
|
720 |
sym(1).ival = QSOperator::InplaceOr; |
|
721 |
} break; |
|
722 |
||
723 |
case 165: { |
|
724 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); |
|
725 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
726 |
} break; |
|
727 |
||
728 |
case 166: { |
|
729 |
sym(1).Node = 0; |
|
730 |
} break; |
|
731 |
||
732 |
case 169: { |
|
733 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); |
|
734 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
735 |
} break; |
|
736 |
||
737 |
case 170: { |
|
738 |
sym(1).Node = 0; |
|
739 |
} break; |
|
740 |
||
741 |
case 187: { |
|
742 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Block> (driver->nodePool(), sym(2).StatementList); |
|
743 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
744 |
} break; |
|
745 |
||
746 |
case 188: { |
|
747 |
sym(1).Node = QScript::makeAstNode<QScript::AST::StatementList> (driver->nodePool(), sym(1).Statement); |
|
748 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
749 |
} break; |
|
750 |
||
751 |
case 189: { |
|
752 |
sym(1).Node = QScript::makeAstNode<QScript::AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); |
|
753 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
754 |
} break; |
|
755 |
||
756 |
case 190: { |
|
757 |
sym(1).Node = 0; |
|
758 |
} break; |
|
759 |
||
760 |
case 191: { |
|
761 |
sym(1).Node = sym(1).StatementList->finish (); |
|
762 |
} break; |
|
763 |
||
764 |
case 193: { |
|
765 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); |
|
766 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
767 |
} break; |
|
768 |
||
769 |
case 194: { |
|
770 |
sym(1).ival = T_CONST; |
|
771 |
} break; |
|
772 |
||
773 |
case 195: { |
|
774 |
sym(1).ival = T_VAR; |
|
775 |
} break; |
|
776 |
||
777 |
case 196: { |
|
778 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); |
|
779 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
780 |
} break; |
|
781 |
||
782 |
case 197: { |
|
783 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); |
|
784 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
785 |
} break; |
|
786 |
||
787 |
case 198: { |
|
788 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); |
|
789 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
790 |
} break; |
|
791 |
||
792 |
case 199: { |
|
793 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); |
|
794 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
795 |
} break; |
|
796 |
||
797 |
case 200: { |
|
798 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); |
|
799 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
800 |
} break; |
|
801 |
||
802 |
case 201: { |
|
803 |
sym(1).Node = QScript::makeAstNode<QScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); |
|
804 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
805 |
} break; |
|
806 |
||
807 |
case 202: { |
|
808 |
sym(1) = sym(2); |
|
809 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
810 |
} break; |
|
811 |
||
812 |
case 203: { |
|
813 |
sym(1).Node = 0; |
|
814 |
} break; |
|
815 |
||
816 |
case 205: { |
|
817 |
sym(1) = sym(2); |
|
818 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
819 |
} break; |
|
820 |
||
821 |
case 206: { |
|
822 |
sym(1).Node = 0; |
|
823 |
} break; |
|
824 |
||
825 |
case 208: { |
|
826 |
sym(1).Node = QScript::makeAstNode<QScript::AST::EmptyStatement> (driver->nodePool()); |
|
827 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
828 |
} break; |
|
829 |
||
830 |
case 210: { |
|
831 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); |
|
832 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
833 |
} break; |
|
834 |
||
835 |
case 211: { |
|
836 |
sym(1).Node = QScript::makeAstNode<QScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); |
|
837 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); |
|
838 |
} break; |
|
839 |
||
840 |
case 212: { |
|
841 |
sym(1).Node = QScript::makeAstNode<QScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); |
|
842 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
843 |
} break; |
|
844 |
||
845 |
case 214: { |
|
846 |
sym(1).Node = QScript::makeAstNode<QScript::AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); |
|
847 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); |
|
848 |
} break; |
|
849 |
||
850 |
case 215: { |
|
851 |
sym(1).Node = QScript::makeAstNode<QScript::AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); |
|
852 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
853 |
} break; |
|
854 |
||
855 |
case 216: { |
|
856 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); |
|
857 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(9)); |
|
858 |
} break; |
|
859 |
||
860 |
case 217: { |
|
861 |
sym(1).Node = QScript::makeAstNode<QScript::AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); |
|
862 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(10)); |
|
863 |
} break; |
|
864 |
||
865 |
case 218: { |
|
866 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); |
|
867 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); |
|
868 |
} break; |
|
869 |
||
870 |
case 219: { |
|
871 |
sym(1).Node = QScript::makeAstNode<QScript::AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); |
|
872 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); |
|
873 |
} break; |
|
874 |
||
875 |
case 221: { |
|
876 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ContinueStatement> (driver->nodePool()); |
|
877 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
878 |
} break; |
|
879 |
||
880 |
case 223: { |
|
881 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ContinueStatement> (driver->nodePool(), sym(2).sval); |
|
882 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
883 |
} break; |
|
884 |
||
885 |
case 225: { |
|
886 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BreakStatement> (driver->nodePool()); |
|
887 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
888 |
} break; |
|
889 |
||
890 |
case 227: { |
|
891 |
sym(1).Node = QScript::makeAstNode<QScript::AST::BreakStatement> (driver->nodePool(), sym(2).sval); |
|
892 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
893 |
} break; |
|
894 |
||
895 |
case 229: { |
|
896 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); |
|
897 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
898 |
} break; |
|
899 |
||
900 |
case 230: { |
|
901 |
sym(1).Node = QScript::makeAstNode<QScript::AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); |
|
902 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
903 |
} break; |
|
904 |
||
905 |
case 231: { |
|
906 |
sym(1).Node = QScript::makeAstNode<QScript::AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); |
|
907 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
908 |
} break; |
|
909 |
||
910 |
case 232: { |
|
911 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); |
|
912 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
913 |
} break; |
|
914 |
||
915 |
case 233: { |
|
916 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); |
|
917 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
918 |
} break; |
|
919 |
||
920 |
case 234: { |
|
921 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); |
|
922 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
923 |
} break; |
|
924 |
||
925 |
case 235: { |
|
926 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); |
|
927 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
928 |
} break; |
|
929 |
||
930 |
case 236: { |
|
931 |
sym(1).Node = 0; |
|
932 |
} break; |
|
933 |
||
934 |
case 237: { |
|
935 |
sym(1).Node = sym(1).CaseClauses->finish (); |
|
936 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
937 |
} break; |
|
938 |
||
939 |
case 238: { |
|
940 |
sym(1).Node = QScript::makeAstNode<QScript::AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); |
|
941 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
942 |
} break; |
|
943 |
||
944 |
case 239: { |
|
945 |
sym(1).Node = QScript::makeAstNode<QScript::AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); |
|
946 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
947 |
} break; |
|
948 |
||
949 |
case 240: { |
|
950 |
sym(1).Node = QScript::makeAstNode<QScript::AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); |
|
951 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
952 |
} break; |
|
953 |
||
954 |
case 242: { |
|
955 |
sym(1).Node = QScript::makeAstNode<QScript::AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); |
|
956 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
957 |
} break; |
|
958 |
||
959 |
case 243: { |
|
960 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); |
|
961 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
962 |
} break; |
|
963 |
||
964 |
case 244: { |
|
965 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); |
|
966 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
967 |
} break; |
|
968 |
||
969 |
case 245: { |
|
970 |
sym(1).Node = QScript::makeAstNode<QScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); |
|
971 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); |
|
972 |
} break; |
|
973 |
||
974 |
case 246: { |
|
975 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Statement); |
|
976 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); |
|
977 |
} break; |
|
978 |
||
979 |
case 247: { |
|
980 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Finally> (driver->nodePool(), sym(2).Statement); |
|
981 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
982 |
} break; |
|
983 |
||
984 |
case 249: { |
|
985 |
sym(1).Node = QScript::makeAstNode<QScript::AST::DebuggerStatement> (driver->nodePool()); |
|
986 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
987 |
} break; |
|
988 |
||
989 |
case 250: { |
|
990 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); |
|
991 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); |
|
992 |
} break; |
|
993 |
||
994 |
case 251: { |
|
995 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); |
|
996 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); |
|
997 |
} break; |
|
998 |
||
999 |
case 252: { |
|
1000 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FormalParameterList> (driver->nodePool(), sym(1).sval); |
|
1001 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1002 |
} break; |
|
1003 |
||
1004 |
case 253: { |
|
1005 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); |
|
1006 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); |
|
1007 |
} break; |
|
1008 |
||
1009 |
case 254: { |
|
1010 |
sym(1).Node = 0; |
|
1011 |
} break; |
|
1012 |
||
1013 |
case 255: { |
|
1014 |
sym(1).Node = sym(1).FormalParameterList->finish (); |
|
1015 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1016 |
} break; |
|
1017 |
||
1018 |
case 256: { |
|
1019 |
sym(1).Node = 0; |
|
1020 |
} break; |
|
1021 |
||
1022 |
case 258: { |
|
1023 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); |
|
1024 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1025 |
} break; |
|
1026 |
||
1027 |
case 259: { |
|
1028 |
sym(1).Node = QScript::makeAstNode<QScript::AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); |
|
1029 |
driver->changeAbstractSyntaxTree(sym(1).Node); |
|
1030 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1031 |
} break; |
|
1032 |
||
1033 |
case 260: { |
|
1034 |
sym(1).Node = QScript::makeAstNode<QScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); |
|
1035 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1036 |
} break; |
|
1037 |
||
1038 |
case 261: { |
|
1039 |
sym(1).Node = QScript::makeAstNode<QScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); |
|
1040 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); |
|
1041 |
} break; |
|
1042 |
||
1043 |
case 262: { |
|
1044 |
sym(1).Node = QScript::makeAstNode<QScript::AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); |
|
1045 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1046 |
} break; |
|
1047 |
||
1048 |
case 263: { |
|
1049 |
sym(1).Node = QScript::makeAstNode<QScript::AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); |
|
1050 |
Q_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); |
|
1051 |
} break; |
|
1052 |
||
1053 |
case 264: { |
|
1054 |
sym(1).sval = 0; |
|
1055 |
} break; |
|
1056 |
||
1057 |
case 266: { |
|
1058 |
sym(1).Node = 0; |
|
1059 |
} break; |
|
1060 |
||
1061 |
} // switch |
|
1062 |
||
1063 |
state_stack [tos] = nt_action (act, lhs [r] - TERMINAL_COUNT); |
|
1064 |
||
1065 |
if (rhs[r] > 1) { |
|
1066 |
location_stack[tos - 1].endLine = location_stack[tos + rhs[r] - 2].endLine; |
|
1067 |
location_stack[tos - 1].endColumn = location_stack[tos + rhs[r] - 2].endColumn; |
|
1068 |
location_stack[tos] = location_stack[tos + rhs[r] - 1]; |
|
1069 |
} |
|
1070 |
} |
|
1071 |
||
1072 |
else |
|
1073 |
{ |
|
1074 |
if (saved_yytoken == -1 && automatic (driver, yytoken) && t_action (state, T_AUTOMATIC_SEMICOLON) > 0) |
|
1075 |
{ |
|
1076 |
saved_yytoken = yytoken; |
|
1077 |
yytoken = T_SEMICOLON; |
|
1078 |
continue; |
|
1079 |
} |
|
1080 |
||
1081 |
else if ((state == INITIAL_STATE) && (yytoken == 0)) { |
|
1082 |
// accept empty input |
|
1083 |
yytoken = T_SEMICOLON; |
|
1084 |
continue; |
|
1085 |
} |
|
1086 |
||
1087 |
int ers = state; |
|
1088 |
int shifts = 0; |
|
1089 |
int reduces = 0; |
|
1090 |
int expected_tokens [3]; |
|
1091 |
for (int tk = 0; tk < TERMINAL_COUNT; ++tk) |
|
1092 |
{ |
|
1093 |
int k = t_action (ers, tk); |
|
1094 |
||
1095 |
if (! k) |
|
1096 |
continue; |
|
1097 |
else if (k < 0) |
|
1098 |
++reduces; |
|
1099 |
else if (spell [tk]) |
|
1100 |
{ |
|
1101 |
if (shifts < 3) |
|
1102 |
expected_tokens [shifts] = tk; |
|
1103 |
++shifts; |
|
1104 |
} |
|
1105 |
} |
|
1106 |
||
1107 |
error_message.clear (); |
|
1108 |
if (shifts && shifts < 3) |
|
1109 |
{ |
|
1110 |
bool first = true; |
|
1111 |
||
1112 |
for (int s = 0; s < shifts; ++s) |
|
1113 |
{ |
|
1114 |
if (first) |
|
1115 |
error_message += QLatin1String ("Expected "); |
|
1116 |
else |
|
1117 |
error_message += QLatin1String (", "); |
|
1118 |
||
1119 |
first = false; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1120 |
error_message += QLatin1String("`"); |
0 | 1121 |
error_message += QLatin1String (spell [expected_tokens [s]]); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1122 |
error_message += QLatin1String("'"); |
0 | 1123 |
} |
1124 |
} |
|
1125 |
||
1126 |
if (error_message.isEmpty()) |
|
1127 |
error_message = lexer->errorMessage(); |
|
1128 |
||
1129 |
error_lineno = lexer->startLineNo(); |
|
1130 |
error_column = lexer->startColumnNo(); |
|
1131 |
||
1132 |
return false; |
|
1133 |
} |
|
1134 |
} |
|
1135 |
||
1136 |
return false; |
|
1137 |
} |
|
1138 |
||
1139 |
QT_END_NAMESPACE |