[antlr-interest] Zero based $i$ index in StringTemplate

Terence Parr parrt at cs.usfca.edu
Wed Feb 8 14:25:35 PST 2006


On Feb 1, 2006, at 7:00 AM, Gevik Babakhani wrote:

> I was wondering why we are using 1 based index in
> ASTExpr.java, function applyListOfAlternatingTemplates at
> argumentContext.put(DEFAULT_INDEX_VARIABLE_NAME, new Integer(i+1));
>
> isn't 0 based index "new Integer(i)" better?

I was thinking of adding i0 as well as i.  1 is what humans expect.   
0 is what computers need but since you can't index in ST no need for  
0 based often. ;)

Ter



More information about the antlr-interest mailing list