[antlr-interest] How a rule can containt characters that match
other rule
pepone pepone
pepone.onrez at gmail.com
Mon Apr 24 17:27:59 PDT 2006
Hi Lucien
I read html.g but i can found the answer to my troubel
Expecialy i don't understand how the PCDATA rule works, and what means
the : before '\r''\n'
PCDATA
: (
options {
generateAmbigWarnings=false;
}
: '\r' '\n' {newline();}
| '\r' {newline();}
| '\n' {newline();}
| ~('<'|'\n'|'\r'|'"'|'>')
)+
;
if i build a rule as PCDATA for my gramar, must i negate all
characters that are th
On 4/25/06, Lucien Stals <lstals at swin.edu.au> wrote:
> 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/
> >
> >
> >
> >
>
--
play tetris http://pepone.on-rez.com/tetris
run gentoo http://gentoo-notes.blogspot.com/
More information about the antlr-interest
mailing list