Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv27922/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
make 'fun' optional in combination with constraint so <Any T>(T x)=>x is a valid alternative for fun<Any T>(T x)=>x .
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -d -r1.138 -r1.139
*** Parser.jj 19 Feb 2003 09:59:50 -0000 1.138
--- Parser.jj 19 Feb 2003 21:16:30 -0000 1.139
***************
*** 1544,1568 ****
List formals;
Constraint cst;
- Statement body;
- Expression exp;
Token f = null;
}
{
! f = "fun"
cst=constraint()
"(" formals=monoSymbols() ")"
! "=>"
! (
! body=Block()
! |
! exp=Expression()
! {
! body=new ReturnStmt(exp);
! }
! )
{
if (f != null)
bossa.util.User.warning(new Location(f), "The 'fun(...) =>' syntax is deprecated, just leave 'fun' away.");
! return new FunExp(cst,formals,body);
}
}
--- 1544,1559 ----
List formals;
Constraint cst;
Token f = null;
+ FunExp res;
}
{
! [f = "fun"]
cst=constraint()
"(" formals=monoSymbols() ")"
! res=endFunExp(formals, cst)
{
if (f != null)
bossa.util.User.warning(new Location(f), "The 'fun(...) =>' syntax is deprecated, just leave 'fun' away.");
! return res;
}
}
***************
*** 1577,1596 ****
sym=monoSymbol()
{ formals = new LinkedList(); formals.add(sym); }
! res=endFunExp(formals)
! { return res; }
! }
!
! FunExp multipleVarsFunExp():
! {
! List formals;
! FunExp res;
! }
! {
! "(" formals=monoSymbols() ")"
! res=endFunExp(formals)
{ return res; }
}
! FunExp endFunExp(List formals):
{
Statement body;
--- 1568,1576 ----
sym=monoSymbol()
{ formals = new LinkedList(); formals.add(sym); }
! res=endFunExp(formals, Constraint.True)
{ return res; }
}
! FunExp endFunExp(List formals, Constraint cst):
{
Statement body;
***************
*** 1610,1614 ****
}
)
! { return new FunExp(Constraint.True,formals,body); }
}
--- 1590,1594 ----
}
)
! { return new FunExp(cst,formals,body); }
}
***************
*** 1765,1771 ****
(
! e1=funExp()
| LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp()
- | LOOKAHEAD("(" monoSymbols() ")" "=>") e1=multipleVarsFunExp()
| e1=ClassicExpression()
)
--- 1745,1750 ----
(
! LOOKAHEAD(funExp()) e1=funExp()
| LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp()
| e1=ClassicExpression()
)
|