templateParser function
Creates a parser that can convert a Template text to a parse tree containing Renderers.
Note that:
- Errors or warnings are stored in ParserContext.errors and are can be later accessed in the TemplateParseResult.
- The start en end of a Tag or Variable can be escaped so that you can use them in a Template without being parsed as Tag or Variable. e.g. {{ this is not a tag or variable and does not throw errors }}
Implementation
Parser<List<Object>> templateParser(ParserContext context) {
//context.variables.validateNames();
return delegatingParser(
delegates: [
escapedTagStartParser(context.engine.tagStart),
escapedTagEndParser(context.engine.tagEnd),
...context.engine.tags.map((tag) => tag.createTagParser(context)),
InvalidTagParser(context),
missingTagStartParser(context),
missingTagEndParser(context),
],
tagStart: context.engine.tagStart,
tagEnd: context.engine.tagEnd,
);
}