[antlr-interest] Re: feature request: Token.getOffset()
cj_daly
cj_daly at yahoo.com
Mon Dec 8 23:08:48 PST 2003
Well, maybe not as bothersome as I thought.... :-)
I was going to say that I can't get to the token info for exceptions
that have a token associated with them (like MismatchedTokenException
and NoViableAltException), but now I see that Token is a public
instance variable in both cases so I *can* get to it. I was looking
for something like getText() or getToken() and not seeing it, but the
public instance vars will work for me.
Now I would be a little happier if RecognitionException had a
getLength() or getText() to go along with getLine() and getColumn(),
but I can get what I need here by using instanceof and casting to the
specific exception type.
Chris
--- In antlr-interest at yahoogroups.com, "cj_daly" <cj_daly at y...> wrote:
>
> Plus I've got a more bothersome problem with the interface of
> RecognitionException. See my next post on that....
>
> Chris
>
>
> --- In antlr-interest at yahoogroups.com, "lgcraymer" <lgc at m...> wrote:
> > --- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> > ..
> > > (/grants loring permission to throw something at him) Hmmm so we
> can get up
> > > to a 20% gain in our lexers by kicking out the column stuff ;) ?
> Or move
> > > the checking of tabs out of the CharScanner::consume method and
> handle them
> > > similarly to newline by explicit calls in the lexer?
> >
> > The 20% would require heavy optimization of the lexer--right now,
> ANTLR lexers are grossly inefficient. Handling tab() like newline(),
> > though, would be a good idea. line/column information is generally
> useful (it's hard to imagine a production batch translator that didn't
> > need the line/column error reporting for text processing. Ter's
> working on doing a few things that should significantly improve ANTLR
> > lexer performance.
> >
> > --Loring
> >
> > > Cheers,
> > >
> > > Ric
> > > --
> > >
>
-----+++++*****************************************************+++++++++-------
> > > ---- Ric Klaren ----- j.klaren at u... ----- +31 53 4893722 ----
> > >
>
-----+++++*****************************************************+++++++++-------
> > > Words fly like arrows
> > > as if we knew what was right and wrong. --- Chuang Tsu
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list