[antlr-interest] pushed antlr build with tree rewriting and composite grammars (java)

David Holroyd dave at badgers-in-foil.co.uk
Sat Jan 12 17:22:48 PST 2008


On Sun, Jan 13, 2008 at 12:34:43AM +0000, David Holroyd wrote:
> On Thu, Jan 10, 2008 at 04:39:54PM -0800, Terence Parr wrote:
> > http://www.antlr.org/download/build/antlr-2008-01-10.16.tar.gz
> 
> I'm having a go at upgrading from 3.0.

> Something appears to be quite broken due to my TokenStream
> implementation after moving to the latest code though.  I see more
> index() / rewind() stuff going on in the parser; probably I didn't
> implement something correctly here.

Ok, my mark() implementation was knackered.  All better now.



It seems that ANTLR is less happy about me trying to parse 'fragments'
now.

i.e. if I set up the input "test", and then invoke

  MyParser.identifier()

the generated parser now says

  NoViableAltException(-1!=[()* loopback of ..blah..]

whereas this seemed to work with the earlier ANTLR releases, at least
for some rules.


Is this sort of usage just not intended to work?

In the cases where I had problems in the past, I'd just append some
other token to the language fragment I was attempting to parse.

Is there a 'correct' way to fix this?  e.g. putting EOF all over the
place?


ta!
dave

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list