[Nice-commit] Nice/src/bossa/parser Parser.jj,1.309,1.310
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-02-22 10:28:11
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/src/bossa/parser Modified Files: Parser.jj Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.309 retrieving revision 1.310 diff -C2 -d -r1.309 -r1.310 *** Parser.jj 21 Feb 2005 12:44:54 -0000 1.309 --- Parser.jj 22 Feb 2005 10:27:10 -0000 1.310 *************** *** 2376,2380 **** LOOKAHEAD(2) res=LabeledStatement() ! | res=Block() | res=RealStatementExpression() | res=IfStatement() --- 2376,2380 ---- LOOKAHEAD(2) res=LabeledStatement() ! | res=AlwaysBlock() | res=RealStatementExpression() | res=IfStatement() *************** *** 2420,2423 **** --- 2420,2437 ---- Statement Block() : + { Statement res; } + { + res = _Block(false) + { return res; } + } + + Statement AlwaysBlock() : + { Statement res; } + { + res = _Block(true) + { return res; } + } + + Statement _Block(boolean always) : { Token first, last; Statement s; List statements; } { *************** *** 2429,2435 **** { last = getToken(0); ! Statement res = bossa.syntax.dispatch.createBlock(statements); ! res.setLocation(makeLocation(first, last)); ! return res; } } --- 2443,2448 ---- { last = getToken(0); ! return bossa.syntax.dispatch.createBlock(statements, always, ! makeLocation(first, last)); } } *************** *** 2728,2732 **** Statement ForStatement() : ! { Block update = null; Statement loop = null, body, statexp; Expression cond = null; --- 2741,2745 ---- Statement ForStatement() : ! { Statement update = null; Statement loop = null, body, statexp; Expression cond = null; *************** *** 2774,2778 **** } ! Block StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { --- 2787,2791 ---- } ! Statement StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { |