Qt 4.8
Classes | Public Functions | Protected Types | Protected Functions | Protected Variables | List of all members
QDeclarativeJS::Parser Class Reference

#include <qdeclarativejsparser_p.h>

Inheritance diagram for QDeclarativeJS::Parser:
QDeclarativeJSGrammar

Classes

struct  SavedToken
 
union  Value
 

Public Functions

AST::UiProgramast () const
 
DiagnosticMessage diagnosticMessage () const
 
QList< DiagnosticMessagediagnosticMessages () const
 
int errorColumnNumber () const
 
int errorLineNumber () const
 
QString errorMessage () const
 
AST::ExpressionNodeexpression () const
 
bool parse ()
 
bool parseExpression ()
 
bool parseProgram ()
 
 Parser (Engine *engine)
 
bool parseSourceElement ()
 
bool parseStatement ()
 
bool parseUiObjectMember ()
 
AST::NoderootNode () const
 
AST::Statementstatement () const
 
AST::UiObjectMemberuiObjectMember () const
 
 ~Parser ()
 

Protected Types

enum  { TOKEN_BUFFER_SIZE = 3 }
 
- Protected Types inherited from QDeclarativeJSGrammar
enum  VariousConstants {
  EOF_SYMBOL = 0, REDUCE_HERE = 100, SHIFT_THERE = 99, T_AND = 1,
  T_AND_AND = 2, T_AND_EQ = 3, T_AS = 91, T_AUTOMATIC_SEMICOLON = 62,
  T_BREAK = 4, T_CASE = 5, T_CATCH = 6, T_COLON = 7,
  T_COMMA = 8, T_COMMENT = 88, T_CONST = 84, T_CONTINUE = 9,
  T_DEBUGGER = 85, T_DEFAULT = 10, T_DELETE = 11, T_DIVIDE_ = 12,
  T_DIVIDE_EQ = 13, T_DO = 14, T_DOT = 15, T_ELSE = 16,
  T_EQ = 17, T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, T_FALSE = 83,
  T_FEED_JS_EXPRESSION = 96, T_FEED_JS_PROGRAM = 98, T_FEED_JS_SOURCE_ELEMENT = 97, T_FEED_JS_STATEMENT = 95,
  T_FEED_UI_OBJECT_MEMBER = 94, T_FEED_UI_PROGRAM = 93, T_FINALLY = 20, T_FOR = 21,
  T_FUNCTION = 22, T_GE = 23, T_GT = 24, T_GT_GT = 25,
  T_GT_GT_EQ = 26, T_GT_GT_GT = 27, T_GT_GT_GT_EQ = 28, T_IDENTIFIER = 29,
  T_IF = 30, T_IMPORT = 90, T_IN = 31, T_INSTANCEOF = 32,
  T_LBRACE = 33, T_LBRACKET = 34, T_LE = 35, T_LPAREN = 36,
  T_LT = 37, T_LT_LT = 38, T_LT_LT_EQ = 39, T_MINUS = 40,
  T_MINUS_EQ = 41, T_MINUS_MINUS = 42, T_MULTILINE_STRING_LITERAL = 87, T_NEW = 43,
  T_NOT = 44, T_NOT_EQ = 45, T_NOT_EQ_EQ = 46, T_NULL = 81,
  T_NUMERIC_LITERAL = 47, T_ON = 92, T_OR = 48, T_OR_EQ = 49,
  T_OR_OR = 50, T_PLUS = 51, T_PLUS_EQ = 52, T_PLUS_PLUS = 53,
  T_PROPERTY = 66, T_PUBLIC = 89, T_QUESTION = 54, T_RBRACE = 55,
  T_RBRACKET = 56, T_READONLY = 68, T_REMAINDER = 57, T_REMAINDER_EQ = 58,
  T_RESERVED_WORD = 86, T_RETURN = 59, T_RPAREN = 60, T_SEMICOLON = 61,
  T_SIGNAL = 67, T_STAR = 63, T_STAR_EQ = 64, T_STRING_LITERAL = 65,
  T_SWITCH = 69, T_THIS = 70, T_THROW = 71, T_TILDE = 72,
  T_TRUE = 82, T_TRY = 73, T_TYPEOF = 74, T_VAR = 75,
  T_VOID = 76, T_WHILE = 77, T_WITH = 78, T_XOR = 79,
  T_XOR_EQ = 80, ACCEPT_STATE = 645, RULE_COUNT = 347, STATE_COUNT = 646,
  TERMINAL_COUNT = 101, NON_TERMINAL_COUNT = 106, GOTO_INDEX_OFFSET = 646, GOTO_INFO_OFFSET = 2714,
  GOTO_CHECK_OFFSET = 2714
}
 

Protected Functions

AST::SourceLocationloc (int index)
 
bool parse (int startToken)
 
void reallocateStack ()
 
AST::UiQualifiedIdreparseAsQualifiedId (AST::ExpressionNode *expr)
 
Valuesym (int index)
 

Protected Variables

QList< DiagnosticMessagediagnostic_messages
 
Enginedriver
 
SavedTokenfirst_token
 
SavedTokenlast_token
 
AST::SourceLocationlocation_stack
 
AST::Nodeprogram
 
int stack_size
 
int * state_stack
 
Valuesym_stack
 
SavedToken token_buffer [TOKEN_BUFFER_SIZE]
 
int tos
 
AST::SourceLocation yylloc
 
double yylval
 
AST::SourceLocation yyprevlloc
 

Additional Inherited Members

- Static Protected Functions inherited from QDeclarativeJSGrammar
static int nt_action (int state, int nt)
 
static int t_action (int state, int token)
 
- Static Protected Variables inherited from QDeclarativeJSGrammar
static const short action_check []
 
static const short action_default []
 
static const short action_index []
 
static const short action_info []
 
static const short goto_default []
 
static const short lhs []
 
static const short rhs []
 
static const char *const spell []
 

Detailed Description

Definition at line 77 of file qdeclarativejsparser_p.h.

Enumerations

◆ anonymous enum

anonymous enum
protected
Enumerator
TOKEN_BUFFER_SIZE 

Definition at line 215 of file qdeclarativejsparser_p.h.

Constructors and Destructors

◆ Parser()

Parser::Parser ( Engine engine)

◆ ~Parser()

Parser::~Parser ( )

Definition at line 98 of file qdeclarativejsparser.cpp.

99 {
100  if (stack_size) {
101  qFree(sym_stack);
104  }
105 }
Q_CORE_EXPORT void qFree(void *ptr)
Definition: qmalloc.cpp:58
AST::SourceLocation * location_stack

Functions

◆ ast()

AST::UiProgram* QDeclarativeJS::Parser::ast ( ) const
inline

Definition at line 139 of file qdeclarativejsparser_p.h.

Referenced by QDeclarativeScriptParser::parse().

140  { return AST::cast<AST::UiProgram *>(program); }

◆ diagnosticMessage()

DiagnosticMessage QDeclarativeJS::Parser::diagnosticMessage ( ) const
inline

Definition at line 172 of file qdeclarativejsparser_p.h.

