Nice/src/bossa/parser Parser.jj,1.309,1.310

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
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(); }
  {



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.