[Nice-commit] Nice/src/bossa/parser Parser.jj,1.144,1.145
Brought to you by:
bonniot
From: <ar...@us...> - 2003-02-25 20:08:06
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv4942/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Rewrite of the pattern part of the parser there are 5 different types of patterns now: name value //value can be false, true, null, integer literal or character literal name@value @type name@type And @null patterns are still allowed but will give a warning. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** Parser.jj 25 Feb 2003 12:19:34 -0000 1.144 --- Parser.jj 25 Feb 2003 20:08:00 -0000 1.145 *************** *** 1190,1226 **** Pattern pattern(): { ! Pattern res = null; ! Expression val = null; ! LocatedString i; ! } ! { ! ( res = anonymousPattern(null) ! | val = patternLiteral() { res = new Pattern(null,null,val,false,null,null,val.location()); } ! | i = ident() ! ( res = anonymousPattern(i) | { res = new Pattern(i); } ) ! ) ! { return res; } ! } ! ! Pattern anonymousPattern(LocatedString name): ! { TypeIdent tc=null, additional = null; Monotype type=null; Expression val = null; boolean exactlyAt = false; ! Token t; } { ! ( ! t="@" ( val=patternLiteral() | tc=typeIdent() ) ! | ! t="#" tc=typeIdent() { exactlyAt = true; } ) ! [ "(" additional = typeIdent() ")" ] [ ":" type=monotype() ] ! { ! Location loc = name != null ? name.location() ! : tc != null ? tc.location() : new Location(t); ! return new Pattern(name, tc, val, exactlyAt, additional, type, loc); } } --- 1190,1240 ---- Pattern pattern(): { ! LocatedString name = null; ! Token t; TypeIdent tc=null, additional = null; Monotype type=null; Expression val = null; boolean exactlyAt = false; ! Location loc = null; } { ! ( ! val=patternLiteral() { loc = val.location(); } ! | ! ( ! t="@" ! | ! t="#" { exactlyAt = true;} ! ) ! ( ! tc=typeIdent() { loc = tc.location(); } ! | ! //temporarily added to warn the user about the deprecated '@null' syntax. ! t="null" ! { val = NullExp.instance; ! loc = new Location(t); ! User.warning(loc,"The '@null' syntax is deprecated, leave the '@' away."); ! } ! ) ! | ! name = ident() ! ( ! t ="@" ! ( ! val=patternLiteral() ! | ! tc=typeIdent() ! ) ! | ! t ="#" tc=typeIdent() { exactlyAt = true; } ! | ! {} //name only ! ) ! { loc = name.location(); } ) ! [ "(" additional=typeIdent() ")" ] [ ":" type=monotype() ] ! { ! return new Pattern(name, tc, val, exactlyAt, additional, type, loc); } } |