[antlr-interest] how to catch line and column information

Gmail weiyi.ud at gmail.com
Sun Jul 12 11:20:53 PDT 2009


hi everyone,

I have a question about storing the position information(start/end  
line and start/end column for every token) in Antlr grammar. I  
searched the internet and it seemed that a common approach was to  
extend an existing Antlr token class to add some extra fields, such as  
endLine and endColumn. However, to do this, the method  
setTokenObjectClass(String) must be called to let the lexer know that  
we want to use a customized token class. My question is, I can't find  
this method in the Lexer class. And since the generated class extends  
Lexer, I can't call the setTokenObjectClass method from the generated  
Lexer class. Did I make any mistake or miss anything I should know? If  
anyone can share some ideas about this issue, I would be grateful.  
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090712/7a7c659e/attachment.html 


More information about the antlr-interest mailing list