[antlr-interest] proposal: new properties or Token methods

Johannes Luber jaluber at gmx.de
Fri Dec 28 13:37:09 PST 2007


Terence Parr schrieb:
> hi. I find myself doing Integer.valueOf($label.text) a lot.  Integer
> values are so common in languages that perhaps we should define
> $label.int and maybe label.float?  Or, is it simpler to just define
> 
>     public int toInt();
>     public float toFloat();
>     public double toDouble();
> 
> in Token interface?  I guess I'll try that first.

Adding properties to labels seems to be less language-dependent. So I'd
prefer this approach. BTW, what is supposed to happen, when the label
contains "abc" instead?

Johannes


More information about the antlr-interest mailing list