[Nice-commit] Nice/src/bossa/syntax Block.java,1.62,1.63 BreakLabelStmt.java,1.1,1.2 BreakStmt.java,
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv11167/F:/nice/src/bossa/syntax Modified Files: Block.java BreakLabelStmt.java BreakStmt.java ContinueStmt.java LoopStmt.java ReturnStmt.java Log Message: Fix printing to .nicei of looping constructs. Index: Block.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Block.java 11 Sep 2003 15:44:20 -0000 1.62 --- Block.java 29 Sep 2003 23:22:44 -0000 1.63 *************** *** 411,415 **** return "{\n" + Util.map("",";\n",";\n",locals) ! + Util.map("",";\n",";\n",statements) + "}\n"; } --- 411,415 ---- return "{\n" + Util.map("",";\n",";\n",locals) ! + Util.map("","\n","\n",statements) + "}\n"; } Index: BreakLabelStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/BreakLabelStmt.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BreakLabelStmt.java 28 Jan 2002 20:28:39 -0000 1.1 --- BreakLabelStmt.java 29 Sep 2003 23:22:44 -0000 1.2 *************** *** 36,39 **** --- 36,41 ---- } + public String toString() { return "break " + label + ";"; } + LocatedString label; LabeledStmt statement; Index: BreakStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/BreakStmt.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BreakStmt.java 28 May 2003 12:57:26 -0000 1.5 --- BreakStmt.java 29 Sep 2003 23:22:44 -0000 1.6 *************** *** 34,36 **** --- 34,38 ---- return new gnu.expr.ExitExp(LoopStmt.currentLoopBlock); } + + public String toString() { return "break;"; } } Index: ContinueStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ContinueStmt.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ContinueStmt.java 29 May 2003 14:17:17 -0000 1.3 --- ContinueStmt.java 29 Sep 2003 23:22:44 -0000 1.4 *************** *** 41,44 **** --- 41,48 ---- } + public String toString() + { + return "continue " + (label != null ? label.toString() : "") + ";"; } + LocatedString label; LoopStmt loop; Index: LoopStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LoopStmt.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** LoopStmt.java 8 Aug 2003 21:47:57 -0000 1.17 --- LoopStmt.java 29 Sep 2003 23:22:44 -0000 1.18 *************** *** 165,171 **** public String toString() { ! return ! "for(;" + whileExp + "; " + iterationStatements+ ")\n" + ! (loopBody == null ? ";" : loopBody.toString()); } --- 165,187 ---- public String toString() { ! if (!testFirst) ! return "do {\n" + (loopBody == null ? " " : loopBody.toString()) + ! "}\n while (" + whileExp + ");"; ! ! if (iterationStatements == null) ! return "while (" + whileExp + ")" + ! (loopBody == null ? ";" : loopBody.toString()); ! ! Statement[] itStatements = ((Block)iterationStatements).statements; ! String itStats = ""; ! for(int i = 0; i<itStatements.length; i++) ! { ! String tmp = itStatements[i].toString(); ! itStats += tmp.substring(0, tmp.lastIndexOf(';')); ! if (i<itStatements.length-1) itStats += ", "; ! } ! ! return "for(; " + whileExp + " ;" + itStats + ")\n " + ! (loopBody == null ? "" : loopBody.toString()); } Index: ReturnStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ReturnStmt.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ReturnStmt.java 28 May 2003 12:57:26 -0000 1.29 --- ReturnStmt.java 29 Sep 2003 23:22:44 -0000 1.30 *************** *** 71,75 **** public String toString() { ! return "return" + (value!=null ? " " + value : ""); } --- 71,75 ---- public String toString() { ! return "return" + (value!=null ? " " + value : "") + ";"; } |