[antlr-interest] How a rule can containt characters that match
other rule
Lucien Stals
lstals at swin.edu.au
Mon Apr 24 16:43:21 PDT 2006
Have you looked at the HTML grammar on the ANTLR site?
http://www.antlr.org/grammar/list
Since wiki markup is similar to HTML, and especially since the example
you give here *is* HTML, I expect you can find some inspiration from
looking at an already developed grammar.
Lucien.
pepone pepone wrote:
> Hi all
>
> I trying to build a Wiki Lexer parser and i don't know how to solve
> this situation
>
> Here is a sample document
>
> ---
> <p>Hello world UTF-8</p>
> ---
>
> --- Match document begin and document end
>
> <p> parraf begin
> </p> parraf end
>
>
> I have this rules in my parser:
>
> document
> :DOCUMENT^(parraf)+DOCUMENT
> ;
>
> parraf
> :
> (PARRAF_TAG_BEGIN^
> (~(OTAG|CTAG))+
> PARRAF_TAG_END)
> ;
>
> Lexer rules:
>
> DOCUMENT:
> '-''-''-'
> ;
>
> PARRAF_TAG_BEGIN:
> OTAG P CTAG
> ;
>
> PARRAF_TAG_END:
> OTAG SLASH P CTAG
> ;
>
> protected OTAG:'<';
> protected CTAG:'>';
>
> The problem is that when parser found '8' it expect '-'
>
> how make the parser work in this scenario?
>
> Thanks
> --
> play tetris http://pepone.on-rez.com/tetris
> run gentoo http://gentoo-notes.blogspot.com/
>
>
>
>
More information about the antlr-interest
mailing list