[antlr-interest] Re: Help with Java grammar

Ric Klaren klaren at cs.utwente.nl
Thu Mar 11 05:19:02 PST 2004


On Tue, Mar 09, 2004 at 04:25:17PM -0000, cliftonccraig wrote:
> Still no luck. I tried your suggestion and while it went through the
> ANTLR generator ok it didnt stop the OutOfMemory error.

Where does the out of memory error come from (can you get backtraces of
where it bombs out)? Did you try running the lexer standalone (e.g. just do
nextToken in a loop) and see if it groks the offending input file.

Are you doing stuff in the uponEOF handler (maybe in combination with
tracing turned on)? Does it also happen with a trivial input file ? If so
did you try single stepping trough it with a debugger.

> It sounds like overkill but I just don't see any easier way to do
> this. I thought I saw a way to chain or concatenate to InputStreams
> together as one in some book or article but I can't remember. Please,
> could someone help me with either solution. I feel so stumped.

It might be easier to use a custom InputBuffer that adds a "\r\n" before
EOF. InputBuffer seems to me as a simpler class to override. For java mode
you'd probably have to look at CharBuffer.java looks like you only have to
add one check in the fill method. Then use the more specific constructors
of the lexer to glue stuff together.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  "Good judgement comes from experience.
     Experience comes from bad judgement." --- Unknown



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list