Rewrite Squirrel::Template into parsing and processing steps
authorTony Cook <tony@develop-help.com>
Wed, 22 Feb 2012 13:06:17 +0000 (00:06 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 7 Mar 2012 02:29:51 +0000 (13:29 +1100)
commit58f0ca942d45c6a3aa752fcbdb12e871d2ba36c0
treeaa12843fb006c69dfea42447cad5958830430a53
parent264b1f603a956bc467a2efb4767a3cea49996447
Rewrite Squirrel::Template into parsing and processing steps

Works in two ways:

- avoid multiple passes over the whole very large text

  Previously the templater grabbed the base text, substituted any
  wrappers and includes to produce a large string in memory, and then
  performs multiple passes of substitution over the whole text until
  either there are no tags to replace or we hit a limit.

- avoid processing of iterators in false conditionals

  Previousl iterators were processed before conditionals so that
  conditionals within the iterator will be processed in the context of
  the iterator.

  With the changes if the conditional can be resolved only the true
  conditional will be processed.

The changes here lead directly to some other improvements:

- line numbers and source files are being tracked, and in the future
  may be used to report errors with a bit more precision.

- this provides the base for a more regular templating language that
  can work with an object system to avoid having to create tags to
  expose functionality that the objects already provide.
21 files changed:
MANIFEST
MANIFEST.SKIP
Makefile
site/cgi-bin/modules/BSE/Template.pm
site/cgi-bin/modules/Squirrel/Template.pm
site/cgi-bin/modules/Squirrel/Template/Constants.pm [new file with mode: 0644]
site/cgi-bin/modules/Squirrel/Template/Deparser.pm [new file with mode: 0644]
site/cgi-bin/modules/Squirrel/Template/Parser.pm [new file with mode: 0644]
site/cgi-bin/modules/Squirrel/Template/Processor.pm [new file with mode: 0644]
site/cgi-bin/modules/Squirrel/Template/Tokenizer.pm [new file with mode: 0644]
site/docs/Squirrel::Template.html [new file with mode: 0644]
site/docs/config.pod
site/docs/makedocs
site/util/bse_template_check.pl [new file with mode: 0644]
t/t010template.t
t/templater/00load.t [new file with mode: 0644]
t/templater/10token.t [new file with mode: 0644]
t/templater/20parse.t [new file with mode: 0644]
t/templates/included.recursive [new file with mode: 0644]
t/templates/wrapinner.tmpl [new file with mode: 0644]
t/templates/wrapself.tmpl [new file with mode: 0644]