173  {
174  foreach (const DiagnosticMessage &d, diagnostic_messages) {
175  if (! d.kind == DiagnosticMessage::Warning)
176  return d;
177  }
178 
179  return DiagnosticMessage();
180  }
double d
Definition: qnumeric_p.h:62
QList< DiagnosticMessage > diagnostic_messages

◆ diagnosticMessages()

QList<DiagnosticMessage> QDeclarativeJS::Parser::diagnosticMessages ( ) const
inline

Definition at line 169 of file qdeclarativejsparser_p.h.

Referenced by QDeclarativeScriptParser::parse().

170  { return diagnostic_messages; }
QList< DiagnosticMessage > diagnostic_messages

◆ errorColumnNumber()

int QDeclarativeJS::Parser::errorColumnNumber ( ) const
inline

◆ errorLineNumber()

int QDeclarativeJS::Parser::errorLineNumber ( ) const
inline

◆ errorMessage()

QString QDeclarativeJS::Parser::errorMessage ( ) const
inline

Definition at line 182 of file qdeclarativejsparser_p.h.

◆ expression()

AST::ExpressionNode* QDeclarativeJS::Parser::expression ( ) const
inline

Definition at line 150 of file qdeclarativejsparser_p.h.

151  {
152  if (! program)
153  return 0;
154 
155  return program->expressionCast();
156  }
virtual ExpressionNode * expressionCast()

◆ loc()

AST::SourceLocation& QDeclarativeJS::Parser::loc ( int  index)
inlineprotected

Definition at line 199 of file qdeclarativejsparser_p.h.

Referenced by location(), and parse().

200  { return location_stack [tos + index - 1]; }
AST::SourceLocation * location_stack
quint16 index

◆ parse() [1/2]

bool QDeclarativeJS::Parser::parse ( )
inline

◆ parse() [2/2]

bool Parser::parse ( int  startToken)
protected

Definition at line 145 of file qdeclarativejsparser.cpp.

146 {
147  Lexer *lexer = driver->lexer();
148  bool hadErrors = false;
149  int yytoken = -1;
150  int action = 0;
151 
152  token_buffer[0].token = startToken;
154  last_token = &token_buffer[1];
155 
156  tos = -1;
157  program = 0;
158 
159  do {
160  if (++tos == stack_size)
161  reallocateStack();
162 
163  state_stack[tos] = action;
164 
165  _Lcheck_token:
166  if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
167  yyprevlloc = yylloc;
168 
169  if (first_token == last_token) {
170  yytoken = lexer->lex();
171  yylval = lexer->dval();
172  yylloc = location(lexer);
173  } else {
174  yytoken = first_token->token;
177  ++first_token;
178  }
179  }
180 
181  action = t_action(action, yytoken);
182  if (action > 0) {
183  if (action != ACCEPT_STATE) {
184  yytoken = -1;
185  sym(1).dval = yylval;
186  loc(1) = yylloc;
187  } else {
188  --tos;
189  return ! hadErrors;
190  }
191  } else if (action < 0) {
192  const int r = -action - 1;
193  tos -= rhs[r];
194 
195  switch (r) {
196 
197 case 0: {
198  sym(1).Node = sym(2).Node;
199  program = sym(1).Node;
200 } break;
201 
202 case 1: {
203  sym(1).Node = sym(2).Node;
204  program = sym(1).Node;
205 } break;
206 
207 case 2: {
208  sym(1).Node = sym(2).Node;
209  program = sym(1).Node;
210 } break;
211 
212 case 3: {
213  sym(1).Node = sym(2).Node;
214  program = sym(1).Node;
215 } break;
216 
217 case 4: {
218  sym(1).Node = sym(2).Node;
219  program = sym(1).Node;
220 } break;
221 
222 case 5: {
223  sym(1).Node = sym(2).Node;
224  program = sym(1).Node;
225 } break;
226 
227 case 6: {
228  sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList,
230 } break;
231 
232 case 8: {
233  sym(1).Node = sym(1).UiImportList->finish();
234 } break;
235 
236 case 9: {
237  sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport);
238 } break;
239 
240 case 10: {
241  sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(),
242  sym(1).UiImportList, sym(2).UiImport);
243 } break;
244 
245 case 13: {
246  sym(1).UiImport->semicolonToken = loc(2);
247 } break;
248 
249 case 15: {
250  sym(1).UiImport->versionToken = loc(2);
251  sym(1).UiImport->semicolonToken = loc(3);
252 } break;
253 
254 case 17: {
255  sym(1).UiImport->versionToken = loc(2);
256  sym(1).UiImport->asToken = loc(3);
257  sym(1).UiImport->importIdToken = loc(4);
258  sym(1).UiImport->importId = sym(4).sval;
259  sym(1).UiImport->semicolonToken = loc(5);
260 } break;
261 
262 case 19: {
263  sym(1).UiImport->asToken = loc(2);
264  sym(1).UiImport->importIdToken = loc(3);
265  sym(1).UiImport->importId = sym(3).sval;
266  sym(1).UiImport->semicolonToken = loc(4);
267 } break;
268 
269 case 20: {
270  AST::UiImport *node = 0;
271 
272  if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) {
273  node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
274  node->fileNameToken = loc(2);
275  } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
276  node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
277  node->fileNameToken = loc(2);
278  }
279 
280  sym(1).Node = node;
281 
282  if (node) {
283  node->importToken = loc(1);
284  } else {
286  QLatin1String("Expected a qualified name id or a string literal")));
287 
288  return false; // ### remove me
289  }
290 } break;
291 
292 case 21: {
293  sym(1).Node = 0;
294 } break;
295 
296 case 22: {
297  sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
298 } break;
299 
300 case 23: {
301  sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
302 } break;
303 
304 case 24: {
305  AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
307  sym(1).Node = node;
308 } break;
309 
310 case 25: {
311  sym(1).Node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiObjectMember);
312 } break;
313 
314 case 26: {
315  AST::UiArrayMemberList *node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(),
317  node->commaToken = loc(2);
318  sym(1).Node = node;
319 } break;
320 
321 case 27: {
322  AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0);
323  node->lbraceToken = loc(1);
324  node->rbraceToken = loc(2);
325  sym(1).Node = node;
326 } break;
327 
328 case 28: {
329  AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish());
330  node->lbraceToken = loc(1);
331  node->rbraceToken = loc(3);
332  sym(1).Node = node;
333 } break;
334 
335 case 29: {
336  AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).UiQualifiedId,
338  sym(1).Node = node;
339 } break;
340 
341 case 31: {
342  AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(),
344  node->colonToken = loc(2);
345  node->lbracketToken = loc(3);
346  node->rbracketToken = loc(5);
347  sym(1).Node = node;
348 } break;
349 
350 case 32: {
351  AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
353  node->colonToken = loc(2);
354  sym(1).Node = node;
355 } break;
356 
357 case 33: {
358  AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
360  node->colonToken = loc(2);
361  node->hasOnToken = true;
362  sym(1).Node = node;
363 } break;
364 case 34:case 35:case 36:case 37:
365 {
366  AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(),
367  sym(1).UiQualifiedId, sym(3).Statement);
368  node->colonToken = loc(2);
369  sym(1).Node = node;
370 } break;
371 
372 case 38:
373 
374 case 39: {
375  sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
376  break;
377 }
378 
379 case 41: {
380  sym(1).Node = 0;
381 } break;
382 
383 case 42: {
384  sym(1).Node = sym(1).UiParameterList->finish ();
385 } break;
386 
387 case 43: {
388  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval);
389  node->identifierToken = loc(2);
390  sym(1).Node = node;
391 } break;
392 
393 case 44: {
394  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval);
395  node->commaToken = loc(2);
396  node->identifierToken = loc(4);
397  sym(1).Node = node;
398 } break;
399 
400 case 46: {
401  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
403  node->propertyToken = loc(1);
404  node->typeToken = loc(2);
405  node->identifierToken = loc(2);
406  node->parameters = sym(4).UiParameterList;
407  node->semicolonToken = loc(6);
408  sym(1).Node = node;
409 } break;
410 
411 case 48: {
412  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
414  node->propertyToken = loc(1);
415  node->typeToken = loc(2);
416  node->identifierToken = loc(2);
417  node->semicolonToken = loc(3);
418  sym(1).Node = node;
419 } break;
420 
421 case 50: {
422  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
423  node->typeModifier = sym(2).sval;
424  node->propertyToken = loc(1);
425  node->typeModifierToken = loc(2);
426  node->typeToken = loc(4);
427  node->identifierToken = loc(6);
428  node->semicolonToken = loc(7);
429  sym(1).Node = node;
430 } break;
431 
432 case 52: {
433  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
434  node->propertyToken = loc(1);
435  node->typeToken = loc(2);
436  node->identifierToken = loc(3);
437  node->semicolonToken = loc(4);
438  sym(1).Node = node;
439 } break;
440 
441 case 54: {
442  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
443  node->isDefaultMember = true;
444  node->defaultToken = loc(1);
445  node->propertyToken = loc(2);
446  node->typeToken = loc(3);
447  node->identifierToken = loc(4);
448  node->semicolonToken = loc(5);
449  sym(1).Node = node;
450 } break;
451 
452 case 56: {
453  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
454  sym(5).Expression);
455  node->propertyToken = loc(1);
456  node->typeToken = loc(2);
457  node->identifierToken = loc(3);
458  node->colonToken = loc(4);
459  node->semicolonToken = loc(6);
460  sym(1).Node = node;
461 } break;
462 
463 case 58: {
464  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
465  sym(6).Expression);
466  node->isReadonlyMember = true;
467  node->readonlyToken = loc(1);
468  node->propertyToken = loc(2);
469  node->typeToken = loc(3);
470  node->identifierToken = loc(4);
471  node->colonToken = loc(5);
472  node->semicolonToken = loc(7);
473  sym(1).Node = node;
474 } break;
475 
476 case 60: {
477  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
478  sym(6).Expression);
479  node->isDefaultMember = true;
480  node->defaultToken = loc(1);
481  node->propertyToken = loc(2);
482  node->typeToken = loc(3);
483  node->identifierToken = loc(4);
484  node->colonToken = loc(5);
485  node->semicolonToken = loc(7);
486  sym(1).Node = node;
487 } break;
488 
489 case 61: {
490  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
491  node->typeModifier = sym(2).sval;
492  node->propertyToken = loc(1);
493  node->typeModifierToken = loc(2);
494  node->typeToken = loc(4);
495  node->identifierToken = loc(6);
496  node->semicolonToken = loc(7); // insert a fake ';' before ':'
497 
498  AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(6).sval);
499  propertyName->identifierToken = loc(6);
500  propertyName->next = 0;
501 
502  AST::UiArrayBinding *binding = makeAstNode<AST::UiArrayBinding> (driver->nodePool(),
503  propertyName, sym(9).UiArrayMemberList->finish());
504  binding->colonToken = loc(7);
505  binding->lbracketToken = loc(8);
506  binding->rbracketToken = loc(10);
507 
508  node->binding = binding;
509 
510  sym(1).Node = node;
511 } break;
512 
513 case 62: {
514  AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
515  node->propertyToken = loc(1);
516  node->typeToken = loc(2);
517  node->identifierToken = loc(3);
518  node->semicolonToken = loc(4); // insert a fake ';' before ':'
519 
520  AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(3).sval);
521  propertyName->identifierToken = loc(3);
522  propertyName->next = 0;
523 
524  AST::UiObjectBinding *binding = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
525  propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer);
526  binding->colonToken = loc(4);
527 
528  node->binding = binding;
529 
530  sym(1).Node = node;
531 } break;
532 
533 case 63: {
534  sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
535 } break;
536 
537 case 64: {
538  sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
539 } break;
540 
541 case 66: {
543  sym(1).sval = driver->intern(s.constData(), s.length());
544  break;
545 }
546 
547 case 67: {
549  sym(1).sval = driver->intern(s.constData(), s.length());
550  break;
551 }
552 
553 case 68: {
555  sym(1).sval = driver->intern(s.constData(), s.length());
556  break;
557 }
558 
559 case 69: {
561  sym(1).sval = driver->intern(s.constData(), s.length());
562  break;
563 }
564 
565 case 70: {
566  AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
567  node->thisToken = loc(1);
568  sym(1).Node = node;
569 } break;
570 
571 case 71: {
572  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
573  node->identifierToken = loc(1);
574  sym(1).Node = node;
575 } break;
576 
577 case 72: {
578  AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
579  node->nullToken = loc(1);
580  sym(1).Node = node;
581 } break;
582 
583 case 73: {
584  AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
585  node->trueToken = loc(1);
586  sym(1).Node = node;
587 } break;
588 
589 case 74: {
590  AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
591  node->falseToken = loc(1);
592  sym(1).Node = node;
593 } break;
594 
595 case 75: {
596  AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
597  node->literalToken = loc(1);
598  sym(1).Node = node;
599 } break;
600 case 76:
601 case 77: {
602  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
603  node->literalToken = loc(1);
604  sym(1).Node = node;
605 } break;
606 
607 case 78: {
608  bool rx = lexer->scanRegExp(Lexer::NoPrefix);
609  if (!rx) {
611  return false; // ### remove me
612  }
613 
614  loc(1).length = lexer->tokenLength();
615 
616  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
617  node->literalToken = loc(1);
618  sym(1).Node = node;
619 } break;
620 
621 case 79: {
622  bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
623  if (!rx) {
625  return false;
626  }
627 
628  loc(1).length = lexer->tokenLength();
629 
630  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
631  node->literalToken = loc(1);
632  sym(1).Node = node;
633 } break;
634 
635 case 80: {
636  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0);
637  node->lbracketToken = loc(1);
638  node->rbracketToken = loc(2);
639  sym(1).Node = node;
640 } break;
641 
642 case 81: {
643  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish());
644  node->lbracketToken = loc(1);
645  node->rbracketToken = loc(3);
646  sym(1).Node = node;
647 } break;
648 
649 case 82: {
650  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
651  node->lbracketToken = loc(1);
652  node->rbracketToken = loc(3);
653  sym(1).Node = node;
654 } break;
655 
656 case 83: {
657  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
658  (AST::Elision *) 0);
659  node->lbracketToken = loc(1);
660  node->commaToken = loc(3);
661  node->rbracketToken = loc(4);
662  sym(1).Node = node;
663 } break;
664 
665 case 84: {
666  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
667  sym(4).Elision->finish());
668  node->lbracketToken = loc(1);
669  node->commaToken = loc(3);
670  node->rbracketToken = loc(5);
671  sym(1).Node = node;
672 } break;
673 
674 case 85: {
675  AST::ObjectLiteral *node = 0;
676  if (sym(2).Node)
677  node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
679  else
680  node = makeAstNode<AST::ObjectLiteral> (driver->nodePool());
681  node->lbraceToken = loc(1);
682  node->rbraceToken = loc(3);
683  sym(1).Node = node;
684 } break;
685 
686 case 86: {
687  AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
689  node->lbraceToken = loc(1);
690  node->rbraceToken = loc(4);
691  sym(1).Node = node;
692 } break;
693 
694 case 87: {
695  AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
696  node->lparenToken = loc(1);
697  node->rparenToken = loc(3);
698  sym(1).Node = node;
699 } break;
700 
701 case 88: {
702  if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {
704  QLatin1String("Ignored annotation")));
705 
706  sym(1).Expression = mem->base;
707  }
708 
709  if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) {
710  sym(1).UiQualifiedId = qualifiedId;
711  } else {
712  sym(1).UiQualifiedId = 0;
713 
715  QLatin1String("Expected a qualified name id")));
716 
717  return false; // ### recover
718  }
719 } break;
720 
721 case 89: {
722  sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression);
723 } break;
724 
725 case 90: {
726  sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression);
727 } break;
728 
729 case 91: {
730  AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList,
731  (AST::Elision *) 0, sym(3).Expression);
732  node->commaToken = loc(2);
733  sym(1).Node = node;
734 } break;
735 
736 case 92: {
737  AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(),
738  sym(4).Expression);
739  node->commaToken = loc(2);
740  sym(1).Node = node;
741 } break;
742 
743 case 93: {
744  AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
745  node->commaToken = loc(1);
746  sym(1).Node = node;
747 } break;
748 
749 case 94: {
750  AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
751  node->commaToken = loc(2);
752  sym(1).Node = node;
753 } break;
754 
755 case 95: {
756  AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
757  sym(1).PropertyName, sym(3).Expression);
758  node->colonToken = loc(2);
759  sym(1).Node = node;
760 } break;
761 
762 case 96: {
763  AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
765  node->commaToken = loc(2);
766  node->colonToken = loc(4);
767  sym(1).Node = node;
768 } break;
769 
770 case 97: {
771  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
772  node->propertyNameToken = loc(1);
773  sym(1).Node = node;
774 } break;
775 case 98:
776 case 99: {
777  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
778  node->propertyNameToken = loc(1);
779  sym(1).Node = node;
780 } break;
781 
782 case 100: {
783  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
784  node->propertyNameToken = loc(1);
785  sym(1).Node = node;
786 } break;
787 
788 case 101: {
789  AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
790  node->propertyNameToken = loc(1);
791  sym(1).Node = node;
792 } break;
793 
794 case 102: {
795  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
796  node->propertyNameToken = loc(1);
797  sym(1).Node = node;
798 } break;
799 
800 case 103:
801 
802 case 104:
803 
804 case 105:
805 
806 case 106:
807 
808 case 107:
809 
810 case 108:
811 
812 case 109:
813 
814 case 110:
815 
816 case 111:
817 
818 case 112:
819 
820 case 113:
821 
822 case 114:
823 
824 case 115:
825 
826 case 116:
827 
828 case 117:
829 
830 case 118:
831 
832 case 119:
833 
834 case 120:
835 
836 case 121:
837 
838 case 122:
839 
840 case 123:
841 
842 case 124:
843 
844 case 125:
845 
846 case 126:
847 
848 case 127:
849 
850 case 128:
851 
852 case 129:
853 
854 case 130:
855 
856 case 131:
857 
858 case 132:
859 
860 case 133:
861 {
862  sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
863 } break;
864 
865 case 138: {
866  AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
867  node->lbracketToken = loc(2);
868  node->rbracketToken = loc(4);
869  sym(1).Node = node;
870 } break;
871 
872 case 139: {
873  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
874  node->dotToken = loc(2);
875  node->identifierToken = loc(3);
876  sym(1).Node = node;
877 } break;
878 
879 case 140: {
880  AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
881  node->newToken = loc(1);
882  node->lparenToken = loc(3);
883  node->rparenToken = loc(5);
884  sym(1).Node = node;
885 } break;
886 
887 case 142: {
888  AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
889  node->newToken = loc(1);
890  sym(1).Node = node;
891 } break;
892 
893 case 143: {
894  AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
895  node->lparenToken = loc(2);
896  node->rparenToken = loc(4);
897  sym(1).Node = node;
898 } break;
899 
900 case 144: {
901  AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
902  node->lparenToken = loc(2);
903  node->rparenToken = loc(4);
904  sym(1).Node = node;
905 } break;
906 
907 case 145: {
908  AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
909  node->lbracketToken = loc(2);
910  node->rbracketToken = loc(4);
911  sym(1).Node = node;
912 } break;
913 
914 case 146: {
915  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
916  node->dotToken = loc(2);
917  node->identifierToken = loc(3);
918  sym(1).Node = node;
919 } break;
920 
921 case 147: {
922  sym(1).Node = 0;
923 } break;
924 
925 case 148: {
926  sym(1).Node = sym(1).ArgumentList->finish();
927 } break;
928 
929 case 149: {
930  sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
931 } break;
932 
933 case 150: {
934  AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
935  node->commaToken = loc(2);
936  sym(1).Node = node;
937 } break;
938 
939 case 154: {
940  AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
941  node->incrementToken = loc(2);
942  sym(1).Node = node;
943 } break;
944 
945 case 155: {
946  AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
947  node->decrementToken = loc(2);
948  sym(1).Node = node;
949 } break;
950 
951 case 157: {
952  AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
953  node->deleteToken = loc(1);
954  sym(1).Node = node;
955 } break;
956 
957 case 158: {
958  AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
959  node->voidToken = loc(1);
960  sym(1).Node = node;
961 } break;
962 
963 case 159: {
964  AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
965  node->typeofToken = loc(1);
966  sym(1).Node = node;
967 } break;
968 
969 case 160: {
970  AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
971  node->incrementToken = loc(1);
972  sym(1).Node = node;
973 } break;
974 
975 case 161: {
976  AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
977  node->decrementToken = loc(1);
978  sym(1).Node = node;
979 } break;
980 
981 case 162: {
982  AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
983  node->plusToken = loc(1);
984  sym(1).Node = node;
985 } break;
986 
987 case 163: {
988  AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
989  node->minusToken = loc(1);
990  sym(1).Node = node;
991 } break;
992 
993 case 164: {
994  AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
995  node->tildeToken = loc(1);
996  sym(1).Node = node;
997 } break;
998 
999 case 165: {
1000  AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
1001  node->notToken = loc(1);
1002  sym(1).Node = node;
1003 } break;
1004 
1005 case 167: {
1006  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1008  node->operatorToken = loc(2);
1009  sym(1).Node = node;
1010 } break;
1011 
1012 case 168: {
1013  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1015  node->operatorToken = loc(2);
1016  sym(1).Node = node;
1017 } break;
1018 
1019 case 169: {
1020  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1022  node->operatorToken = loc(2);
1023  sym(1).Node = node;
1024 } break;
1025 
1026 case 171: {
1027  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1029  node->operatorToken = loc(2);
1030  sym(1).Node = node;
1031 } break;
1032 
1033 case 172: {
1034  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1036  node->operatorToken = loc(2);
1037  sym(1).Node = node;
1038 } break;
1039 
1040 case 174: {
1041  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1043  node->operatorToken = loc(2);
1044  sym(1).Node = node;
1045 } break;
1046 
1047 case 175: {
1048  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1050  node->operatorToken = loc(2);
1051  sym(1).Node = node;
1052 } break;
1053 
1054 case 176: {
1055  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1057  node->operatorToken = loc(2);
1058  sym(1).Node = node;
1059 } break;
1060 
1061 case 178: {
1062  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1064  node->operatorToken = loc(2);
1065  sym(1).Node = node;
1066 } break;
1067 
1068 case 179: {
1069  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1071  node->operatorToken = loc(2);
1072  sym(1).Node = node;
1073 } break;
1074 
1075 case 180: {
1076  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1078  node->operatorToken = loc(2);
1079  sym(1).Node = node;
1080 } break;
1081 
1082 case 181: {
1083  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1085  node->operatorToken = loc(2);
1086  sym(1).Node = node;
1087 } break;
1088 
1089 case 182: {
1090  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1092  node->operatorToken = loc(2);
1093  sym(1).Node = node;
1094 } break;
1095 
1096 case 183: {
1097  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1099  node->operatorToken = loc(2);
1100  sym(1).Node = node;
1101 } break;
1102 
1103 case 185: {
1104  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1106  node->operatorToken = loc(2);
1107  sym(1).Node = node;
1108 } break;
1109 
1110 case 186: {
1111  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1113  node->operatorToken = loc(2);
1114  sym(1).Node = node;
1115 } break;
1116 
1117 case 187: {
1118  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1120  node->operatorToken = loc(2);
1121  sym(1).Node = node;
1122 } break;
1123 
1124 case 188: {
1125  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1127  node->operatorToken = loc(2);
1128  sym(1).Node = node;
1129 } break;
1130 
1131 case 189: {
1132  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1134  node->operatorToken = loc(2);
1135  sym(1).Node = node;
1136 } break;
1137 
1138 case 191: {
1139  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1141  node->operatorToken = loc(2);
1142  sym(1).Node = node;
1143 } break;
1144 
1145 case 192: {
1146  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1148  node->operatorToken = loc(2);
1149  sym(1).Node = node;
1150 } break;
1151 
1152 case 193: {
1153  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1155  node->operatorToken = loc(2);
1156  sym(1).Node = node;
1157 } break;
1158 
1159 case 194: {
1160  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1162  node->operatorToken = loc(2);
1163  sym(1).Node = node;
1164 } break;
1165 
1166 case 196: {
1167  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1169  node->operatorToken = loc(2);
1170  sym(1).Node = node;
1171 } break;
1172 
1173 case 197: {
1174  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1176  node->operatorToken = loc(2);
1177  sym(1).Node = node;
1178 } break;
1179 
1180 case 198: {
1181  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1183  node->operatorToken = loc(2);
1184  sym(1).Node = node;
1185 } break;
1186 
1187 case 199: {
1188  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1190  node->operatorToken = loc(2);
1191  sym(1).Node = node;
1192 } break;
1193 
1194 case 201: {
1195  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1197  node->operatorToken = loc(2);
1198  sym(1).Node = node;
1199 } break;
1200 
1201 case 203: {
1202  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1204  node->operatorToken = loc(2);
1205  sym(1).Node = node;
1206 } break;
1207 
1208 case 205: {
1209  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1211  node->operatorToken = loc(2);
1212  sym(1).Node = node;
1213 } break;
1214 
1215 case 207: {
1216  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1218  node->operatorToken = loc(2);
1219  sym(1).Node = node;
1220 } break;
1221 
1222 case 209: {
1223  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1225  node->operatorToken = loc(2);
1226  sym(1).Node = node;
1227 } break;
1228 
1229 case 211: {
1230  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1232  node->operatorToken = loc(2);
1233  sym(1).Node = node;
1234 } break;
1235 
1236 case 213: {
1237  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1239  node->operatorToken = loc(2);
1240  sym(1).Node = node;
1241 } break;
1242 
1243 case 215: {
1244  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1246  node->operatorToken = loc(2);
1247  sym(1).Node = node;
1248 } break;
1249 
1250 case 217: {
1251  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1253  node->operatorToken = loc(2);
1254  sym(1).Node = node;
1255 } break;
1256 
1257 case 219: {
1258  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1260  node->operatorToken = loc(2);
1261  sym(1).Node = node;
1262 } break;
1263 
1264 case 221: {
1265  AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
1266  sym(3).Expression, sym(5).Expression);
1267  node->questionToken = loc(2);
1268  node->colonToken = loc(4);
1269  sym(1).Node = node;
1270 } break;
1271 
1272 case 223: {
1273  AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
1274  sym(3).Expression, sym(5).Expression);
1275  node->questionToken = loc(2);
1276  node->colonToken = loc(4);
1277  sym(1).Node = node;
1278 } break;
1279 
1280 case 225: {
1281  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1282  sym(2).ival, sym(3).Expression);
1283  node->operatorToken = loc(2);
1284  sym(1).Node = node;
1285 } break;
1286 
1287 case 227: {
1288  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
1289  sym(2).ival, sym(3).Expression);
1290  node->operatorToken = loc(2);
1291  sym(1).Node = node;
1292 } break;
1293 
1294 case 228: {
1296 } break;
1297 
1298 case 229: {
1300 } break;
1301 
1302 case 230: {
1304 } break;
1305 
1306 case 231: {
1308 } break;
1309 
1310 case 232: {
1312 } break;
1313 
1314 case 233: {
1316 } break;
1317 
1318 case 234: {
1320 } break;
1321 
1322 case 235: {
1324 } break;
1325 
1326 case 236: {
1328 } break;
1329 
1330 case 237: {
1332 } break;
1333 
1334 case 238: {
1336 } break;
1337 
1338 case 239: {
1340 } break;
1341 
1342 case 241: {
1343  AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
1344  node->commaToken = loc(2);
1345  sym(1).Node = node;
1346 } break;
1347 
1348 case 242: {
1349  sym(1).Node = 0;
1350 } break;
1351 
1352 case 245: {
1353  AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
1354  node->commaToken = loc(2);
1355  sym(1).Node = node;
1356 } break;
1357 
1358 case 246: {
1359  sym(1).Node = 0;
1360 } break;
1361 
1362 case 263: {
1363  AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList);
1364  node->lbraceToken = loc(1);
1365  node->rbraceToken = loc(3);
1366  sym(1).Node = node;
1367 } break;
1368 
1369 case 264: {
1370  sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement);
1371 } break;
1372 
1373 case 265: {
1374  sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement);
1375 } break;
1376 
1377 case 266: {
1378  sym(1).Node = 0;
1379 } break;
1380 
1381 case 267: {
1382  sym(1).Node = sym(1).StatementList->finish ();
1383 } break;
1384 
1385 case 269: {
1386  AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(),
1387  sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
1388  node->declarationKindToken = loc(1);
1389  node->semicolonToken = loc(3);
1390  sym(1).Node = node;
1391 } break;
1392 
1393 case 270: {
1394  sym(1).ival = T_CONST;
1395 } break;
1396 
1397 case 271: {
1398  sym(1).ival = T_VAR;
1399 } break;
1400 
1401 case 272: {
1402  sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
1403 } break;
1404 
1405 case 273: {
1406  AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(),
1408  node->commaToken = loc(2);
1409  sym(1).Node = node;
1410 } break;
1411 
1412 case 274: {
1413  sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
1414 } break;
1415 
1416 case 275: {
1417  sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
1418 } break;
1419 
1420 case 276: {
1421  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
1422  node->identifierToken = loc(1);
1423  sym(1).Node = node;
1424 } break;
1425 
1426 case 277: {
1427  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
1428  node->identifierToken = loc(1);
1429  sym(1).Node = node;
1430 } break;
1431 
1432 case 278: {
1433  // ### TODO: AST for initializer
1434  sym(1) = sym(2);
1435 } break;
1436 
1437 case 279: {
1438  sym(1).Node = 0;
1439 } break;
1440 
1441 case 281: {
1442  // ### TODO: AST for initializer
1443  sym(1) = sym(2);
1444 } break;
1445 
1446 case 282: {
1447  sym(1).Node = 0;
1448 } break;
1449 
1450 case 284: {
1451  AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool());
1452  node->semicolonToken = loc(1);
1453  sym(1).Node = node;
1454 } break;
1455 
1456 case 286: {
1457  AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
1458  node->semicolonToken = loc(2);
1459  sym(1).Node = node;
1460 } break;
1461 
1462 case 287: {
1463  AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement);
1464  node->ifToken = loc(1);
1465  node->lparenToken = loc(2);
1466  node->rparenToken = loc(4);
1467  node->elseToken = loc(5);
1468  sym(1).Node = node;
1469 } break;
1470 
1471 case 288: {
1472  AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
1473  node->ifToken = loc(1);
1474  node->lparenToken = loc(2);
1475  node->rparenToken = loc(4);
1476  sym(1).Node = node;
1477 } break;
1478 
1479 case 290: {
1480  AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression);
1481  node->doToken = loc(1);
1482  node->whileToken = loc(3);
1483  node->lparenToken = loc(4);
1484  node->rparenToken = loc(6);
1485  node->semicolonToken = loc(7);
1486  sym(1).Node = node;
1487 } break;
1488 
1489 case 291: {
1490  AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
1491  node->whileToken = loc(1);
1492  node->lparenToken = loc(2);
1493  node->rparenToken = loc(4);
1494  sym(1).Node = node;
1495 } break;
1496 
1497 case 292: {
1498  AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression,
1499  sym(5).Expression, sym(7).Expression, sym(9).Statement);
1500  node->forToken = loc(1);
1501  node->lparenToken = loc(2);
1502  node->firstSemicolonToken = loc(4);
1503  node->secondSemicolonToken = loc(6);
1504  node->rparenToken = loc(8);
1505  sym(1).Node = node;
1506 } break;
1507 
1508 case 293: {
1509  AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(),
1510  sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
1511  sym(8).Expression, sym(10).Statement);
1512  node->forToken = loc(1);
1513  node->lparenToken = loc(2);
1514  node->varToken = loc(3);
1515  node->firstSemicolonToken = loc(5);
1516  node->secondSemicolonToken = loc(7);
1517  node->rparenToken = loc(9);
1518  sym(1).Node = node;
1519 } break;
1520 
1521 case 294: {
1522  AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression,
1523  sym(5).Expression, sym(7).Statement);
1524  node->forToken = loc(1);
1525  node->lparenToken = loc(2);
1526  node->inToken = loc(4);
1527  node->rparenToken = loc(6);
1528  sym(1).Node = node;
1529 } break;
1530 
1531 case 295: {
1532  AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(),
1534  node->forToken = loc(1);
1535  node->lparenToken = loc(2);
1536  node->varToken = loc(3);
1537  node->inToken = loc(5);
1538  node->rparenToken = loc(7);
1539  sym(1).Node = node;
1540 } break;
1541 
1542 case 297: {
1543  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool());
1544  node->continueToken = loc(1);
1545  node->semicolonToken = loc(2);
1546  sym(1).Node = node;
1547 } break;
1548 
1549 case 299: {
1550  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
1551  node->continueToken = loc(1);
1552  node->identifierToken = loc(2);
1553  node->semicolonToken = loc(3);
1554  sym(1).Node = node;
1555 } break;
1556 
1557 case 301: {
1558  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
1559  node->breakToken = loc(1);
1560  node->semicolonToken = loc(2);
1561  sym(1).Node = node;
1562 } break;
1563 
1564 case 303: {
1565  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
1566  node->breakToken = loc(1);
1567  node->identifierToken = loc(2);
1568  node->semicolonToken = loc(3);
1569  sym(1).Node = node;
1570 } break;
1571 
1572 case 305: {
1573  AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression);
1574  node->returnToken = loc(1);
1575  node->semicolonToken = loc(3);
1576  sym(1).Node = node;
1577 } break;
1578 
1579 case 306: {
1580  AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
1581  node->withToken = loc(1);
1582  node->lparenToken = loc(2);
1583  node->rparenToken = loc(4);
1584  sym(1).Node = node;
1585 } break;
1586 
1587 case 307: {
1588  AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock);
1589  node->switchToken = loc(1);
1590  node->lparenToken = loc(2);
1591  node->rparenToken = loc(4);
1592  sym(1).Node = node;
1593 } break;
1594 
1595 case 308: {
1596  AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses);
1597  node->lbraceToken = loc(1);
1598  node->rbraceToken = loc(3);
1599  sym(1).Node = node;
1600 } break;
1601 
1602 case 309: {
1603  AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
1604  node->lbraceToken = loc(1);
1605  node->rbraceToken = loc(5);
1606  sym(1).Node = node;
1607 } break;
1608 
1609 case 310: {
1610  sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause);
1611 } break;
1612 
1613 case 311: {
1614  sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause);
1615 } break;
1616 
1617 case 312: {
1618  sym(1).Node = 0;
1619 } break;
1620 
1621 case 313: {
1622  sym(1).Node = sym(1).CaseClauses->finish ();
1623 } break;
1624 
1625 case 314: {
1626  AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList);
1627  node->caseToken = loc(1);
1628  node->colonToken = loc(3);
1629  sym(1).Node = node;
1630 } break;
1631 
1632 case 315: {
1633  AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList);
1634  node->defaultToken = loc(1);
1635  node->colonToken = loc(2);
1636  sym(1).Node = node;
1637 } break;
1638 case 316:
1639 case 317: {
1640  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
1641  node->identifierToken = loc(1);
1642  node->colonToken = loc(2);
1643  sym(1).Node = node;
1644 } break;
1645 
1646 case 318: {
1647  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
1648  node->identifierToken = loc(1);
1649  node->colonToken = loc(2);
1650  sym(1).Node = node;
1651 } break;
1652 
1653 case 320: {
1654  AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression);
1655  node->throwToken = loc(1);
1656  node->semicolonToken = loc(3);
1657  sym(1).Node = node;
1658 } break;
1659 
1660 case 321: {
1661  AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch);
1662  node->tryToken = loc(1);
1663  sym(1).Node = node;
1664 } break;
1665 
1666 case 322: {
1667  AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally);
1668  node->tryToken = loc(1);
1669  sym(1).Node = node;
1670 } break;
1671 
1672 case 323: {
1673  AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally);
1674  node->tryToken = loc(1);
1675  sym(1).Node = node;
1676 } break;
1677 
1678 case 324: {
1679  AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
1680  node->catchToken = loc(1);
1681  node->lparenToken = loc(2);
1682  node->identifierToken = loc(3);
1683  node->rparenToken = loc(4);
1684  sym(1).Node = node;
1685 } break;
1686 
1687 case 325: {
1688  AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block);
1689  node->finallyToken = loc(1);
1690  sym(1).Node = node;
1691 } break;
1692 
1693 case 327: {
1694  AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool());
1695  node->debuggerToken = loc(1);
1696  node->semicolonToken = loc(2);
1697  sym(1).Node = node;
1698 } break;
1699 
1700 case 328: {
1701  AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
1702  node->functionToken = loc(1);
1703  node->identifierToken = loc(2);
1704  node->lparenToken = loc(3);
1705  node->rparenToken = loc(5);
1706  node->lbraceToken = loc(6);
1707  node->rbraceToken = loc(8);
1708  sym(1).Node = node;
1709 } break;
1710 
1711 case 329: {
1712  AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
1713  node->functionToken = loc(1);
1714  if (sym(2).sval)
1715  node->identifierToken = loc(2);
1716  node->lparenToken = loc(3);
1717  node->rparenToken = loc(5);
1718  node->lbraceToken = loc(6);
1719  node->rbraceToken = loc(8);
1720  sym(1).Node = node;
1721 } break;
1722 
1723 case 330: {
1724  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
1725  node->identifierToken = loc(1);
1726  sym(1).Node = node;
1727 } break;
1728 
1729 case 331: {
1730  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
1731  node->commaToken = loc(2);
1732  node->identifierToken = loc(3);
1733  sym(1).Node = node;
1734 } break;
1735 
1736 case 332: {
1737  sym(1).Node = 0;
1738 } break;
1739 
1740 case 333: {
1741  sym(1).Node = sym(1).FormalParameterList->finish ();
1742 } break;
1743 
1744 case 334: {
1745  sym(1).Node = 0;
1746 } break;
1747 
1748 case 336: {
1749  sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ());
1750 } break;
1751 
1752 case 337: {
1753  sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ());
1754 } break;
1755 
1756 case 338: {
1757  sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement);
1758 } break;
1759 
1760 case 339: {
1761  sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement);
1762 } break;
1763 
1764 case 340: {
1765  sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement);
1766 } break;
1767 
1768 case 341: {
1769  sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration);
1770 } break;
1771 
1772 case 342: {
1773  sym(1).sval = 0;
1774 } break;
1775 
1776 case 344: {
1777  sym(1).Node = 0;
1778 } break;
1779 
1780  } // switch
1781  action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT);
1782  } // if
1783  } while (action != 0);
1784 
1785  if (first_token == last_token) {
1786  const int errorState = state_stack[tos];
1787 
1788  // automatic insertion of `;'
1789  if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
1790  SavedToken &tk = token_buffer[0];
1791  tk.token = yytoken;
1792  tk.dval = yylval;
1793  tk.loc = yylloc;
1794 
1795  yylloc = yyprevlloc;
1798  yylloc.length = 0;
1799 
1800  //const QString msg = qApp->translate("QDeclarativeParser", "Missing `;'");
1801  //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
1802 
1803  first_token = &token_buffer[0];
1804  last_token = &token_buffer[1];
1805 
1806  yytoken = T_SEMICOLON;
1807  yylval = 0;
1808 
1809  action = errorState;
1810 
1811  goto _Lcheck_token;
1812  }
1813 
1814  hadErrors = true;
1815 
1816  token_buffer[0].token = yytoken;
1817  token_buffer[0].dval = yylval;
1818  token_buffer[0].loc = yylloc;
1819 
1820  token_buffer[1].token = yytoken = lexer->lex();
1821  token_buffer[1].dval = yylval = lexer->dval();
1822  token_buffer[1].loc = yylloc = location(lexer);
1823 
1824  if (t_action(errorState, yytoken)) {
1825  QString msg;
1826  int token = token_buffer[0].token;
1827  if (token < 0 || token >= TERMINAL_COUNT)
1828  msg = qApp->translate("QDeclarativeParser", "Syntax error");
1829  else
1830  msg = qApp->translate("QDeclarativeParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
1832 
1833  action = errorState;
1834  goto _Lcheck_token;
1835  }
1836 
1837  static int tokens[] = {
1838  T_PLUS,
1839  T_EQ,
1840 
1841  T_COMMA,
1842  T_COLON,
1843  T_SEMICOLON,
1844 
1846 
1848  T_IDENTIFIER,
1849 
1851 
1852  EOF_SYMBOL
1853  };
1854 
1855  for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
1856  int a = t_action(errorState, *tk);
1857  if (a > 0 && t_action(a, yytoken)) {
1858  const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
1860 
1861  yytoken = *tk;
1862  yylval = 0;
1863  yylloc = token_buffer[0].loc;
1864  yylloc.length = 0;
1865 
1866  first_token = &token_buffer[0];
1867  last_token = &token_buffer[2];
1868 
1869  action = errorState;
1870  goto _Lcheck_token;
1871  }
1872  }
1873 
1874  for (int tk = 1; tk < TERMINAL_COUNT; ++tk) {
1875  if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM ||
1876  tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION ||
1878  continue;
1879 
1880  int a = t_action(errorState, tk);
1881  if (a > 0 && t_action(a, yytoken)) {
1882  const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
1884 
1885  yytoken = tk;
1886  yylval = 0;
1887  yylloc = token_buffer[0].loc;
1888  yylloc.length = 0;
1889 
1890  action = errorState;
1891  goto _Lcheck_token;
1892  }
1893  }
1894 
1895  const QString msg = qApp->translate("QDeclarativeParser", "Syntax error");
1897  }
1898 
1899  return false;
1900 }
enum QDeclarativeJS::AST::UiPublicMember::@102 type
static bool automatic(Engine *driver, int token)
QList< DiagnosticMessage > diagnostic_messages
AST::UiArrayMemberList * UiArrayMemberList
AST::VariableDeclarationList * VariableDeclarationList
NameId * intern(const QChar *u, int s)
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
static AST::SourceLocation location(Lexer *lexer)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
AST::VariableDeclaration * VariableDeclaration
long ASN1_INTEGER_get ASN1_INTEGER * a
AST::FunctionDeclaration * FunctionDeclaration
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool scanRegExp(RegExpBodyPrefix prefix=NoPrefix)
static const char *const spell[]
const QChar * characterBuffer() const
#define qApp
AST::UiObjectInitializer * UiObjectInitializer
AST::FormalParameterList * FormalParameterList
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
static int nt_action(int state, int nt)
static int t_action(int state, int token)
AST::UiQualifiedId * reparseAsQualifiedId(AST::ExpressionNode *expr)
AST::UiParameterList * UiParameterList
AST::SourceLocation yyprevlloc
SavedToken token_buffer[TOKEN_BUFFER_SIZE]
AST::UiObjectMemberList * UiObjectMemberList
static const short action_index[]
AST::SourceLocation & loc(int index)
VariableDeclarationList * finish(bool readOnly)
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712
AST::PropertyNameAndValueList * PropertyNameAndValueList

