Using label with repeated rule and equal (=) operator

23 views
Skip to first unread message

Ivan Kochurkin

unread,
Dec 7, 2016, 11:47:41 AM12/7/16
to antlr-discussion
ANTLR supports rule labels. We can use them by the following way:

rule1
   
: t1 = a
   
;

For multiple elements we can use the following syntax with += operator:

rule1
   
: t1 += a+
   
;

But If we wil use a usual = operator with multiple elements:

rule1
   
: t1 = a+
   
;

t1 rule will point on the last element of a+ sequence. Should we generate a error in this case or t1 must point on array as in second case?

Reply all
Reply to author
Forward
0 new messages