public class SyntaxTreeBuilder extends Object
DepthFirstAdapter
and passing it to
Start.apply(com.google.clearsilver.jsilver.syntax.node.Switch)
.
SyntaxTreeBuilder builder = new SyntaxTreeBuilder(); Start tree = builder.parse(myTemplate, "some-template.cs"); // Dump out the tree tree.apply(new SyntaxTreeDumper(System.out));
Modifier and Type | Field and Description |
---|---|
protected Switch |
inlineRewriter |
protected Switch |
sequenceOptimizer |
protected Switch |
typeResolver
Syntax tree optimizers, declared in the order they must be applied:
Type resultion makes the abstract tree concrete and must come first.
|
protected Switch |
varOptimizer |
Constructor and Description |
---|
SyntaxTreeBuilder() |
Modifier and Type | Method and Description |
---|---|
TemplateSyntaxTree |
parse(Reader input,
String templateName,
EscapeMode escapeMode) |
protected void |
process(Start root,
EscapeMode escapeMode,
String templateName)
Perform any additional processing on the tree.
|
protected final Switch typeResolver
protected final Switch sequenceOptimizer
protected final Switch inlineRewriter
protected final Switch varOptimizer
protected void process(Start root, EscapeMode escapeMode, String templateName)
root
- The AST to post process.escapeMode
- The escaping mode to apply to the given AST. If this is not
EscapeMode.ESCAPE_NONE, AutoEscaper will be called on the AST.templateName
- The name of template being processed. Passed to AutoEscaper, which uses it
when displaying error messages.public TemplateSyntaxTree parse(Reader input, String templateName, EscapeMode escapeMode) throws JSilverIOException, JSilverBadSyntaxException
templateName
- Used for meaningful error messages.escapeMode
- Run AutoEscaper
on the abstract syntax tree created from template.JSilverIOException
JSilverBadSyntaxException
Copyright © 2010–2015 Google. All rights reserved.