◆ parseExpression()

bool QDeclarativeJS::Parser::parseExpression ( )
inline

◆ parseProgram()

bool QDeclarativeJS::Parser::parseProgram ( )
inline

◆ parseSourceElement()

bool QDeclarativeJS::Parser::parseSourceElement ( )
inline

◆ parseStatement()

bool QDeclarativeJS::Parser::parseStatement ( )
inline

◆ parseUiObjectMember()

bool QDeclarativeJS::Parser::parseUiObjectMember ( )
inline

◆ reallocateStack()

QT_QML_BEGIN_NAMESPACE void Parser::reallocateStack ( )
protected

Definition at line 66 of file qdeclarativejsparser.cpp.

Referenced by parse().

67 {
68  if (! stack_size)
69  stack_size = 128;
70  else
71  stack_size <<= 1;
72 
73  sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
74  state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
76 }
AST::SourceLocation * location_stack
Q_CORE_EXPORT void * qRealloc(void *ptr, size_t size)
Definition: qmalloc.cpp:63

◆ reparseAsQualifiedId()

AST::UiQualifiedId * Parser::reparseAsQualifiedId ( AST::ExpressionNode expr)
protected

Definition at line 117 of file qdeclarativejsparser.cpp.

Referenced by parse().

118 {
121 
122  AST::ExpressionNode *it = expr;
123  while (AST::FieldMemberExpression *m = AST::cast<AST::FieldMemberExpression *>(it)) {
124  nameIds.append(m->name);
125  locations.append(m->identifierToken);
126  it = m->base;
127  }
128 
129  if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(it)) {
130  AST::UiQualifiedId *q = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), idExpr->name);
131  q->identifierToken = idExpr->identifierToken;
132 
133  AST::UiQualifiedId *currentId = q;
134  for (int i = nameIds.size() - 1; i != -1; --i) {
135  currentId = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), currentId, nameIds[i]);
136  currentId->identifierToken = locations[i];
137  }
138 
139  return currentId->finish();
140  }
141 
142  return 0;
143 }
#define it(className, varName)
void append(const T &t)
int size() const

