qmljsparser.cpp 51.7 KB
Newer Older
1
2
3
4
5
// This file was generated by qlalr - DO NOT EDIT!

/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
6
** Contact: Qt Software Information (qt-info@nokia.com)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
39
** contact the sales department at qt-sales@nokia.com.
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
** $QT_END_LICENSE$
**
****************************************************************************/

#include <QtCore/QtDebug>

#include <string.h>

#include "qmljsengine_p.h"
#include "qmljslexer_p.h"
#include "qmljsast_p.h"
#include "qmljsnodepool_p.h"



#include "qmljsparser_p.h"
#include <QVarLengthArray>

//
// This file is automatically generated from qmljs.g.
// Changes will be lost.
//

using namespace QmlJS;

65
QT_QML_BEGIN_NAMESPACE
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

void Parser::reallocateStack()
{
    if (! stack_size)
        stack_size = 128;
    else
        stack_size <<= 1;

    sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
    state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
    location_stack = reinterpret_cast<AST::SourceLocation*> (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
}

inline static bool automatic(Engine *driver, int token)
{
    return token == QmlJSGrammar::T_RBRACE
        || token == 0
        || driver->lexer()->prevTerminator();
}


Parser::Parser(Engine *engine):
    driver(engine),
    tos(0),
    stack_size(0),
    sym_stack(0),
    state_stack(0),
    location_stack(0),
    first_token(0),
    last_token(0)
{
}

Parser::~Parser()
{
    if (stack_size) {
        qFree(sym_stack);
        qFree(state_stack);
        qFree(location_stack);
    }
}

static inline AST::SourceLocation location(Lexer *lexer)
{
    AST::SourceLocation loc;
    loc.offset = lexer->tokenOffset();
    loc.length = lexer->tokenLength();
    loc.startLine = lexer->startLineNo();
    loc.startColumn = lexer->startColumnNo();
    return loc;
}

AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
{
    QVarLengthArray<NameId *, 4> nameIds;
    QVarLengthArray<AST::SourceLocation, 4> locations;

    AST::ExpressionNode *it = expr;
    while (AST::FieldMemberExpression *m = AST::cast<AST::FieldMemberExpression *>(it)) {
        nameIds.append(m->name);
        locations.append(m->identifierToken);
        it = m->base;
    }

    if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(it)) {
        AST::UiQualifiedId *q = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), idExpr->name);
        q->identifierToken = idExpr->identifierToken;

        AST::UiQualifiedId *currentId = q;
        for (int i = nameIds.size() - 1; i != -1; --i) {
            currentId = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), currentId, nameIds[i]);
            currentId->identifierToken = locations[i];
        }

        return currentId->finish();
    }

    return 0;
}

146
bool Parser::parse(int startToken)
147
148
149
150
151
152
{
    Lexer *lexer = driver->lexer();
    bool hadErrors = false;
    int yytoken = -1;
    int action = 0;

153
154
155
    token_buffer[0].token = startToken;
    first_token = &token_buffer[0];
    last_token = &token_buffer[1];
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198

    tos = -1;
    program = 0;

    do {
        if (++tos == stack_size)
            reallocateStack();

        state_stack[tos] = action;

    _Lcheck_token:
        if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
            yyprevlloc = yylloc;

            if (first_token == last_token) {
                yytoken = lexer->lex();
                yylval = lexer->dval();
                yylloc = location(lexer);
            } else {
                yytoken = first_token->token;
                yylval = first_token->dval;
                yylloc = first_token->loc;
                ++first_token;
            }
        }

        action = t_action(action, yytoken);
        if (action > 0) {
            if (action != ACCEPT_STATE) {
                yytoken = -1;
                sym(1).dval = yylval;
                loc(1) = yylloc;
            } else {
              --tos;
              return ! hadErrors;
            }
        } else if (action < 0) {
          const int r = -action - 1;
          tos -= rhs[r];

          switch (r) {

case 0: {
199
200
201
202
203
204
205
  sym(1).Node = sym(2).Node;
  program = sym(1).Node;
} break;

case 1: {
  sym(1).Node = sym(2).Node;
  program = sym(1).Node;
206
207
208
} break;

case 2: {
209
210
  sym(1).Node = sym(2).Node;
  program = sym(1).Node;
211
212
213
} break;

case 3: {
214
215
216
217
218
  sym(1).Node = sym(2).Node;
  program = sym(1).Node;
} break;

case 4: {
219
220
221
222
  sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList,
        sym(2).UiObjectMemberList->finish());
} break;

223
case 6: {
224
225
226
    sym(1).Node = sym(1).UiImportList->finish();
} break;

227
case 7: {
228
229
230
    sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport);
} break;

231
case 8: {
232
233
234
235
    sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(),
        sym(1).UiImportList, sym(2).UiImport);
} break;

236
case 11: {
237
    sym(1).UiImport->semicolonToken = loc(2);
238
239
} break;

240
case 13: {
241
242
    sym(1).UiImport->versionToken = loc(2);
    sym(1).UiImport->semicolonToken = loc(3);
243
244
} break;

245
case 15: {
246
247
248
    sym(1).UiImport->versionToken = loc(2);
    sym(1).UiImport->asToken = loc(3);
    sym(1).UiImport->importIdToken = loc(4);
249
    sym(1).UiImport->importId = sym(4).sval;
250
    sym(1).UiImport->semicolonToken = loc(5);
251
252
} break;

253
case 17: {
254
255
    sym(1).UiImport->asToken = loc(2);
    sym(1).UiImport->importIdToken = loc(3);
256
    sym(1).UiImport->importId = sym(3).sval;
257
    sym(1).UiImport->semicolonToken = loc(4);
258
259
} break;

260
case 18: {
261
262
263
264
265
266
267
268
269
270
271
272
273
274
    AST::UiImport *node = 0;

    if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) {
        node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
        node->fileNameToken = loc(2);
    } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
        QString text;
        for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
	   text += q->name->asString();
           if (q->next) text += QLatin1String(".");
        }
        node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
        node->fileNameToken = loc(2);
    }
275
276

    sym(1).Node = node;
277
278
279
280
281
282
283

    if (! node) {
       diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
         QLatin1String("Expected a qualified name id or a string literal")));

        return false; // ### remove me
    }
284
285
} break;

286
case 19: {
287
288
289
    sym(1).Node = 0;
} break;

290
case 20: {
291
292
293
    sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
} break;

294
case 21: {
295
296
297
    sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
} break;

298
case 22: {
299
300
301
302
303
    AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
        sym(1).UiObjectMemberList, sym(2).UiObjectMember);
    sym(1).Node = node;
} break;

304
case 23: {
305
306
307
    sym(1).Node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiObjectMember);
} break;

308
case 24: {
309
310
311
312
313
314
    AST::UiArrayMemberList *node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(),
        sym(1).UiArrayMemberList, sym(3).UiObjectMember);
    node->commaToken = loc(2);
    sym(1).Node = node;
} break;

315
case 25: {
316
317
318
319
320
321
    AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0);
    node->lbraceToken = loc(1);
    node->rbraceToken = loc(2);
    sym(1).Node = node;
}   break;

322
case 26: {
323
324
325
326
327
328
    AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish());
    node->lbraceToken = loc(1);
    node->rbraceToken = loc(3);
    sym(1).Node = node;
}   break;

329
case 27: {
330
    AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).UiQualifiedId,
331
332
333
334
        sym(2).UiObjectInitializer);
    sym(1).Node = node;
}   break;

335
case 29: {
336
    AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(),
337
        sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish());
338
339
340
341
342
343
    node->colonToken = loc(2);
    node->lbracketToken = loc(3);
    node->rbracketToken = loc(5);
    sym(1).Node = node;
}   break;

344
case 30: {
345
    AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
346
      sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer);
347
348
    node->colonToken = loc(2);
    sym(1).Node = node;
349
} break;
350
case 31:case 32:case 33:case 34:
351
352
{
    AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(),
353
        sym(1).UiQualifiedId, sym(3).Statement);
354
355
356
357
    node->colonToken = loc(2);
    sym(1).Node = node;
}   break;

358
case 35:
359

360
case 36: {
361
362
363
364
    sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
    break;
}

365
case 38: {
366
367
368
  sym(1).Node = 0;
} break;

369
case 39: {
370
371
372
  sym(1).Node = sym(1).UiParameterList->finish ();
} break;

373
case 40: {
374
375
376
377
378
  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval);
  node->identifierToken = loc(2);
  sym(1).Node = node;
} break;

379
case 41: {
380
381
382
383
384
385
  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval);
  node->commaToken = loc(2);
  node->identifierToken = loc(4);
  sym(1).Node = node;
} break;

386
case 43: {
387
388
389
390
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
    node->type = AST::UiPublicMember::Signal;
    node->propertyToken = loc(1);
    node->typeToken = loc(2);
391
    node->identifierToken = loc(2);
392
    node->parameters = sym(4).UiParameterList;
393
    node->semicolonToken = loc(6);
394
395
396
    sym(1).Node = node;
}   break;

397
case 45: {
398
399
400
401
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
    node->type = AST::UiPublicMember::Signal;
    node->propertyToken = loc(1);
    node->typeToken = loc(2);
402
403
    node->identifierToken = loc(2);
    node->semicolonToken = loc(3);
404
405
406
    sym(1).Node = node;
}   break;

407
408
409
410
411
412
413
414
415
416
417
418
case 47: {
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
    node->typeModifier = sym(2).sval;
    node->propertyToken = loc(1);
    node->typeModifierToken = loc(2);
    node->typeToken = loc(4);
    node->identifierToken = loc(6);
    node->semicolonToken = loc(7);
    sym(1).Node = node;
}   break;

case 49: {
419
420
421
422
423
424
425
426
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
    node->propertyToken = loc(1);
    node->typeToken = loc(2);
    node->identifierToken = loc(3);
    node->semicolonToken = loc(4);
    sym(1).Node = node;
}   break;

427
case 51: {
428
429
430
431
432
433
434
435
436
437
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
    node->isDefaultMember = true;
    node->defaultToken = loc(1);
    node->propertyToken = loc(2);
    node->typeToken = loc(3);
    node->identifierToken = loc(4);
    node->semicolonToken = loc(5);
    sym(1).Node = node;
}   break;

438
case 53: {
439
440
441
442
443
444
445
446
447
448
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
        sym(5).Expression);
    node->propertyToken = loc(1);
    node->typeToken = loc(2);
    node->identifierToken = loc(3);
    node->colonToken = loc(4);
    node->semicolonToken = loc(6);
    sym(1).Node = node;
}   break;

449
case 55: {
450
451
452
453
454
455
456
457
458
459
460
461
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
        sym(6).Expression);
    node->isReadonlyMember = true;
    node->readonlyToken = loc(1);
    node->propertyToken = loc(2);
    node->typeToken = loc(3);
    node->identifierToken = loc(4);
    node->colonToken = loc(5);
    node->semicolonToken = loc(7);
    sym(1).Node = node;
}   break;

462
case 57: {
463
464
465
466
467
468
469
470
471
472
473
474
    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
        sym(6).Expression);
    node->isDefaultMember = true;
    node->defaultToken = loc(1);
    node->propertyToken = loc(2);
    node->typeToken = loc(3);
    node->identifierToken = loc(4);
    node->colonToken = loc(5);
    node->semicolonToken = loc(7);
    sym(1).Node = node;
}   break;

475
case 58: {
476
477
478
    sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
}   break;

479
case 59: {
480
481
482
    sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
}   break;

483
case 61: {
484
485
486
487
488
    QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]);
    sym(1).sval = driver->intern(s.constData(), s.length());
    break;
}

489
case 62: {
490
491
492
493
494
    QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]);
    sym(1).sval = driver->intern(s.constData(), s.length());
    break;
}

495
case 63: {
496
497
498
499
500
    QString s = QLatin1String(QmlJSGrammar::spell[T_READONLY]);
    sym(1).sval = driver->intern(s.constData(), s.length());
    break;
}

501
case 64: {
502
503
504
505
506
  AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
  node->thisToken = loc(1);
  sym(1).Node = node;
} break;

507
case 65: {
508
509
510
511
512
  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
  node->identifierToken = loc(1);
  sym(1).Node = node;
} break;

513
case 66: {
514
515
516
517
518
  AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
  node->nullToken = loc(1);
  sym(1).Node = node;
} break;

519
case 67: {
520
521
522
523
524
  AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
  node->trueToken = loc(1);
  sym(1).Node = node;
} break;

525
case 68: {
526
527
528
529
530
  AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
  node->falseToken = loc(1);
  sym(1).Node = node;
} break;

531
case 69: {
532
  AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
533
534
535
  node->literalToken = loc(1);
  sym(1).Node = node;
} break;
536
537
case 70:
case 71: {
538
539
540
541
542
  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
  node->literalToken = loc(1);
  sym(1).Node = node;
} break;

543
case 72: {
544
545
546
547
548
549
550
551
552
553
  bool rx = lexer->scanRegExp(Lexer::NoPrefix);
  if (!rx) {
    diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
    return false; // ### remove me
  }
  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
  node->literalToken = loc(1);
  sym(1).Node = node;
} break;

554
case 73: {
555
556
557
558
559
560
561
562
563
564
  bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
  if (!rx) {
    diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
    return false;
  }
  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
  node->literalToken = loc(1);
  sym(1).Node = node;
} break;

565
case 74: {
566
567
568
569
570
571
  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0);
  node->lbracketToken = loc(1);
  node->rbracketToken = loc(2);
  sym(1).Node = node;
} break;

572
case 75: {
573
574
575
576
577
578
  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish());
  node->lbracketToken = loc(1);
  node->rbracketToken = loc(3);
  sym(1).Node = node;
} break;

579
case 76: {
580
581
582
583
584
585
  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
  node->lbracketToken = loc(1);
  node->rbracketToken = loc(3);
  sym(1).Node = node;
} break;

586
case 77: {
587
588
589
590
591
592
593
594
  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
    (AST::Elision *) 0);
  node->lbracketToken = loc(1);
  node->commaToken = loc(3);
  node->rbracketToken = loc(4);
  sym(1).Node = node;
} break;

595
case 78: {
596
597
598
599
600
601
602
603
  AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
    sym(4).Elision->finish());
  node->lbracketToken = loc(1);
  node->commaToken = loc(3);
  node->rbracketToken = loc(5);
  sym(1).Node = node;
} break;

604
case 79: {
605
606
607
608
609
610
611
612
613
614
615
  AST::ObjectLiteral *node = 0;
  if (sym(2).Node)
    node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
        sym(2).PropertyNameAndValueList->finish ());
  else
    node = makeAstNode<AST::ObjectLiteral> (driver->nodePool());
  node->lbraceToken = loc(1);
  node->lbraceToken = loc(3);
  sym(1).Node = node;
} break;

616
case 80: {
617
618
619
620
621
622
623
  AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
    sym(2).PropertyNameAndValueList->finish ());
  node->lbraceToken = loc(1);
  node->lbraceToken = loc(4);
  sym(1).Node = node;
} break;

624
case 81: {
625
626
627
628
629
630
  AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
  node->lparenToken = loc(1);
  node->rparenToken = loc(3);
  sym(1).Node = node;
} break;

631
case 82: {
632
633
634
  if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {
    diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken,
      QLatin1String("Ignored annotation")));
635

