[antlr-interest] Grammar file for HTML template

Jun Lu laomao at jaxwiki.net
Sun Sep 10 19:39:45 PDT 2006


Hi Lars,

Thank you for the information and suggestions. I tested the program
with RegEx. It is simple. The initial result is very promising. I will
update the group once I have something can show.

Cheers.

Jun

On 9/7/06, Lars Heuer <heuer at semagia.com> wrote:
> Hi Jun,
>
> [...]
> > One problem is how to convert phpBB templates into some form of Java
> > or JSP. A sample template (tpl file) is attached below.
>
> > There are 3 patterns I need to deal with.
> > 1. variables: {[A-Z_]+}  : replaced with a bean property
> > 2. loop: <!-- BEGIN [a-z_]+_rows --> ....   <!-- END [a-z_]+_rows -->
> > : replaced with array of beans
> > 3. condition:    <!-- BEGIN switch_[a-z_]+ --> ...   <!-- END
> > switch_[a-z_]+ --> : replaced with "if (..)"
>
> > Any opinions on would be appreciated.
>
> Since the templates look like [PHPLib] templates, I'd use some RegExes
> and wouldn't use ANTLR at all. Look into the [template] class of the
> PHPLib.
>
> [PHPLib] http://phplib.sf.net/
> [template] <http://phplib.cvs.sourceforge.net/phplib/php-lib-stable/php/template.inc?revision=1.15&view=markup>
>
> Best regards,
> Lars
> --
> http://www.semagia.com
>
>


More information about the antlr-interest mailing list