[antlr-interest] issue with antlr requiring a whitespace at a specific place

Bart Kiers bkiers at gmail.com
Wed Jun 8 05:39:37 PDT 2011


Well, your grammar is now quite different than the few rule you posted (more
rules, and not everything is visible, so I can't test it myself).
All I can say is that the interpreter from ANTLRWorks has (quite some)
odd quirks, so best not use it. If something seems odd in the interpreter,
either create a little test rig yourself, or use ANTLRWorks' debugger to be
sure if the error lies in your grammar, or the interpreter.

Good luck!

Regards,

Bart.


On Wed, Jun 8, 2011 at 1:04 PM, Olivier Sallou <olivier.sallou at irisa.fr>wrote:

> For the same, I have mismatched token. I simplified it to maximum (see
> first line of attached screenshot)
>
> However I see in my editor (antlrworks) in interpreter tab: "Ignore
> rules: WHITESPACE".
>
> I wonder why, I did not ask for such ignore, and I do not see how to
> remove this.
>
> Maybe this occurs in generated code too.
>
> Olivier
>
> Le 6/8/11 12:58 PM, Bart Kiers a écrit :
> > Hi Olivier,
> >
> > I can't reproduce it. I tested with ANTLRWorks 1.4.2 as well.
> > See the attached screenshot.
> >
> > Regards,
> >
> > Bart.
> >
> >
> > On Wed, Jun 8, 2011 at 11:23 AM, Olivier Sallou <olivier.sallou at irisa.fr
> >wrote:
> >
> >> Hi,
> >> I have an issue with antlrworks (1.4.2), where for a specific grammar,
> >> it requires a whitespace.
> >> I upgraded from antlrworks 1.1.7 where the same did not asked for the
> >> whitespace.
> >>
> >> example:
> >>        '?' string
> >>        | '%' string ':' percentage=INT
> >>        | ...
> >>
> >> string    : '"' LOWID '"';
> >> LOWID    : ('a'..'z'|'\-')+;
> >> INT :   ('0'..'9')+ ;
> >>
> >> If I call my example rules with:
> >>  ?\"acgt\"
> >> it works fine
> >> but if I call
> >>  %\"acgt\":30
> >>
> >> If fails.
> >>
> >> At least if I add a whitespace between % and \"acgt\", it works:
> >>  % \"acgt\":30
> >>
> >> I really can't understand why a whitespace is required here, and only
> >> here....
> >>
> >> Thanks for your help
> >>
> >> Olivier
> >>
> >>
> >> --
> >> gpg key id: 4096R/326D8438  (pgp.mit.edu)
> >> Key fingerprint = 5FB4 6F83 D3B9 5204 6335  D26D 78DC 68DB 326D 8438
> >>
> >>
> >>
> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >> Unsubscribe:
> >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >>
>
> --
> gpg key id: 4096R/326D8438  (pgp.mit.edu)
> Key fingerprint = 5FB4 6F83 D3B9 5204 6335  D26D 78DC 68DB 326D 8438
>
>
>


More information about the antlr-interest mailing list