kwuniversal = 'universal';
kwspecial = 'special';
kwend = 'end';
-kwmeth = 'meth' | 'fun'; //FIXME: Remove the 'meth' alternative once the transition is done
+kwmeth = 'fun';
kwtype = 'type';
-kwattr = 'attr'; //FIXME: remove kwattr once the transition is done
kwinit = 'init';
kwredef = 'redef';
kwis = 'is';
kwfalse = 'false';
kwnull = 'null';
kwas = 'as';
-kwwith = 'with';
kwnullable = 'nullable';
kwisset = 'isset';
kwlabel = 'label';
gt = '>';
ge = '>=';
starship = '<=>';
+bang='!';
classid = uppercase letter*;
id = lowercase letter*;
!toplevel| {deferred} [doc]:no redef visibility kwmeth methid signature kwis kwabstract {-> New propdef.deferred_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature)}
!toplevel| {intern} [doc]:no redef visibility kwmeth methid signature kwis kwintern {-> New propdef.intern_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature)}
| {extern} [doc]:no redef visibility kwmeth methid signature kwis kwextern string? {-> New propdef.extern_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, string)}
-//FIXME: Remove attr alternative once the transition is done
-!toplevel| {attr} [doc]:no readable writable redef visibility kwattr attrid typing? {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, kwattr, Null, attrid, typing.type, Null)}
-!toplevel| {attr2} [doc]:no readable writable redef visibility kwattr attrid typing? assign [n2]:no expr {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, kwattr, Null, attrid, typing.type, expr)}
-!toplevel| {var} [doc]:no readable writable redef visibility kwvar attrid typing? {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, Null, kwvar, attrid, typing.type, Null)}
-!toplevel| {var2} [doc]:no readable writable redef visibility kwvar attrid typing? assign [n2]:no expr {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, Null, kwvar, attrid, typing.type, expr)}
+!toplevel| {var} [doc]:no readable writable redef visibility kwvar attrid typing? {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, kwvar, attrid, typing.type, Null)}
+!toplevel| {var2} [doc]:no readable writable redef visibility kwvar attrid typing? assign [n2]:no expr {-> New propdef.attr(doc.doc, readable.able, writable.able, redef.kwredef, visibility, kwvar, attrid, typing.type, expr)}
!toplevel| {init} [doc]:no redef visibility kwinit methid? signature kwdo stmtso kwend? {-> New propdef.concrete_init(doc.doc, redef.kwredef, visibility, kwinit, methid, signature, stmtso.expr)}
!toplevel| {type} [doc]:no redef visibility kwtype classid typing {-> New propdef.type(doc.doc, redef.kwredef, visibility, kwtype, classid, typing.type)}
;
closure_decls {->closure_decl*}
= no closure_decl+ {-> [closure_decl]};
closure_decl
- = kwwith kwbreak? [no2]:no id signature_noclosures n {-> New closure_decl(kwwith, kwbreak, id, signature_noclosures.signature, Null)}
- | {optionnal} kwwith kwbreak? [no2]:no id signature_noclosures kwdo stmtso n {-> New closure_decl(kwwith, kwbreak, id, signature_noclosures.signature, stmtso.expr)}
+ = kwbreak? bang id signature_noclosures n {-> New closure_decl(kwbreak, bang, id, signature_noclosures.signature, Null)}
+ | {optionnal} kwbreak? bang id signature_noclosures kwdo stmtso n {-> New closure_decl(kwbreak, bang, id, signature_noclosures.signature, stmtso.expr)}
;
/* TYPES *********************************************************************/
;
closure_def_last~withelse {-> closure_def}
- = kwwith idlist? kwdo stmtso~withelse_withend label? {-> New closure_def(kwwith, [idlist.id], kwdo, stmtso~withelse_withend.expr, label)}
- | {noend} kwwith idlist? kwdo stmt~withelse {-> New closure_def(kwwith, [idlist.id], kwdo, stmt~withelse.expr, Null)}
+ = bang [id]:closure_id idlist? kwdo stmtso~withelse_withend label? {-> New closure_def(bang, id, [idlist.id], kwdo, stmtso~withelse_withend.expr, label)}
+ | {noend} bang [id]:closure_id idlist? kwdo stmt~withelse {-> New closure_def(bang, id, [idlist.id], kwdo, stmt~withelse.expr, Null)}
;
closure_def {-> closure_def}
- = kwwith idlist? kwdo n stmts [n2]:n {-> New closure_def(kwwith, [idlist.id], kwdo, stmts.expr, Null)}
- | {empty} kwwith idlist? kwdo n {-> New closure_def(kwwith, [idlist.id], kwdo, Null, Null)}
+ = bang [id]:closure_id idlist? kwdo n stmts [n2]:n {-> New closure_def(bang, id, [idlist.id], kwdo, stmts.expr, Null)}
+ | {empty} bang [id]:closure_id idlist? kwdo n {-> New closure_def(bang, id, [idlist.id], kwdo, Null, Null)}
+ ;
+closure_id
+ = {simple} id
+ | {break} kwbreak
;
vardecl~withelse{-> expr}
args_tail {-> expr}
= comma no expr [n2]:no {-> expr};
idlist {-> id*}
+ = opar idlist_nopar cpar {-> [idlist_nopar.id]}
+ | {nopar} idlist_nopar {-> [idlist_nopar.id]}
+ ;
+idlist_nopar {-> id*}
= {single} id {-> [id]}
- | {more} idlist no comma [n2]:no id {-> [idlist.id, id]}
+ | {more} idlist_nopar no comma [n2]:no id {-> [idlist_nopar.id, id]}
;
qualified
superclass = kwspecial type;
-propdef = {attr} doc? [readable]:able? [writable]:able? kwredef? visibility kwattr? kwvar? [id]:attrid type? expr? // Remove the kwattr? once the transition is done
+propdef = {attr} doc? [readable]:able? [writable]:able? kwredef? visibility kwvar [id]:attrid type? expr?
| {meth} doc? kwredef? visibility methid signature
| {deferred_meth} doc? kwredef? visibility kwmeth methid signature
| {intern_meth} doc? kwredef? visibility kwmeth methid signature
param = id type? dotdotdot?
;
-closure_decl = kwwith kwbreak? id signature expr?
+closure_decl = kwbreak? bang id signature expr?
;
type = kwnullable? [id]:classid [types]:type*;
;
closure_def
- = kwwith id* kwdo expr? label?
+ = bang [id]:closure_id [ids]:id* kwdo expr? label?
+ ;
+closure_id
+ = {simple} id
+ | {break} kwbreak
;
qualified = id* classid? ;