[Nice-commit] Nice/src/bossa/parser Parser.jj,1.147,1.148
Brought to you by:
bonniot
|
From: <ar...@us...> - 2003-03-11 17:14:45
|
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv24309a/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Added the 'for in' loop.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.147
retrieving revision 1.148
diff -C2 -d -r1.147 -r1.148
*** Parser.jj 8 Mar 2003 13:32:14 -0000 1.147
--- Parser.jj 11 Mar 2003 17:14:38 -0000 1.148
***************
*** 2532,2550 ****
Statement ForStatement() :
! { Statement init=null,update=null,body,loop; Expression cond=null; }
{
! "for" "(" ( init=ForInit() | ";" )
[ cond=Expression() ] ";" [ update=StatementExpressionList() ] ")"
body=Statement()
! {
! loop=LoopStmt.forLoop(cond,update,body);
! if(init==null)
! return loop;
! List l = new LinkedList();
! l.add(init);
! l.add(loop);
! return new Block(l);
! }
}
--- 2532,2564 ----
Statement ForStatement() :
! { Statement init=null,update=null,body,loop,block; Expression cond=null; }
{
! "for" "("
! (
! LOOKAHEAD( monotype() <IDENT> ":" ) block=ForInStatement()
! |
! ( init=ForInit() | ";" )
[ cond=Expression() ] ";" [ update=StatementExpressionList() ] ")"
body=Statement()
! {
! loop=LoopStmt.forLoop(cond,update,body);
! if(init==null)
! return loop;
!
! List l = new LinkedList();
! l.add(init);
! l.add(loop);
! block = new Block(l);
! }
! )
! { return block; }
! }
! Statement ForInStatement() :
! { Statement body; Monotype vartype; LocatedString var; Expression container; Token t; }
! {
! vartype=monotype() var=ident() t=":" container=Expression() ")"
! body=Statement()
! {return LoopStmt.forInLoop(vartype,var,new Location(t),container,body); }
}
|