parser: disable unused `=` shortcut for functions
authorJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 13:29:28 +0000 (09:29 -0400)
committerJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 18:32:32 +0000 (14:32 -0400)
So simplify the grammar.

Signed-off-by: Jean Privat <jean@pryen.org>

src/parser/nit.sablecc3xx

index 0bc5b50..d775205 100644 (file)
@@ -261,7 +261,6 @@ propdefs~toplevel {-> propdef}
        ;
 propdef~toplevel {-> propdef}
        = {meth} [doc]:no redef visibility kwmeth methid signature annotation_noend? kwdo stmtso kwend_o {-> New propdef.concrete_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature, annotation_noend.annotations, stmtso.expr)}
-       | {assign_return} [doc]:no redef visibility kwmeth methid signature_withret assign no assign_return {-> New propdef.concrete_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature_withret.signature, Null, assign_return.expr)}
        | {nobody} [doc]:no redef visibility kwmeth methid signature annotation_withend_nonull {-> New propdef.deferred_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, annotation_withend_nonull.annotations)}
 !toplevel| {deferred} [doc]:no redef visibility kwmeth methid signature kwis kwabstract {-> New propdef.deferred_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, Null)}
 !toplevel| {intern} [doc]:no redef visibility kwmeth methid signature kwis kwintern {-> New propdef.intern_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature)}
@@ -320,11 +319,11 @@ methid {-> methid}
        | {braassign} obra cbra assign {-> New methid.braassign(obra, cbra, assign)}
        ;
 
-signature~withret {-> signature}
+signature {-> signature}
        = opar no params cpar typing [no2]:no {-> New signature(opar, [params.param], cpar, typing.type)}
-!withret| {noret} opar no params cpar [no2]:no {-> New signature(opar, [params.param], cpar, Null)}
+       | {noret} opar no params cpar [no2]:no {-> New signature(opar, [params.param], cpar, Null)}
        | {nopar} typing no {-> New signature(Null, [], Null, typing.type)}
-!withret| {noparnoret} no {-> New signature(Null, [], Null, Null)}
+       | {noparnoret} no {-> New signature(Null, [], Null, Null)}
        ;
 
 params {-> param*} 
@@ -338,10 +337,6 @@ param
        | id annotations? typing dotdotdot? {-> New param(id, typing.type, dotdotdot, annotations)}
        ;
 
-assign_return{-> expr}
-       = expr_final {-> New expr.return(Null, expr_final.expr)}
-       ;
-
 extern_calls {-> extern_calls?}
        = kwimport no extern_call extern_call_tail* {-> New extern_calls( kwimport, [extern_call, extern_call_tail.extern_call] )}
        | {null} {-> Null}