Nice/src/bossa/parser Parser.jj,1.312,1.313
Arjan Boeijink <[email protected]>
| Newsgroups | gmane.comp.lang.nice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/nice/Nice/src/bossa/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28925/F:/nice/src/bossa/parser
Modified Files:
Parser.jj
Log Message:
Make 'extends' an alternative for '<:' and allow <T extends Foo> constraints.
Index: Parser.jj
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v
retrieving revision 1.312
retrieving revision 1.313
diff -C2 -d -r1.312 -r1.313
*** Parser.jj 7 Mar 2005 17:10:52 -0000 1.312
--- Parser.jj 8 Mar 2005 19:12:13 -0000 1.313
***************
*** 574,592 ****
TypeSymbol binder(Collection atomics):
! {
! TypeIdent first;
! TypeConstructor second;
! MonotypeVar id;
! Token t;
}
{
LOOKAHEAD( typeIdent() typeConstructor() )
! first=typeIdent()
! second=typeConstructor()
{
! atomics.add(new TypeConstructorLeqCst(second,first));
! return second;
}
! | { boolean sure = false; }
[ "!" { sure = true; } ]
id=monotypeVar()
--- 574,607 ----
TypeSymbol binder(Collection atomics):
! { TypeIdent ti;
! TypeConstructor typevar;
}
{
+ ( LOOKAHEAD( typeConstructor() "extends" )
+ { TypeIdent typevarid; Monotype m2; }
+ typevarid=typeIdent() "extends"
+ { typevar = new TypeConstructor(typevarid.getName().toString()); }
+ ( LOOKAHEAD(typeIdent() ( "," | "|" | ">"))
+ ti=typeIdent()
+ {
+ atomics.add(new TypeConstructorLeqCst(typevar, ti));
+ return typevar;
+ }
+ |
+ m2=monotype()
+ {
+ atomics.add(new MonotypeLeqCst(typevarid, m2));
+ return typevar;
+ }
+ )
+ |
LOOKAHEAD( typeIdent() typeConstructor() )
! ti=typeIdent()
! typevar=typeConstructor()
{
! atomics.add(new TypeConstructorLeqCst(typevar,ti));
! return typevar;
}
! | { MonotypeVar id; boolean sure = false; }
[ "!" { sure = true; } ]
id=monotypeVar()
***************
*** 596,599 ****
--- 611,615 ----
return id;
}
+ )
}
***************
*** 616,627 ****
{
( LOOKAHEAD(2)
! m1=monotype() "<:" m2=monotype()
{ list.add(new MonotypeLeqCst(m1,m2)); }
! ( "<:" { m1 = m2; }
m2 = monotype()
{ list.add(new MonotypeLeqCst(m1,m2)); }
)*
|
! t=typeConstructorIdent() ":" i=typeIdent()
{ list.add(new ImplementsCst(t,i)); }
)
--- 632,643 ----
{
( LOOKAHEAD(2)
! m1=monotype() ("<:" | "extends") m2=monotype()
{ list.add(new MonotypeLeqCst(m1,m2)); }
! ( ("<:" | "extends") { m1 = m2; }
m2 = monotype()
{ list.add(new MonotypeLeqCst(m1,m2)); }
)*
|
! t=typeConstructorIdent() (":" | "implements") i=typeIdent()
{ list.add(new ImplementsCst(t,i)); }
)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click