use Template::TT3::Patterns '$KEYWORD';
# some text to match
my $text = "foo";
# see if the text contains a keyword
if ($text =~ /$KEYWORD/) {
print "got a keyword: $1\n";
}
This module defines a number of regular expression for matching the basic tokens of the Template Toolkit markup language.
The first few iterations of the TT3 parser used a straightforward recursive descent approach and relied on these patterns extensively. More recent implementations are based around a generic operator precedence model with a configurable grammar. We now automatically generate regular expressions to match operators rather than using pre-defined patterns. This means that many of the above patterns are no longer used and will eventually be cleared out.
Andy Wardley http://wardley.org