Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv32616/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Restricted the litarals used in patterns i.e. no floats or strings.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.140
retrieving revision 1.141
diff -C2 -d -r1.140 -r1.141
*** Parser.jj 21 Feb 2003 13:04:37 -0000 1.140
--- Parser.jj 21 Feb 2003 21:51:26 -0000 1.141
***************
*** 1211,1215 ****
{
(
! t="@" ( val=Literal() | tc=typeIdent() )
|
t="#" tc=typeIdent() { exactlyAt = true; }
--- 1211,1215 ----
{
(
! t="@" ( val=patternLiteral() | tc=typeIdent() )
|
t="#" tc=typeIdent() { exactlyAt = true; }
***************
*** 1748,1752 ****
{ first=getToken(1); }
! (
LOOKAHEAD(funExp()) e1=funExp()
| LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp()
--- 1748,1752 ----
{ first=getToken(1); }
! ( //TODO: simplify next lookahead after removal of the 'fun' keyword.
LOOKAHEAD(funExp()) e1=funExp()
| LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp()
***************
*** 2121,2124 ****
--- 2121,2143 ----
}
| res=stringConstantExp()
+ )
+ { return res; }
+ }
+
+ Expression patternLiteral() :
+ //restricted literal for use in dispatch patterns
+ {
+ Expression res;
+ Token t;
+ }
+ {
+ (
+ "null" { res = NullExp.instance; }
+ | res=intConstantExp()
+ | t=<CHARACTER_LITERAL>
+ { res=ConstantExp.makeChar
+ (new LocatedString(t.image.substring(1,t.image.length()-1),
+ new Location(t)));
+ }
)
{ return res; }
|