+/* ANNOTATIONS *******************************************************************/
+
+annotations~nopar {-> annotations}
+ = {one} at one_annotation~nopar {-> New annotations(at, Null, [one_annotation~nopar.annotation], Null)}
+ | {many} at opar no annotation_list [n2]:no cpar {-> New annotations(at, opar, [annotation_list.annotation], cpar)}
+ ;
+annotations_o~nopar {-> annotations?}
+ = annotations~nopar {-> annotations~nopar.annotations}
+ | {null} {-> Null}
+ ;
+
+one_annotation~nopar {-> annotation}
+ = {alone} redef visibility atid annotations_o~nopar {-> New annotation(Null, redef.kwredef, visibility, atid, Null, [], Null, annotations_o~nopar.annotations)}
+// !nopar to unambiguise 'new T@foo(bar)' between 'new T@(foo(bar))' and 'new (T@foo)(bar)'
+!nopar | {args} redef visibility atid opar no at_args [n2]:no cpar annotations_o~nopar {-> New annotation(Null, redef.kwredef, visibility, atid, opar, [at_args.expr], cpar, annotations_o~nopar.annotations)}
+ ;
+
+many_annotations {-> annotations}
+ = {many} annotation_list {-> New annotations(Null, Null, [annotation_list.annotation], Null)}
+ ;
+
+annotation_list {-> annotation*}
+ = {many} one_annotation_list annotations_tail* {-> [one_annotation_list.annotation, annotations_tail.annotation] }
+ ;
+
+one_annotation_list~nopar {-> annotation}
+ = {alone} redef visibility atid annotations_o~nopar {-> New annotation(Null, redef.kwredef, visibility, atid, Null, [], Null, annotations_o~nopar.annotations)}
+// !nopar to unambiguise 'new T@foo(bar)' between 'new T@(foo(bar))' and 'new (T@foo)(bar)'
+!nopar | {args} redef visibility atid opar no at_args [n2]:no cpar annotations_o~nopar {-> New annotation(Null, redef.kwredef, visibility, atid, opar, [at_args.expr], cpar, annotations_o~nopar.annotations)}
+!nopar | {nopar} redef visibility atid at_arg_single {-> New annotation(Null, redef.kwredef, visibility, atid, Null, [at_arg_single.expr], Null, Null)}
+ ;
+at_arg_single {-> expr}
+// FIXME: why expr_single but not expr_atom is not clear :(
+ = {expr} [expr]:expr_single_nopar {-> expr.expr}
+ ;
+
+annotations_tail {-> annotation}
+ = comma no one_annotation_list {-> one_annotation_list.annotation}
+ ;
+
+line_annotations {-> annotations}
+ = line_annotation+ {-> New annotations(Null, Null, [line_annotation.annotation], Null) }
+ ;
+line_annotation {-> annotation}
+ = [doc]:no redef visibility atid annotations? n1 {-> New annotation(doc.doc, redef.kwredef, visibility, atid.atid, Null, [], Null, annotations)}
+ | {args} [doc]:no redef visibility atid opar no at_args cpar annotations? n1 {-> New annotation(doc.doc, redef.kwredef, visibility, atid.atid, opar, [at_args.expr], cpar, annotations)}
+ | {nopar} [doc]:no redef visibility atid at_args_nopar n1 {-> New annotation(doc.doc, redef.kwredef, visibility, atid.atid, Null, [at_args_nopar.expr], Null, Null)}
+ ;
+line_annotation_forclass {-> propdef}
+ = [doc]:no atid_forclass annotations? {-> New propdef.annot(doc.doc, Null, Null, atid_forclass.atid, Null, [], Null, annotations)}
+ | {args} [doc]:no atid_forclass opar no at_args cpar annotations? {-> New propdef.annot(doc.doc, Null, Null, atid_forclass.atid, opar, [at_args.expr], cpar, annotations)}
+ | {nopar} [doc]:no atid_forclass at_args_nopar {-> New propdef.annot(doc.doc, Null, Null, atid_forclass.atid, Null, [at_args_nopar.expr], Null, Null)}
+ ;
+
+at_args~nopar {-> expr* }
+ = {many} any_expr~nopar at_args_tail* {-> [any_expr~nopar.expr, at_args_tail.expr]}
+ ;
+
+at_args_tail {-> expr}
+ = comma no any_expr {-> any_expr.expr}
+ ;
+
+any_expr~nopar {-> expr}
+ = {type} type {-> New expr.type(type)}
+ | {expr} expr~nopar {-> expr~nopar.expr}
+ | {stmt} stmt_noexpr~nopar {-> stmt_noexpr~nopar.expr}
+ | {methid} recv~nopar qmethid_noid {-> New expr.methid(recv~nopar.expr, qmethid_noid.methid)}
+!nopar | {at} annotations {-> New expr.at(annotations.annotations)}
+ ;
+
+atid~forclass {-> atid}
+ = {id} id {-> New atid.id(id)}
+!forclass | {kwextern} kwextern {-> New atid.kwextern(kwextern)}
+// | {kwimport} kwimport {-> New atid.kwimport(kwimport)}
+ | {kwabstract} kwabstract {-> New atid.kwabstract(kwabstract)}
+ ;
+