parser: production `annotation_withend` is nullable
authorJean Privat <jean@pryen.org>
Wed, 9 Apr 2014 14:39:23 +0000 (10:39 -0400)
committerJean Privat <jean@pryen.org>
Wed, 9 Apr 2014 15:05:05 +0000 (11:05 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/parser/nit.sablecc3xx

index 9b98e30..ab03a26 100644 (file)
@@ -208,10 +208,10 @@ module
        = moduledecl? [imports]:import* [extern_bodies]:extern_code_body* [classdefs]:classdef* implicit_top_class? implicit_main_class {-> New module(moduledecl, [imports.import], [extern_bodies.extern_code_block], [classdefs.classdef,implicit_top_class.classdef,implicit_main_class.classdef])};
 
 moduledecl
-       = [doc]:no kwmodule no module_name annotation_withend? [n2]:n1 {-> New moduledecl(doc.doc, kwmodule, module_name, annotation_withend.annotations)};
+       = [doc]:no kwmodule no module_name annotation_withend [n2]:n1 {-> New moduledecl(doc.doc, kwmodule, module_name, annotation_withend.annotations)};
 
 import
-       = {std} [doc]:no visibility kwimport no module_name annotation_withend? [n2]:n1 {-> New import.std(visibility, kwimport, module_name, annotation_withend.annotations)}
+       = {std} [doc]:no visibility kwimport no module_name annotation_withend [n2]:n1 {-> New import.std(visibility, kwimport, module_name, annotation_withend.annotations)}
        | {no} [doc]:no visibility kwimport no kwend [n2]:n1 {-> New import.no(visibility, kwimport, kwend)}
        ;
 
@@ -250,7 +250,7 @@ formaldef
        = classid annotations? typing? {-> New formaldef(classid, typing.type, annotations)};
 
 superclass {-> superclass}
-       = {super} no kwsuper [n2]:no type annotation_withend? {-> New superclass(kwsuper, type, annotation_withend.annotations)}
+       = {super} no kwsuper [n2]:no type annotation_withend {-> New superclass(kwsuper, type, annotation_withend.annotations)}
        ;
 
 propdefs~toplevel {-> propdef}
@@ -259,23 +259,24 @@ 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 {-> New propdef.deferred_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, annotation_withend.annotations)}
+       | {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)}
        | {extern} [doc]:no redef visibility kwmeth methid signature kwis kwextern string_o extern_calls extern_code_block? {-> New propdef.extern_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, string_o.string, extern_calls, extern_code_block)}
        | {extern_implicit} [doc]:no redef visibility kwmeth methid signature extern_calls extern_code_block {-> New propdef.extern_meth(doc.doc, redef.kwredef, visibility, kwmeth, methid, signature.signature, Null, extern_calls, extern_code_block)}
 !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, Null, typing.type, Null, 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, Null, typing.type, Null, expr)}
-!toplevel| {var3} [doc]:no redef visibility kwvar id typing? writable2? annotation_withend? {-> New propdef.attr(doc.doc, Null, writable2.able, redef.kwredef, visibility, kwvar, Null, id, typing.type, annotation_withend.annotations, Null)}
-!toplevel| {var4} [doc]:no redef visibility kwvar id typing? writable2? assign [n2]:no expr annotation_withend? {-> New propdef.attr(doc.doc, Null, writable2.able, redef.kwredef, visibility, kwvar, Null, id, typing.type, annotation_withend.annotations, expr.expr)}
+!toplevel| {var3} [doc]:no redef visibility kwvar id typing? writable2? annotation_withend {-> New propdef.attr(doc.doc, Null, writable2.able, redef.kwredef, visibility, kwvar, Null, id, typing.type, annotation_withend.annotations, Null)}
+!toplevel| {var4} [doc]:no redef visibility kwvar id typing? writable2? assign [n2]:no expr annotation_withend {-> New propdef.attr(doc.doc, Null, writable2.able, redef.kwredef, visibility, kwvar, Null, id, typing.type, annotation_withend.annotations, expr.expr)}
 !toplevel| {init} [doc]:no redef visibility kwinit methid? signature annotation_noend? kwdo stmtso kwend_o {-> New propdef.concrete_init(doc.doc, redef.kwredef, visibility, kwinit, methid, signature, annotation_noend.annotations, stmtso.expr)}
-!toplevel| {type} [doc]:no redef visibility kwtype classid typing annotation_withend? {-> New propdef.type(doc.doc, redef.kwredef, visibility, kwtype, classid, typing.type, annotation_withend.annotations)}
+!toplevel| {type} [doc]:no redef visibility kwtype classid typing annotation_withend {-> New propdef.type(doc.doc, redef.kwredef, visibility, kwtype, classid, typing.type, annotation_withend.annotations)}
 !toplevel| {extern_init} [doc]:no redef visibility kwnew methid? signature kwis kwextern string_o extern_calls extern_code_block? {-> New propdef.extern_init(doc.doc, redef.kwredef, visibility, kwnew, methid, signature, string_o.string, extern_calls, extern_code_block)}
 !toplevel| {extern_init_implicit} [doc]:no redef visibility kwnew methid? signature string_o extern_calls extern_code_block {-> New propdef.extern_init(doc.doc, redef.kwredef, visibility, kwnew, methid, signature, string_o.string, extern_calls, extern_code_block)}
        ;
-annotation_withend {-> annotations}
+annotation_withend~nonull {-> annotations?}
        = {oneliner} kwis many_annotations {-> many_annotations.annotations}
        | {more} kwis n1 line_annotations kwend {-> line_annotations.annotations}
+!nonull        | {null} {-> Null}
        ;
 annotation_noend {-> annotations}
        = {oneliner} kwis many_annotations {-> many_annotations.annotations}