Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv1080/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Parsing part for custom constructors.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.222
retrieving revision 1.223
diff -C2 -d -r1.222 -r1.223
*** Parser.jj 4 Dec 2003 23:44:32 -0000 1.222
--- Parser.jj 12 Dec 2003 14:55:01 -0000 1.223
***************
*** 1067,1070 ****
--- 1067,1100 ----
}
+ CustomConstructor customConstructor():
+ {
+ LocatedString name;
+ Block block;
+ FormalParameters params;
+ List statements = new LinkedList();
+ Expression exp;
+ Statement stmt;
+ }
+ {
+ "new" name=ident() "(" params=formalParameters(false, statements) ")"
+ (
+ "=" exp=Expression() ";" { statements.add(new ExpressionStmt(exp)); }
+ |
+ "{"
+ ( stmt=BlockStatement(statements) { statements.add(stmt); } )+
+ "}"
+ |
+ ";"
+ )
+ {
+ if (statements.isEmpty())
+ block = null;
+ else
+ block = new Block(statements);
+
+ return new CustomConstructor(name, params, block);
+ }
+ }
+
AbstractInterface interfaceDefinition(Constraint prefix):
{
***************
*** 1483,1487 ****
|
[ "public" | "private" ]
! ( res=globalVariable()
| res=enumDefinition(definitions)
| { Constraint cst; } cst = constraint()
--- 1513,1518 ----
|
[ "public" | "private" ]
! ( res=customConstructor()
! | res=globalVariable()
| res=enumDefinition(definitions)
| { Constraint cst; } cst = constraint()
|