dcsimg
How can I access the character index of my source file using grammer file?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, November 13, 2001 09:44 AM

Hi



I am trying to use ANTLR to develop my colorised editor .



I want to know the position of token that matches a given pattern in input stream.



Is there any thing available in ANTLR to let me do that.



Thanks

Re: How can I access the character index of my source file using grammer file?

Posted By:   SRIRAM_SRINIVASAN  
Posted On:   Tuesday, November 13, 2001 07:13 PM

One way is to implement your own input stream and to override all the read() methods (much like FilterInputStream).

You can supply an instance of this stream to the lexer's constructor.

Note that overriding consume() in the lexer is not good because the lexer can backtrack.

-Sriram
About | Sitemap | Contact