comparison trunk/src/Parser.d @ 88:81cb24669ed3

- Fixed parser of AssocArrayLiteralExpression. - Fixed parseArgumentList().
author aziz
date Thu, 05 Jul 2007 20:14:01 +0000
parents c9544b7d5c7d
children 18c71269fb52
comparison
equal deleted inserted replaced
87:c9544b7d5c7d 88:81cb24669ed3
464 keys ~= e; 464 keys ~= e;
465 nT(); // Skip colon. 465 nT(); // Skip colon.
466 values ~= parseAssignExpression(); 466 values ~= parseAssignExpression();
467 467
468 if (token.type != T.RBracket) 468 if (token.type != T.RBracket)
469 {
470 require(T.Comma);
469 while (1) 471 while (1)
470 { 472 {
471 keys ~= parseAssignExpression(); 473 keys ~= parseAssignExpression();
472 if (token.type != T.Colon) 474 if (token.type != T.Colon)
473 { 475 {
480 } 482 }
481 nT(); 483 nT();
482 values ~= parseAssignExpression(); 484 values ~= parseAssignExpression();
483 if (token.type == T.RBracket) 485 if (token.type == T.RBracket)
484 break; 486 break;
485 errorIfNot(T.Comma); 487 require(T.Comma);
486 } 488 }
489 }
487 assert(token.type == T.RBracket); 490 assert(token.type == T.RBracket);
488 nT(); 491 nT();
489 e = new AssocArrayLiteralExpression(keys, values); 492 e = new AssocArrayLiteralExpression(keys, values);
490 break; 493 break;
491 case T.LBrace: 494 case T.LBrace:
528 case T.Void, T.Char, T.Wchar, T.Dchar, T.Bool, T.Byte, T.Ubyte, 531 case T.Void, T.Char, T.Wchar, T.Dchar, T.Bool, T.Byte, T.Ubyte,
529 T.Short, T.Ushort, T.Int, T.Uint, T.Long, T.Ulong, 532 T.Short, T.Ushort, T.Int, T.Uint, T.Long, T.Ulong,
530 T.Float, T.Double, T.Real, T.Ifloat, T.Idouble, T.Ireal, 533 T.Float, T.Double, T.Real, T.Ifloat, T.Idouble, T.Ireal,
531 T.Cfloat, T.Cdouble, T.Creal: 534 T.Cfloat, T.Cdouble, T.Creal:
532 TOK type = token.type; 535 TOK type = token.type;
536
533 requireNext(T.Dot); 537 requireNext(T.Dot);
534 538
535 string ident; 539 string ident;
536 errorIfNot(T.Identifier);
537 if (token.type == T.Identifier) 540 if (token.type == T.Identifier)
538 { 541 {
539 ident = token.srcText; 542 ident = token.srcText;
540 nT(); 543 nT();
541 } 544 }
545 else
546 errorIfNot(T.Identifier);
542 547
543 e = new TypeDotIdExpression(type, ident); 548 e = new TypeDotIdExpression(type, ident);
544 default: 549 default:
545 } 550 }
546 return e; 551 return e;
565 while (1) 570 while (1)
566 { 571 {
567 es ~= parseAssignExpression(); 572 es ~= parseAssignExpression();
568 if (token.type == terminator) 573 if (token.type == terminator)
569 break; 574 break;
570 errorIfNot(T.Comma); 575 require(T.Comma);
571 } 576 }
572 nT(); 577 nT();
573 return es; 578 return es;
574 } 579 }
575 580