Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Token: line and column indexes: 1 based ?

0 views
Skip to first unread message

Cesare Zecca

unread,
Apr 24, 2008, 8:29:15 AM4/24/08
to
Hi all
I gave a look to the official doc https://javacc.dev.java.net/doc/apiroutines.html
and elsewhere in the web.
I did not find any mention about the base of the line and column
indexes i.e. the

int beginLine, beginColumn, endLine, endColumn

data members of the Token class. Are they either 0 (zero) or 1 based?

The comment in the class

/**
* beginLine and beginColumn describe the position of the first
character
* of this token; endLine and endColumn describe the position of the
* last character of this token.
*/

does not mention the base for the indexes, too.
Sperimentally I noted that a token on the first line of the input is
reported with beginLine that holds value 1.
So I guess that those indexes are 1-based.
Is it right?
If so, a couple of words more in the doc to tell that indexes are 1-
based would not be bad.

ciao
Cesare

0 new messages