[antlr-interest] Mixing PHP and HTML --> error
Bernhard Schmalhofer
Bernhard.Schmalhofer at gmx.de
Wed May 2 09:35:25 PDT 2007
Ruben Fonseca schrieb:
> Hi to all!
>
> I'm writting a PHP grammar. As you know, PHP can be used in the middle
> of HTML code. I'm having an hard time to ignore the HTML part. The
> parser always give me errors when I mix PHP and HTML.
>
In Plumhead, http://rakudo.org/parrot/index.cgi?plumhead, I'm using a
syntactic predicate
in order to keep track whether I'm in HTML of PHP.
See
http://svn.perl.org/viewcvs/parrot/trunk/languages/plumhead/src/antlr3/Plumhead.g?view=markup.
I don't know whether this is the best approach.
I've also been looking at the island grammar example in V3. But as far
as I understood it,
it did not match what I needed for PHP.
It would be nice if Antlr 3 had non-consuming matches. So far I haven't
found them in the documentation, but I haven't bought the book yet.
Best regards,
Bernhard
> Is there any cool way of dealing with this? I'm using AntLR 3 right now.
>
> Thank you!
>
>
More information about the antlr-interest
mailing list