[Nice-commit] Nice/src/bossa/parser Parser.jj,1.197,1.198
Brought to you by:
bonniot
From: <ar...@us...> - 2003-07-19 00:54:08
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv32228/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Moved a few things out of the parser, it improves some error messages as side-effect. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.197 retrieving revision 1.198 diff -C2 -d -r1.197 -r1.198 *** Parser.jj 18 Jul 2003 22:56:49 -0000 1.197 --- Parser.jj 19 Jul 2003 00:54:05 -0000 1.198 *************** *** 909,919 **** | "private-write" | ( ("public" | "private" | {} ) ! [ ( "final" | t="const" ) ! { isFinal=true; ! if (t!=null) ! User.warning(Location.make(t), ! "'const' is deprecated. Use 'final' instead."); ! } ! ] ) ) --- 909,913 ---- | "private-write" | ( ("public" | "private" | {} ) ! [ "final" { isFinal=true; } ] ) ) *************** *** 1363,1388 **** Monotype t; Expression value=null; ! boolean constant; } { ! ( ! "var" {constant = false;} ! t=monotype() name=ident() ! [ "=" ! ( ! LOOKAHEAD(funExpLookahead()) value=funExp() ! | ! value=SideEffectFreeExpression() ! ) ! ] ! | ! "let" {constant = true;} ! t=monotype() name=ident() "=" ! ( ! LOOKAHEAD(funExpLookahead()) value=funExp() | value=SideEffectFreeExpression() ) ! ) ";" { return new GlobalVarDeclaration(name,t,value,constant); } --- 1357,1372 ---- Monotype t; Expression value=null; ! boolean constant = true; } { ! ( "var" {constant = false;} | "let" ) ! t=monotype() name=ident() ! [ "=" ! ( LOOKAHEAD(funExpLookahead()) ! value=funExp() | value=SideEffectFreeExpression() ) ! ] ";" { return new GlobalVarDeclaration(name,t,value,constant); } *************** *** 2228,2234 **** { ( ! LOOKAHEAD( "final" | "const" | "var" | "let" | monotype() <IDENT>) ( ! LOOKAHEAD( [ "final" | "const" | "var" | "let" ] monotype() <IDENT> "(" ) res = LocalFunctionDeclaration() | --- 2212,2218 ---- { ( ! LOOKAHEAD( "var" | "let" | monotype() <IDENT>) ( ! LOOKAHEAD( [ "var" | "let" ] monotype() <IDENT> "(" ) res = LocalFunctionDeclaration() | *************** *** 2252,2293 **** LocatedString id; Expression e = null; ! boolean constant = true; Token t = null; Block.LocalValue res; } { ! ( LOOKAHEAD ( monotype() ident() ) type=monotype() - id=ident() - [ "=" e=Expression() ] - { res = new Block.LocalVariable(id,type,false,e); } - ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) - "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* | ! ( ! (t="final" | t="const") ! {User.warning(Location.make(t), ! "'"+t.toString()+"' is deprecated. Use 'let' instead."); ! } ! | "let" ! | "var" {constant = false;} ! ) ! ( LOOKAHEAD ( <IDENT> "=" ) ! id=ident() ! "=" e=Expression() ! { if (constant) { res = new Block.LocalConstant(id,e);} ! else { res = new Block.LocalVariable(id, null, constant, e);} ! } ! ( LOOKAHEAD( "," <IDENT> "=" ) ! "," id=ident() "=" e=Expression() { res.addNext(id,e); } )* ! | ! type=monotype() ! id=ident() ! [ "=" e=Expression() ] ! { res = new Block.LocalVariable(id,type,constant,e); } ! ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* ! ) ) { return res; } } --- 2236,2256 ---- LocatedString id; Expression e = null; ! boolean constant = false; Token t = null; Block.LocalValue res; } { ! ( type=monotype() | ! ( "var" | "let" {constant = true;} ) ! [ LOOKAHEAD ( monotype() <IDENT> ) type=monotype() ] ) + 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; } } *************** *** 2299,2316 **** FormalParameters parameters; Statement body; ! boolean constant = true; Token t = null; List statements = new LinkedList(); } { ! ( ! (t="final" | t="const") ! {User.warning(Location.make(t), ! "'"+t.toString()+"' is deprecated. Use 'let' instead."); ! } ! | "let" ! | "var" {constant = false;} ! | {constant = false;} ! ) type = monotype() id=ident() --- 2262,2271 ---- FormalParameters parameters; Statement body; ! boolean constant = false; Token t = null; List statements = new LinkedList(); } { ! [ "let" {constant = true;} | "var" ] type = monotype() id=ident() *************** *** 2318,2322 **** body=code() { statements.add(body); } { return Block.LocalFunction.make(id, type, parameters, body!=null?new Block(statements):null); } - } --- 2273,2276 ---- *************** *** 2507,2511 **** LOOKAHEAD( monotype() <IDENT> ":" ) loop=ForInStatement() | ( ! LOOKAHEAD( "final" | "const" | "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() | statexp=StatementExpression() ";" {init.add(statexp);} --- 2461,2465 ---- LOOKAHEAD( monotype() <IDENT> ":" ) loop=ForInStatement() | ( ! LOOKAHEAD( "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() | statexp=StatementExpression() ";" {init.add(statexp);} |