Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23250/F:/nice/src/bossa/syntax
Modified Files:
Arguments.java Contract.java FormalParameters.java
NiceClass.java loop.nice
Log Message:
Parser cleanup.
Index: FormalParameters.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** FormalParameters.java 30 Jun 2004 14:12:37 -0000 1.41
--- FormalParameters.java 13 Oct 2004 20:42:21 -0000 1.42
***************
*** 259,262 ****
--- 259,274 ----
}
+ public static Parameter createParameter(Monotype type, LocatedString name,
+ Expression defaultValue)
+ {
+ if (defaultValue != null)
+ return new OptionalParameter(type, name, defaultValue);
+
+ if (name != null)
+ return new NamedParameter(type, name);
+
+ return new Parameter(type);
+ }
+
/****************************************************************
* Main class
Index: Contract.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Contract.java 5 Aug 2004 10:45:29 -0000 1.9
--- Contract.java 13 Oct 2004 20:42:21 -0000 1.10
***************
*** 25,28 ****
--- 25,42 ----
public class Contract
{
+ public void addElement(Expression condition, Expression name, boolean
precond)
+ {
+ if (precond)
+ {
+ if (name == null) addRequire(condition);
+ else addRequire(condition, name);
+ }
+ else
+ {
+ if (name == null) addEnsure(condition);
+ else addEnsure(condition, name);
+ }
+ }
+
public void addRequire(Expression condition)
{
Index: loop.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** loop.nice 13 Aug 2004 21:04:41 -0000 1.4
--- loop.nice 13 Oct 2004 20:42:21 -0000 1.5
***************
*** 110,117 ****
}
! public LoopStmt createForLoop
! (Expression test, Statement update, Statement body)
{
! return new LoopStmt(whileExp:test, loopBody: body, iterationStatements:
update, testFirst: true);
}
--- 110,118 ----
}
! public Statement createForLoop
! (Expression test, Statement update, Statement body, List<Statement> inits)
{
! inits.add(new LoopStmt(whileExp:test, loopBody: body, iterationStatements:
update, testFirst: true));
! return createBlock(inits);
}
Index: NiceClass.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** NiceClass.java 9 Oct 2004 09:28:41 -0000 1.87
--- NiceClass.java 13 Oct 2004 20:42:21 -0000 1.88
***************
*** 473,477 ****
public void setInitializers(List inits)
{
! initializers = (Statement[]) inits.toArray(new Statement[inits.size()]);
}
--- 473,478 ----
public void setInitializers(List inits)
{
! if (inits != null)
! initializers = (Statement[]) inits.toArray(new Statement[inits.size()]);
}
Index: Arguments.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** Arguments.java 8 Aug 2004 21:51:54 -0000 1.25
--- Arguments.java 13 Oct 2004 20:42:21 -0000 1.26
***************
*** 62,65 ****
--- 62,71 ----
}
+ public static Arguments singleArgument(Expression value)
+ {
+ Argument[] args = {new Argument(value)};
+ return new Arguments(args);
+ }
+
public void addReceiver(Expression value)
{
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
|