[antlr-interest] Grammar file for HTML template
Lars Heuer
heuer at semagia.com
Thu Sep 7 06:17:20 PDT 2006
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