Copyright (c) 2019-2024 Sempare Limited
The main entry point is in the Sempare.Template.pas.
The Sempare Template Engine has the following files:
Sempare.Template.AST.pas
All interfaces used by the parser and evaluation engine are defined in this file.
ITemplateVisitor is also defined (visitor pattern) which is used by the pretty printer and the evaluation engine.
Sempare.Template.Parser.pas
This is a recursive descent parser.
Sempare.Template.Lexer.pas
The lexical analyser GetToken() will return an ITemplateSymbol
ITemplateSymbol has a TTemplateSymbol (an enum matching the various symbol types). It also includes an IPosition.
IPosition includes:
- filename
- line
- position
Note the lexer has two modes:
- Script Mode
- This is where statements are defined between <% and %>
- Text Mode
- This is where text appears outside of <% and %>.
Sempare.Template.Context.pas
This is where the TTemplateContext is actually defined that implement ITemplateContext.
Sempare.Template.Evaluate.pas
Contains the template evaluation engine.
Sempare.Template.PrettyPrint.pas
Contains the Pretty Printer used for debugging.
Sempare.Template.Rtti.pas
This may be useful when defining custom functions that need to operate on TValue variables.
Sempare.Template.StackFrame.pas
Defines the stack frame utility used by the evaluation engine.