636
637
638
639
640
641
642
    sym(1).Expression = mem->base;
  }

  if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) {
    sym(1).UiQualifiedId = qualifiedId;
  } else {
    sym(1).UiQualifiedId = 0;
643

644
645
646
647
648
649
650
    diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
      QLatin1String("Expected a qualified name id")));

    return false; // ### recover
  }
} break;

651
case 83: {
652
653
654
  sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression);
} break;

655
case 84: {
656
657
658
  sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression);
} break;

659
case 85: {
660
661
662
663
664
665
  AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList,
    (AST::Elision *) 0, sym(3).Expression);
  node->commaToken = loc(2);
  sym(1).Node = node;
} break;

666
case 86: {
667
668
669
670
671
672
  AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(),
    sym(4).Expression);
  node->commaToken = loc(2);
  sym(1).Node = node;
} break;

673
case 87: {
674
675
676
677
678
  AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
  node->commaToken = loc(1);
  sym(1).Node = node;
} break;

679
case 88: {
680
681
682
683
684
  AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
  node->commaToken = loc(2);
  sym(1).Node = node;
} break;

685
case 89: {
686
687
688
689
690
691
  AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
      sym(1).PropertyName, sym(3).Expression);
  node->colonToken = loc(2);
  sym(1).Node = node;
} break;

692
case 90: {
693
694
695
696
697
698
699
  AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
      sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
  node->commaToken = loc(2);
  node->colonToken = loc(4);
  sym(1).Node = node;
} break;

700
case 91: {
701
702
703
704
  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
  node->propertyNameToken = loc(1);
  sym(1).Node = node;
} break;
705
706
case 92:
case 93: {
707
708
709
710
711
  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
  node->propertyNameToken = loc(1);
  sym(1).Node = node;
} break;

712
case 94: {
713
714
715
716
717
  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
  node->propertyNameToken = loc(1);
  sym(1).Node = node;
} break;

718
case 95: {
719
720
721
722
723
  AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
  node->propertyNameToken = loc(1);
  sym(1).Node = node;
} break;

724
case 96: {
725
726
727
728
729
  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
  node->propertyNameToken = loc(1);
  sym(1).Node = node;
} break;

730
case 97:
731

732
case 98:
733

734
case 99:
735

736
case 100:
737

738
case 101:
739

740
case 102:
741

742
case 103:
743

744
case 104:
745

746
case 105:
747

748
case 106:
749

750
case 107:
751

752
case 108:
753

754
case 109:
755

756
case 110:
757

758
case 111:
759

760
case 112:
761

762
case 113:
763

764
case 114:
765

766
case 115:
767

768
case 116:
769

770
case 117:
771

772
case 118:
773

774
case 119:
775

776
case 120:
777

778
case 121:
779
780
781
782
783
784

case 122:

case 123:

case 124:
785
786
787
788
789
790

case 125:

case 126:

case 127:
791
792
793
794
{
  sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
} break;

795
case 132: {
796
797
798
799
800
801
  AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
  node->lbracketToken = loc(2);
  node->rbracketToken = loc(4);
  sym(1).Node = node;
} break;

802
case 133: {
803
804
805
806
807
808
  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
  node->dotToken = loc(2);
  node->identifierToken = loc(3);
  sym(1).Node = node;
} break;

809
case 134: {
810
811
812
813
814
815
816
  AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
  node->newToken = loc(1);
  node->lparenToken = loc(3);
  node->rparenToken = loc(5);
  sym(1).Node = node;
} break;

817
case 136: {
818
819
820
821
822
  AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
  node->newToken = loc(1);
  sym(1).Node = node;
} break;

823
case 137: {
824
825
826
827
828
829
  AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
  node->lparenToken = loc(2);
  node->rparenToken = loc(4);
  sym(1).Node = node;
} break;

830
case 138: {
831
832
833
834
835
836
  AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
  node->lparenToken = loc(2);
  node->rparenToken = loc(4);
  sym(1).Node = node;
} break;

837
case 139: {
838
839
840
841
842
843
  AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
  node->lbracketToken = loc(2);
  node->rbracketToken = loc(4);
  sym(1).Node = node;
} break;