◆ rootNode()

AST::Node* QDeclarativeJS::Parser::rootNode ( ) const
inline

Definition at line 166 of file qdeclarativejsparser_p.h.

167  { return program; }

◆ statement()

AST::Statement* QDeclarativeJS::Parser::statement ( ) const
inline

Definition at line 142 of file qdeclarativejsparser_p.h.

Referenced by QDeclarativeRewrite::SharedBindingTester::isSharable(), and QDeclarativeRewrite::RewriteBinding::operator()().

143  {
144  if (! program)
145  return 0;
146 
147  return program->statementCast();
148  }
virtual Statement * statementCast()

◆ sym()

Value& QDeclarativeJS::Parser::sym ( int  index)
inlineprotected

Definition at line 196 of file qdeclarativejsparser_p.h.

Referenced by parse().

197  { return sym_stack [tos + index - 1]; }
quint16 index

◆ uiObjectMember()

AST::UiObjectMember* QDeclarativeJS::Parser::uiObjectMember ( ) const
inline

Definition at line 158 of file qdeclarativejsparser_p.h.

159  {
160  if (! program)
161  return 0;
162 
163  return program->uiObjectMemberCast();
164  }
virtual UiObjectMember * uiObjectMemberCast()

Properties

◆ diagnostic_messages

QList<DiagnosticMessage> QDeclarativeJS::Parser::diagnostic_messages
protected

Definition at line 231 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ driver

Engine* QDeclarativeJS::Parser::driver
protected

Definition at line 205 of file qdeclarativejsparser_p.h.

Referenced by parse(), and reparseAsQualifiedId().

◆ first_token

SavedToken* QDeclarativeJS::Parser::first_token
protected

Definition at line 228 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ last_token

SavedToken* QDeclarativeJS::Parser::last_token
protected

Definition at line 229 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ location_stack

AST::SourceLocation* QDeclarativeJS::Parser::location_stack
protected

Definition at line 210 of file qdeclarativejsparser_p.h.

Referenced by reallocateStack(), and ~Parser().

◆ program

AST::Node* QDeclarativeJS::Parser::program
protected

Definition at line 212 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ stack_size

int QDeclarativeJS::Parser::stack_size
protected

Definition at line 207 of file qdeclarativejsparser_p.h.

Referenced by parse(), reallocateStack(), and ~Parser().

◆ state_stack

int* QDeclarativeJS::Parser::state_stack
protected

Definition at line 209 of file qdeclarativejsparser_p.h.

Referenced by parse(), reallocateStack(), and ~Parser().

◆ sym_stack

Value* QDeclarativeJS::Parser::sym_stack
protected

Definition at line 208 of file qdeclarativejsparser_p.h.

Referenced by reallocateStack(), and ~Parser().

◆ token_buffer

SavedToken QDeclarativeJS::Parser::token_buffer[TOKEN_BUFFER_SIZE]
protected

Definition at line 227 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ tos

int QDeclarativeJS::Parser::tos
protected

Definition at line 206 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ yylloc

AST::SourceLocation QDeclarativeJS::Parser::yylloc
protected

Definition at line 224 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ yylval

double QDeclarativeJS::Parser::yylval
protected

Definition at line 223 of file qdeclarativejsparser_p.h.

Referenced by parse().

◆ yyprevlloc

AST::SourceLocation QDeclarativeJS::Parser::yyprevlloc
protected

Definition at line 225 of file qdeclarativejsparser_p.h.

Referenced by parse().


The documentation for this class was generated from the following files: