I've tried to extract it like
dims!
: (options{greedy=true; }:
({LA(1) == AT}? annotations
| )
lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK
)+
;

and
dims
: (options{greedy=true; }:
({LA(1) == AT}? annotations
| )
lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK
)+
;

but I face problem with tree structure: array declaration is not included into typespec or missed completely. I suppose it should be fixed with custom parsing structure like we use for TYPE and for lots of rules
Expected:

I've tried to extract it like
and
but I face problem with tree structure: array declaration is not included into typespec or missed completely. I suppose it should be fixed with custom parsing structure like we use for TYPE and for lots of rules
Expected:
