At moment you can set hetero node type with token option:

type : ID<TypeNode> ;

var : ID<VarNode> ;

Sometimes you want to set token type / text of node.  can use -> now

type : ID -> TYPENAME[$ID] ; // sets new token type for ID; copies text, line, 
col

a : lc='{' ... '}' -> BLOCK[$lc, "BLOCK"] ; // sets new token type and text

Inline i'm proposing two new token option names: text, ttype to join current 
options node and assoc.

type : ID<ttype=TYPENAME> ;

a : '{'<ttype=BLOCK, text="BLOCK"> ... '}' ;

My motivation is this

    |   e '?'^ e ':' e

following is gross but would work:

    |   e '?'<type=TERNARY, text="?:">^ e ':' e

we could also mimic rewrite stuff by allowing args on tokens in parser rules:

    |   e '?'[TERNARY, "?:"]^ e ':' e

what say ye? 2nd option is appealing but slightly diff fom how rewrite element 
args work.

Ter

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to