comparison trunk/src/Parser.d @ 266:fea4e8b6cea5

- Added begin variables and calls to set().
author aziz
date Sat, 04 Aug 2007 10:46:03 +0000
parents 3a2a0a63c638
children f3dfa6208ed3
comparison
equal deleted inserted replaced
265:3a2a0a63c638 266:fea4e8b6cea5
376 376
377 Expression parseInitializer() 377 Expression parseInitializer()
378 { 378 {
379 if (token.type == T.Void) 379 if (token.type == T.Void)
380 { 380 {
381 auto begin = token;
381 auto next = peekNext(); 382 auto next = peekNext();
382 if (next == T.Comma || next == T.Semicolon) 383 if (next == T.Comma || next == T.Semicolon)
383 { 384 {
384 nT(); 385 nT();
385 return new VoidInitializer(); 386 return set(new VoidInitializer(), begin);
386 } 387 }
387 } 388 }
388 return parseNonVoidInitializer(); 389 return parseNonVoidInitializer();
389 } 390 }
390 391
391 Expression parseNonVoidInitializer() 392 Expression parseNonVoidInitializer()
392 { 393 {
394 auto begin = token;
393 Expression init; 395 Expression init;
394 switch (token.type) 396 switch (token.type)
395 { 397 {
396 case T.LBracket: 398 case T.LBracket:
397 // ArrayInitializer: 399 // ArrayInitializer:
466 assert(token.type == T.LBrace); 468 assert(token.type == T.LBrace);
467 //goto default; 469 //goto default;
468 default: 470 default:
469 init = parseAssignExpression(); 471 init = parseAssignExpression();
470 } 472 }
473 set(init, begin);
471 return init; 474 return init;
472 } 475 }
473 476
474 FunctionBody parseFunctionBody(FunctionBody func) 477 FunctionBody parseFunctionBody(FunctionBody func)
475 { 478 {