844
case 140: {
845
846
847
848
849
850
  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
  node->dotToken = loc(2);
  node->identifierToken = loc(3);
  sym(1).Node = node;
} break;

851
case 141: {
852
853
854
  sym(1).Node = 0;
} break;

855
case 142: {
856
857
858
  sym(1).Node = sym(1).ArgumentList->finish();
} break;

859
case 143: {
860
861
862
  sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
} break;

863
case 144: {
864
865
866
867
868
  AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
  node->commaToken = loc(2);
  sym(1).Node = node;
} break;

869
case 148: {
870
871
872
873
874
  AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
  node->incrementToken = loc(2);
  sym(1).Node = node;
} break;

875
case 149: {
876
877
878
879
880
  AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
  node->decrementToken = loc(2);
  sym(1).Node = node;
} break;

881
case 151: {
882
883
884
885
886
  AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
  node->deleteToken = loc(1);
  sym(1).Node = node;
} break;

887
case 152: {
888
889
890
891
892
  AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
  node->voidToken = loc(1);
  sym(1).Node = node;
} break;

893
case 153: {
894
895
896
897
898
  AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
  node->typeofToken = loc(1);
  sym(1).Node = node;
} break;

899
case 154: {
900
901
902
903
904
  AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
  node->incrementToken = loc(1);
  sym(1).Node = node;
} break;

905
case 155: {
906
907
908
909
910
  AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
  node->decrementToken = loc(1);
  sym(1).Node = node;
} break;

911
case 156: {
912
913
914
915
916
  AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
  node->plusToken = loc(1);
  sym(1).Node = node;
} break;

917
case 157: {
918
919
920
921
922
  AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
  node->minusToken = loc(1);
  sym(1).Node = node;
} break;

923
case 158: {
924
925
926
927
928
  AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
  node->tildeToken = loc(1);
  sym(1).Node = node;
} break;

929
case 159: {
930
931
932
933
934
  AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
  node->notToken = loc(1);
  sym(1).Node = node;
} break;

935
case 161: {
936
937
938
939
940
941
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Mul, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

942
case 162: {
943
944
945
946
947
948
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Div, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

949
case 163: {
950
951
952
953
954
955
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Mod, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

956
case 165: {
957
958
959
960
961
962
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Add, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

963
case 166: {
964
965
966
967
968
969
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Sub, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

970
case 168: {
971
972
973
974
975
976
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::LShift, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

977
case 169: {
978
979
980
981
982
983
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::RShift, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

984
case 170: {
985
986
987
988
989
990
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::URShift, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

991
case 172: {
992
993
994
995
996
997
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Lt, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

998
case 173: {
999
1000
1001
1002
1003
1004
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Gt, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1005
case 174: {
1006
1007
1008
1009
1010
1011
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Le, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1012
case 175: {
1013
1014
1015
1016
1017
1018
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Ge, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1019
case 176: {
1020
1021
1022
1023
1024
1025
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::InstanceOf, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1026
case 177: {
1027
1028
1029
1030
1031
1032
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::In, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1033
case 179: {
1034
1035
1036
1037
1038
1039
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Lt, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1040
case 180: {
1041
1042
1043
1044
1045
1046
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Gt, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1047
case 181: {
1048
1049
1050
1051
1052
1053
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Le, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1054
case 182: {
1055
1056
1057
1058
1059
1060
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
   QSOperator::Ge, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1061
case 183: {
1062
1063
1064
1065
1066
1067
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::InstanceOf, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1068
case 185: {
1069
1070
1071
1072
1073
1074
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::Equal, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1075
case 186: {
1076
1077
1078
1079
1080
1081
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::NotEqual, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1082
case 187: {
1083
1084
1085
1086
1087
1088
  AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
    QSOperator::StrictEqual, sym(3).Expression);
  node->operatorToken = loc(2);
  sym(1).Node = node;
} break;

1089
case 188: {
1090
1091
1092
1093