~ubuntu-branches/ubuntu/trusty/kdevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to languages/cpp/parser/parser.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2013-12-09 18:54:59 UTC
  • mfrom: (1.7.19)
  • Revision ID: package-import@ubuntu.com-20131209185459-zlxv7jo7up8gthne
Tags: 4:4.6.0-0ubuntu1
* New upstream release (LP: #1259220)
* Update install files 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1132
1132
  const ListNode<uint> *cv = 0;
1133
1133
  parseCvQualify(cv);
1134
1134
 
1135
 
#if defined(__GNUC__)
1136
 
#warning "implement me"
1137
 
#endif
1138
1135
  skip('(', ')');
1139
1136
  advance();
1140
1137
  ADVANCE(';', ";");
1226
1223
    case '<':
1227
1224
    case '>':
1228
1225
    case ',':
1229
 
    case Token_assign:
1230
1226
    case Token_leftshift:
1231
1227
    case Token_rightshift:
1232
1228
    case Token_eq:
1233
1229
    case Token_not:
1234
1230
    case Token_not_eq:
 
1231
    case Token_and_eq:
 
1232
    case Token_or_eq:
 
1233
    case Token_xor_eq:
 
1234
    case Token_leftshift_eq:
 
1235
    case Token_rightshift_eq:
 
1236
    case Token_div_eq:
 
1237
    case Token_star_eq:
 
1238
    case Token_plus_eq:
 
1239
    case Token_minus_eq:
 
1240
    case Token_remainder_eq:
1235
1241
    case Token_leq:
1236
1242
    case Token_geq:
1237
1243
    case Token_and:
2027
2033
 
2028
2034
bool Parser::parseTypeId(TypeIdAST *&node)
2029
2035
{
2030
 
  /// @todo implement the AST for typeId
2031
2036
  uint start = session->token_stream->cursor();
2032
2037
 
2033
2038
  TypeSpecifierAST *spec = 0;
2103
2108
      advance();
2104
2109
    }
2105
2110
 
2106
 
  /// @todo add ellipsis
2107
2111
  UPDATE_POS(ast, start, _M_last_valid_token+1);
2108
2112
  node = ast;
2109
2113
 
4020
4024
 
4021
4025
      ADVANCE(';', ";");
4022
4026
 
4023
 
#if defined(__GNUC__)
4024
 
#warning "mark the ast as constant"
4025
 
#endif
4026
4027
      SimpleDeclarationAST *ast = CreateNode<SimpleDeclarationAST>(session->mempool);
4027
4028
      ast->init_declarators = declarators;
4028
4029
 
5240
5241
  else if (!parseConditionalExpression(node))
5241
5242
    return false;
5242
5243
 
5243
 
  while (session->token_stream->lookAhead() == Token_assign
5244
 
         || session->token_stream->lookAhead() == '=')
 
5244
  while ( token_is_assignment(session->token_stream->lookAhead()) )
5245
5245
    {
5246
5246
      uint op = session->token_stream->cursor();
5247
5247
      advance();
5323
5323
    uint start = session->token_stream->cursor();
5324
5324
    QPropertyDeclarationAST *ast = CreateNode<QPropertyDeclarationAST>(session->mempool);
5325
5325
 
 
5326
    ast->member = 0;
5326
5327
    ast->getter = 0;
5327
5328
    ast->setter = 0;
5328
5329
    ast->resetter = 0;
5329
5330
    ast->notifier = 0;
5330
5331
    ast->designableMethod = 0;
5331
 
    ast->designableValue = true;
5332
5332
    ast->scriptableMethod = 0;
5333
 
    ast->scriptableValue = true;
5334
 
    ast->stored = true;
5335
 
    ast->user = false;
5336
 
    ast->constant = false;
5337
 
    ast->final = false;
5338
 
 
5339
5333
 
5340
5334
    CHECK(Token___qt_property__);
5341
5335
    CHECK('(');
5350
5344
    if(!parseName(ast->name))
5351
5345
      return false;
5352
5346
 
 
5347
    static KDevelop::IndexedString memberStr("MEMBER");
5353
5348
    static KDevelop::IndexedString readStr("READ");
5354
5349
    static KDevelop::IndexedString writeStr("WRITE");
5355
5350
    static KDevelop::IndexedString resetStr("RESET");
5356
5351
    static KDevelop::IndexedString notifyStr("NOTIFY");
 
5352
    static KDevelop::IndexedString revisionStr("REVISION");
5357
5353
    static KDevelop::IndexedString designableStr("DESIGNABLE");
5358
5354
    static KDevelop::IndexedString scriptableStr("SCRIPTABLE");
5359
5355
    static KDevelop::IndexedString storedStr("STORED");
5363
5359
 
5364
5360
    while(session->token_stream->lookAhead() != ')') {
5365
5361
      const KDevelop::IndexedString propertyField = session->token_stream->symbol(session->token_stream->cursor());
5366
 
      if(propertyField == readStr) {
 
5362
      if (propertyField == memberStr) {
 
5363
        advance(); // skip MEMBER
 
5364
        if (!parseName(ast->member))
 
5365
          return false;
 
5366
      } else if(propertyField == readStr) {
5367
5367
        advance(); // skip READ
5368
5368
        if(!parseName(ast->getter))
5369
5369
          return false;
5379
5379
        advance(); // skip NOTIFY
5380
5380
        if(!parseName(ast->notifier))
5381
5381
          return false;
5382
 
      }else if(propertyField == designableStr){
 
5382
      } else if (propertyField == revisionStr) {
 
5383
        advance(); // skip REVISION
 
5384
        if (session->token_stream->lookAhead() == Token_number_literal) {
 
5385
          advance();
 
5386
        } else {
 
5387
          return false;
 
5388
        }
 
5389
      } else if(propertyField == designableStr){
5383
5390
        advance(); // skip DESIGNABLE
5384
5391
        if(session->token_stream->lookAhead() == Token_true){
5385
5392
          advance(); // skip 'true'
5386
 
          ast->designableValue = true;
5387
5393
        }else if(session->token_stream->lookAhead() == Token_false){
5388
5394
          advance(); // skip 'false'
5389
 
          ast->designableValue = false;
5390
5395
        }else{
5391
5396
          if(!parseName(ast->designableMethod))
5392
5397
            return false;
5395
5400
        advance(); // skip SCRIPTABLE
5396
5401
        if(session->token_stream->lookAhead() == Token_true){
5397
5402
          advance(); // skip 'true'
5398
 
          ast->scriptableValue = true;
5399
5403
        }else if(session->token_stream->lookAhead() == Token_false){
5400
5404
          advance(); // skip 'false'
5401
 
          ast->scriptableValue = false;
5402
5405
        }else{
5403
5406
          if(!parseName(ast->scriptableMethod))
5404
5407
            return false;
5407
5410
        advance(); // skip STORED
5408
5411
        if(session->token_stream->lookAhead() == Token_true){
5409
5412
          advance(); // skip 'true'
5410
 
          ast->stored = true;
5411
5413
        }else if(session->token_stream->lookAhead() == Token_false){
5412
5414
          advance(); // skip 'false'
5413
 
          ast->stored = false;
5414
5415
        }else{
5415
5416
          return false;
5416
5417
        }
5418
5419
        advance(); // skip USER
5419
5420
        if(session->token_stream->lookAhead() == Token_true){
5420
5421
          advance(); // skip 'true'
5421
 
          ast->user = true;
5422
5422
        }else if(session->token_stream->lookAhead() == Token_false){
5423
5423
          advance(); // skip 'false'
5424
 
          ast->user = false;
5425
5424
        }else{
5426
5425
          return false;
5427
5426
        }
5428
5427
      }else if(propertyField == constantStr){
5429
5428
        advance(); // skip CONSTANT
5430
 
        ast->constant = true;
5431
5429
      }else if(propertyField == finalStr){
5432
5430
        advance(); // skip FINAL
5433
 
        ast->final = true;
5434
5431
      }else{
5435
5432
        return false;
5436
5433
      }