template_engine library

Classes

Acos
Additions
AddOperator
AndOperator
ArgumentsParser
Parses an function argument expression and:
Asin
AssignmentOperator
Assignments
AssignVariableExpression
Atan
Boolean
CaretOperator
Comparisons
Constant<T>
A Constant is a value that does not change value over time.
ConstantDocumentation
Cos
DataType<T extends Object>
A data type defines what the possible values an expression, such as a variable, operator or a function call, might use.
DataTypeDocumentation
DefaultConstants
DefaultDataTypes
DefaultFunctionGroups
DefaultOperatorGroups
DefaultTags
DivideOperator
DocumentationFactory
DocumentationFunction
DocumentationFunctions
Functions that create documentation of the TemplateEngine configuration
EndOfInputWithBetterFailureParser
A parser that succeeds at the end of input. OR results with an failure with the message of the owning parser Inspired by EndOfInputParser
EqualsOperator
ExampleDocumentation
ExampleFactory
Exp
Expression<T extends Object>
A subset of Renderer for expressions It is a combination of one or more:
ExpressionBuilder2<T>
A builder that allows the simple definition of expression grammars with prefix, postfix, and left- and right-associative infix operators.
ExpressionFunction<R extends Object>
A function is a piece of dart code that performs a specific task.
ExpressionGroup2<T>
Models a group of operators of the same precedence.
ExpressionResultInfix<V, O>
Encapsulates a infix operation.
ExpressionResultPostfix<V, O>
Encapsulates a postfix operation.
ExpressionResultPrefix<V, O>
ExpressionTag
ExpressionWithSourcePosition<T extends Object>
FileTemplate
FunctionDocumentation
FunctionExpression<R extends Object>
FunctionGroup
GreaterThanOperator
GreaterThanOrEqualOperator
HtmlTableRow
HtmlTableWriter
HttpTemplate
IdentifierName
** IdentifierName's e.g. for variables, constants, functions, parameters and arguments: **
ImportedTemplate
ImportedTemplateParseErrors
ImportFunctions
ImportJson
ImportPure
ImportTemplate
ImportXml
ImportYaml
IntermediateRenderResult
InvalidTagParser
This Parser looks for any remaining tags that where not recognized by the Parsers. It will return this unknown tag as a String and add detailed error(s) to the ParserContext.
LessThanOperator
LessThanOrEqualOperator
Log
MathFunctions
ModuloOperator
Multiplication
MultiplyOperator
NegativeOperator
NotEqualsOperator
NotOperator
Number
Operator
An Operator behaves generally like functions, but differs syntactically or semantically.
OperatorDocumentation
OperatorGroup
OperatorVariantExpression
delegates the work to one of the variants that can process the correct types of the evaluated left and right values.
OperatorWith2Values
OrOperator
OverrideMessageParser<R>
Overrides the error message when the super.delegate fails.
Parameter<T>
A ExpressionFunction can have 0 or more Parameters. An Parameter:
ParameterName
A ParameterName:
Parentheses
ParenthesesOperator
ParserContext
ParseResult
The result of parsing one or more Templates
ParserTree<T>
The ParserTree contains parsed nodes from a Template that can be rendered to a IntermediateRenderResult.
PathFunctions
PositiveOperator
Prefixes
PrefixExpression<PARAMETER_TYPE extends Object>
PrefixOperator<PARAMETER_TYPE extends Object>
Presence
ProjectFilePath
QuotesString
RenderContext
Renderer<T>
Renders some value depending on the implementation of the Renderer
RenderResult
RenderType
Types returned by the Renderer.render method or the Type of ParserTree.children are normally one of the following:
Round
Sin
Sqrt
StandardTags
StringFunctions
StringLength
SubtractOperator
Tag<T extends Object>
Tags are specific texts in Templates that are replaced by the TemplateEngine with other information.
TagDocumentation
TagName
A TagName:
Tan
Template
A template is a text that can contain Tags. This text is parsed by the TemplateEngine into Renderers. These Renderers render a new text. TagRenderers are replaced with some other text, depending on the implementation of the TagRenderer
TemplateEngine
The TemplateEngine can:
TemplateParseResult
The result of parsing a single Template
TemplateRenderResult
contains the RenderResult of a Template
TemplateSource
TemplatesRenderResult
contains the RenderResult of one or more Template
TextTemplate
TitleLevelParameter
TwoValueOperatorVariant<LEFT_TYPE extends Object, RIGHT_TYPE extends Object>
Value<T extends Object>
A Value Expression holds a value that does not change when rendered (evaluated). e.g. it can be like a num, bool, String etc...
ValueContextMapParser<R, S>
A parser that performs a transformation with a given function on the successful parse result of the delegate.
Variable
A variable is a named container for some type of information (like num, bool, String etc...)
VariableDocumentation
VariableExamples
VariableExpression
An expression to return a variable value
VariableName
The VariableName identifies the Variable and corresponds with the keys in the VariableMap map.
VariableValue
VariableValues must be one of the following types:

