-
Notifications
You must be signed in to change notification settings - Fork 0
Parsing
First in the template processing pipiline is parsing template content. This is realized using IParserService supports two kinds of parsers: content parsers and value parsers.
Content parser typically takes whole template and process its content. Typical content parser will be XML parser, which will required valid XML document and from this document parses AST.
Each content parser can support places, where special syntax can be used, from the example in Index.html, this the syntax based on curly brackets, and the place, where XmlContentParser supports this syntax, is attribute value.
As benefit, using IParserService inside content or value parsers, we have low coupling between concrete parsers and got simple extensibility.
There are some parsers, that are shipped with Neptuo.Templates.Compilation. For parsing content, there is XmlContentParser, for parsing 'values', there are TokenValueParser and PlainValueParser, which only creates AST node for static text value.
Both (XmlContentParser and TokenValueParser) delegates the main processing parts to the registered compoments, which enables us to modify parsing process for each node. There components acts like control builders from ASP.NET WebForms.