[antlr-interest] TokenRewriteStream usage
Terence Parr
parrt at cs.usfca.edu
Wed Sep 3 14:53:09 PDT 2008
On Sep 3, 2008, at 2:31 PM, Brisard, Fred D wrote:
> I am developing an editor that uses an Antlr-based parser to analyze
> the source, display it in various forms, allow the user to make
> modifications and then regenerate the source with those
> modifications. From what I read it seems like the
> TokenRewriteStream is perfect for the job.
>
> Right now I have a working parser that operates correctly when using
> CommonTokenString. I’m able to parse the source dump an AST based
> on CommonTree that I built during the parsing. I figured my first
> step into rewriting would be to just replace the CommonTokenString
> object with a TokenRewriteStream object as the result of the lex. I
> also added a grammar option of rewrite=true.
>
that is used for output=template and such. turn that off for starters
I think.
>
> When I run the lexer I get a null token stream from
> TokenRewriteStream.toString().
>
Weird...are you using CommonToken?
Ter
More information about the antlr-interest
mailing list