Enums

CellType
OperatorAssociativity
the associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses. If an operand is both preceded and followed by operators, and those operators have equal precedence, then the operand may be used as input to two different operations (i.e. the two operations indicated by the two operators). The choice of which operations to apply the operand to, is determined by the associativity of the operators.

Extensions

EndWithBetterFailureExtension on Parser<R>
ValueContextMapParserExtension on Parser<R>

Properties

isTemplateEngineProject bool
no setter

Functions

buildChoice<R>(List<Parser<R>> parsers) → Parser<R>
constantParser(List<Constant> constants) → Parser<Expression<Object>>
dataTypeParsers(List<DataType<Object>> dataTypes) List<Parser<Expression<Object>>>
delegatingParser({required List<Parser<Object>> delegates, required String tagStart, required String tagEnd}) → Parser<List<Object>>
A delegatingParser delegates to work to other parsers. Text that is not handled by the delegates will also be collected
escapedTagEndParser(String tagEnd) → Parser<String>
Replaces an escaped Tag end (e.g. : }} ) to a String e.g. containing: }} (without escape) so that it is not parsed as a Tag or Variable
escapedTagStartParser(String tagStart) → Parser<String>
Replaces an escaped Tag start (e.g. : {{ ) to a String e.g. containing: {{ (without escape) so that it is not parsed as a Tag or Variable
expressionParser(ParserContext parserContext, {bool verboseErrors = false}) → Parser<Expression<Object>>
functionParser({required ParserContext context, required ExpressionFunction<Object> function, required SettableParser loopbackParser}) → Parser<Expression<Object>>
functionsParser({required ParserContext context, required SettableParser loopback, required bool verboseErrors}) → Parser<Expression<Object>>
missingTagEndParser(ParserContext parserContext) → Parser<String>
they are both present they would have been parsed already. It replaces the Tag end to a String e.g. containing: {{
missingTagStartParser(ParserContext parserContext) → Parser<String>
Adds an error if a Tag end is found but not a Tag start. It replaces the Tag end to a String e.g. containing: }}
namedArgumentParser({required ParserContext parserContext, required Parameter parameter, required SettableParser loopbackParser}) ArgumentEntryParser
Accepts a name=value expression and converts it to a ArgumentEntry Returns a parser that returns the value of an ExpressionFunction parameter It uses a loopback parser which is an expressionParser so that it can parse any known expression to a parameter value. The loopbackParser is a SettableParser because the expressionParser does not exist when this namedArgumentParser is created.
optionalWhiteSpace() → Parser<String>
positionalArgumentParser({required ParserContext parserContext, required dynamic positionalParameter, required List<Parameter> parameters, required SettableParser loopbackParser}) ArgumentEntryParser
Accepts a value expression (not starting with name=) and converts it to a ArgumentEntry It uses a loopback parser which is an expressionParser so that it can parse any known expression to a parameter value. The loopbackParser is a SettableParser because the expressionParser does not exist when this positionalArgumentParser is created.
readFromFilePath(String source) Future<String>
Reads a file from a operation systems File Path/
readFromFileUri(String source) Future<String>
Reads from a File URI scheme. This includes a ProjectFilePath.
readFromHttpUri(String source) Future<String>
readSource(String source) Future<String>
source is the location of a file. source can be a File.path, ProjectFilePath or Uri
templateParser(ParserContext context) → Parser<List<Object>>
Creates a parser that can convert a Template text to a parse tree containing Renderers.
typeDescription<T>() String
untilEndOfTagParser(String tagStart, String tagEnd) → Parser<String>
untilEndParser() → Parser<String>
variableParser(Template template) → Parser<Expression<Object>>

Typedefs

ArgumentEntry = MapEntry<String, Expression<Object>>
ArgumentEntryParser = Parser<ArgumentEntry>
Arguments = Map<String, Object>
Arguments is a Map of parameter names and values
Callback2<T, R> = R Function(T value, Context context)
We pass the parse position so that errors and or warnings can be logged with the current parse position within the Template
DataMap = Map<String, dynamic>
A DataMap is a structure that stores information with keys and values. The key is a name that identifies a value A value can is normally on of the following types:
VariableMap = DataMap
  • Variables are stored as key, value pairs in a dart Map<String, dynamic> where:
    • String=Variable name
    • dynamic=Variable value
  • Variables can be used in an ExpressionTag
  • Initial variable values are passed to the TemplateEngine.render method
  • Variables can be modified during rendering
  • Exceptions / Errors

    FunctionException
    IdentifierException
    ImportError
    ParameterException
    ParameterExceptions
    ParseError
    RenderError
    RenderException
    TagException
    TemplateError
    Parser or Render error or warnings are collected as TemplateErrors instead of being thrown so that the parser and rendering process can continue. This way the caller can see and fix all TemplateErrors without having to fix and recall the TemplateEngine.parse and TemplateEngine.render methods for each TemplateError
    UnsupportedSourceException
    VariableException