[Nice-commit] Nice/src/bossa/parser Parser.jj,1.329,1.330
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-05-25 11:52:43
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18588/src/bossa/parser Modified Files: Parser.jj Log Message: Consistently use '?' to represent the wildcard (unknown monotype). Only accept it in the parser as a type parameter (Object can as well be used to mean "any monotype"). Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.329 retrieving revision 1.330 diff -C2 -d -r1.329 -r1.330 *** Parser.jj 10 Apr 2005 14:57:02 -0000 1.329 --- Parser.jj 25 May 2005 11:52:30 -0000 1.330 *************** *** 225,229 **** | < FALSE: "false" > | < ALIKE: "alike" > /* Nice specific */ - | < UNKNOWN: "unknown" > /* Nice specific */ //| < THIS: "this" > | < SUPER: "super" > --- 225,228 ---- *************** *** 705,709 **** t=typeConstructorIdent() ! "<" [ p=monotypes() ] ">" { if(p==null) p=new ArrayList(0); last=getToken(0); --- 704,708 ---- t=typeConstructorIdent() ! "<" [ p=typeParameters() ] ">" { if(p==null) p=new ArrayList(0); last=getToken(0); *************** *** 824,829 **** { [ - // Consume "?" only if it does not appear by itself - LOOKAHEAD( "?", { getToken(2).kind != COMMA && getToken(2).kind != GT}) start="?" { maybe = true; } | start="!" { sure = true; } --- 823,826 ---- *************** *** 833,837 **** res=funOrTupleMonotype() | ! start="alike" [ "<" p=monotypes() ">" ] { res=bossa.syntax.dispatch.createAlike(p, makeLocation(start)); } { res.nullness = bossa.syntax.fun.nullness_absent; } --- 830,834 ---- res=funOrTupleMonotype() | ! start="alike" [ "<" p=typeParameters() ">" ] { res=bossa.syntax.dispatch.createAlike(p, makeLocation(start)); } { res.nullness = bossa.syntax.fun.nullness_absent; } *************** *** 855,861 **** } { return res; } - | - ("unknown" | "?") - { return new MonotypeWrapper(mlsub.typing.UnknownMonotype.instance); } } --- 852,855 ---- *************** *** 871,874 **** --- 865,891 ---- } + Monotype typeParameter(): + { + Monotype res; + } + { + // Consume "?" only if it appears by itself + LOOKAHEAD( "?", { getToken(2).kind == COMMA || getToken(2).kind == GT}) + "?" { return new MonotypeWrapper(mlsub.typing.UnknownMonotype.instance); } + | + res=monotype() { return res; } + } + + List typeParameters(): + { + List res=new ArrayList(); + Monotype t; + } + { + t=typeParameter() { res.add(t); } + ( "," t=typeParameter() { res.add(t); } )* + { return res; } + } + /***********************************************************************/ /* Visibility */ *************** *** 999,1005 **** { name=typeIdent() ! // ignore type parameters ! // they should be checked ! [ "<" params = monotypes() ">" ] { return bossa.syntax.fun.createMonotypeConstructor(name, params == null ? null : bossa.syntax.dispatch.createTypeParameters(params), name.location()); } } --- 1016,1020 ---- { name=typeIdent() ! [ "<" params = typeParameters() ">" ] { return bossa.syntax.fun.createMonotypeConstructor(name, params == null ? null : bossa.syntax.dispatch.createTypeParameters(params), name.location()); } } |