[Nice-commit] Nice/src/bossa/parser Parser.jj,1.254,1.255
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-08-08 21:52:17
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29035/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted block and local variables to nice code. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** Parser.jj 7 Aug 2004 14:20:28 -0000 1.254 --- Parser.jj 8 Aug 2004 21:51:54 -0000 1.255 *************** *** 835,839 **** type=monotype() id=ident() { monotypes.add(type); ! statements.add(new Block.LocalVariable(id, type, false, null)); return new IdentExp(id); } | { Token first,last; } --- 835,839 ---- type=monotype() id=ident() { monotypes.add(type); ! statements.add(bossa.syntax.dispatch.createLocalVariable(id, type, false, null)); return new IdentExp(id); } | { Token first,last; } *************** *** 931,935 **** { return NiceMethod.create(c, name, cst, returnType, parameters, ! body != null ? new Block(statements) : null, contract, isOverride); } } --- 931,935 ---- { return NiceMethod.create(c, name, cst, returnType, parameters, ! body != null ? bossa.syntax.dispatch.createBlock(statements) : null, contract, isOverride); } } *************** *** 1122,1126 **** ) { ! return CustomConstructor.make(name, cst, params, new Block(statements)); } } --- 1122,1126 ---- ) { ! return CustomConstructor.make(name, cst, params, bossa.syntax.dispatch.createBlock(statements)); } } *************** *** 1363,1367 **** { List statements = new LinkedList(); statements.add(res); ! return new Block(statements); } ) ) --- 1363,1367 ---- { List statements = new LinkedList(); statements.add(res); ! return bossa.syntax.dispatch.createBlock(statements); } ) ) *************** *** 1426,1430 **** { res = NiceMethod.WithDefault.create (name, cst, returnType, parameters, ! body != null ? new Block(statements) : null, contract, isOverride); } --- 1426,1430 ---- { res = NiceMethod.WithDefault.create (name, cst, returnType, parameters, ! body != null ? bossa.syntax.dispatch.createBlock(statements) : null, contract, isOverride); } *************** *** 1799,1803 **** ) { statements.add(body); ! return bossa.syntax.dispatch.createFunExp(cst, formals, new Block(statements)); } } --- 1799,1803 ---- ) { statements.add(body); ! return bossa.syntax.dispatch.createFunExp(cst, formals, bossa.syntax.dispatch.createBlock(statements)); } } *************** *** 2307,2311 **** } ! ExpLocalVariable ExpLocalVariable(): { boolean constant = false; --- 2307,2311 ---- } ! Expression ExpLocalVariable(): { boolean constant = false; *************** *** 2320,2324 **** "=" value=Expression() ! { return new ExpLocalVariable(name, value, constant, type); } } --- 2320,2324 ---- "=" value=Expression() ! { return bossa.syntax.dispatch.createExpLocalVariable(name, value, constant, type); } } *************** *** 2407,2411 **** } ! Block Block() : { Token first, last; Statement s; List statements; } { --- 2407,2411 ---- } ! Statement Block() : { Token first, last; Statement s; List statements; } { *************** *** 2417,2421 **** { last = getToken(0); ! Block res = new Block(statements); res.setLocation(makeLocation(first, last)); return res; --- 2417,2421 ---- { last = getToken(0); ! Statement res = bossa.syntax.dispatch.createBlock(statements); res.setLocation(makeLocation(first, last)); return res; *************** *** 2453,2457 **** boolean constant = false; Token t = null; ! Block.LocalValue res; } { --- 2453,2457 ---- boolean constant = false; Token t = null; ! Statement res; } { *************** *** 2464,2470 **** id=ident() [ "=" e=Expression() ] ! { res = Block.createLocalVariable(id,type,constant,e); } ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* { return res; } --- 2464,2470 ---- id=ident() [ "=" e=Expression() ] ! { res = bossa.syntax.dispatch.createLocalVariable(id,type,constant,e); } ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { bossa.syntax.dispatch.addNextLocal(res,id,e); } )* { return res; } *************** *** 2487,2491 **** "(" parameters=formalParameters(false, statements) ")" body=code() { statements.add(body); } ! { return Block.LocalFunction.make(id, type, parameters, body!=null?new Block(statements):null); } } --- 2487,2491 ---- "(" parameters=formalParameters(false, statements) ")" body=code() { statements.add(body); } ! { return bossa.syntax.dispatch.createLocalFunction(id, type, parameters, body!=null?bossa.syntax.dispatch.createBlock(statements):null); } } *************** *** 2514,2518 **** | //then look for a monotype without matching a tuplePart LOOKAHEAD( monotype() ident() ) type=monotype() id=ident() ! { statements.add(new Block.LocalVariable(id, type, false, null)); return new IdentExp(id); } | //otherwise it's localtuple part --- 2514,2518 ---- | //then look for a monotype without matching a tuplePart LOOKAHEAD( monotype() ident() ) type=monotype() id=ident() ! { statements.add(bossa.syntax.dispatch.createLocalVariable(id, type, false, null)); return new IdentExp(id); } | //otherwise it's localtuple part *************** *** 2716,2720 **** Statement ForStatement() : ! { Block update = null; Statement loop = null, body, statexp; Expression cond = null; --- 2716,2720 ---- Statement ForStatement() : ! { Statement update = null; Statement loop = null, body, statexp; Expression cond = null; *************** *** 2740,2744 **** l.addAll(init); l.add(loop); ! loop = new Block(l); } ) --- 2740,2744 ---- l.addAll(init); l.add(loop); ! loop = bossa.syntax.dispatch.createBlock(l); } ) *************** *** 2768,2772 **** } ! Block StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { --- 2768,2772 ---- } ! Statement StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { *************** *** 2774,2778 **** ( "," s=ShortStatementExpression() { statements.add(s); } )* ! { return new Block(statements); } } --- 2774,2778 ---- ( "," s=ShortStatementExpression() { statements.add(s); } )* ! { return bossa.syntax.dispatch.createBlock(statements); } } |