[antlr-interest] Antlr grammar for xml like grammar

Matt Palmer mattpalms at gmail.com
Mon Aug 25 02:35:59 PDT 2008


Hi Ymo,

I am also building a tag language parser in ANTLR, but I'm not experienced
enough to diagnose your problem by simply looking at your grammar.  The
files you provided are not stand-alone, and don't build in antlrworks - can
you post something that compiles, so we can have a play with it?  Preferably
in a form where you can look at the parse tree in the antlrworks debugger,
and see how the document is being constructed.

I do suspect you will have some of the same partial ML comment prefix
matching issues I had (a couple of posts ago - "missing characters in
partial matches").  To see if you're affected (after you get comments to
match at all!), try parsing some text that is almost but not quite a
comment, like:

«%-not a comment
>

If you find that the lexer doesn't match this text properly (missing
characters), the solution to that was provided by the other good folk on
this list.

cheers,

MattP.

On Mon, Aug 25, 2008 at 4:50 AM, Ymo <ymo.mail at gmail.com> wrote:

> Hi.
>
> I am trying to write a lexer for an xml like grammar. I am pulling my hear
> for i don't understand why it is not working.
>
> The grammar goes like this :
>
> TOK_TEXT
> <% ... %>
> TOK_TEXT
> <%@ .... %>
> <%-- COMMENT --%>
>
>
> I can't  figure why my ml comments are getting eaten by the TOK_TEXT token
> always.
>
> YOur help is greatly appreciated !
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080825/c86908dc/attachment.html 


More information about the antlr-interest mailing list