[antlr-interest] Stream Positions

Matthew Ford Matthew.Ford at forward.com.au
Mon Jan 7 14:41:30 PST 2002


If the inputbuffer is going to be changed I have another requirement.

I my case I am parsing a socket stream which can be arbitrarily long.  I
would like to be able to save the characters Antlr is working on and dump
the old matched ones (I would call dumpInputBuffer() at appropriate check
points such as end of command)
The saved characters should be accessible to display as part of the error
message in conjunction with the token position which would need to take into
account the change when the old part of the buffer was dumped.
At present I put my own version of a BufferedReader (which I can supply if
it is any help) in front of Antlr to save the chars but I don't think this
correctly handles lookahead and push back in the general case although it
seems to work for my grammar.

matthew
----- Original Message -----
From: "Trey Spiva" <Trey.Spiva at embarcadero.com>
To: <antlr-interest at yahoogroups.com>
Cc: "'Terence Parr'" <parrt at jguru.com>
Sent: Tuesday, January 08, 2002 7:06 AM
Subject: RE: [antlr-interest] Stream Positions


> I had to alter CharBuffer, CharScanner, CommonToken, InputBuffer,
> LexerSharedInputState, Token
>
> I just wanted to know if you would like to put it in the Antlr build.  (I
am
> working in C++)
>
> -----Original Message-----
> From: Terence Parr [mailto:parrt at jguru.com]
> Sent: Monday, January 07, 2002 12:45 PM
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] Stream Positions
>
>
> On Friday, January 4, 2002, at 07:08  AM, treyspiva wrote:
>
> > I have modified the C++ code to emit the starting stream position of
> > a token.  I found the stream position very usiful.  I was wondering
> > if I can get this into the C++ build.
>
> Can't this be easily added by overriding consume() or something?
>
> Ter
> --
> Chief Scientist & Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list