Class TemplateParser
java.lang.Object
gg.jte.compiler.TemplateParser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classprivate static classprivate static classstatic interfaceprivate static classprivate static classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TemplateConfigprivate final ContentTypeprivate charprivate TemplateParser.HtmlTagprivate TemplateParser.Modeprivate intprivate intprivate final booleanprivate final HtmlPolicyprivate final Deque<TemplateParser.HtmlTag> private final String[]private intprivate final Deque<TemplateParser.Indent> private List<TemplateParser.Mode> private intprivate intprivate intprivate booleanprivate booleanprivate charprivate TemplateParser.Modeprivate final Deque<TemplateParser.Mode> private intprivate booleanprivate final Stringprivate final booleanprivate final TemplateTypeprivate final TemplateParserVisitor -
Constructor Summary
ConstructorsConstructorDescriptionTemplateParser(String templateCode, TemplateType type, TemplateParserVisitor visitor, TemplateConfig config) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanareParamsComplete(int startIndex) private voidprivate intcountBefore(char c) private voiddoParse(int startingDepth) private voidextract(String templateCode, int startIndex, int endIndex, TemplateParser.VisitorCallback callback) private voidprivate voidextractComment(TemplateParser.Mode mode, int startIndex) private voidprivate voidprivate voidextractTextPart(int endIndex, TemplateParser.Mode mode) private voidextractTextPartAndTrimControlStructures(int endIndex, TemplateParser.Mode mode) private voidextractTrimmed(int startIndex, int endIndex) private intprivate intprivate <T extends TemplateParser.Mode>
TgetPreviousMode(Class<T> modeClass) private voidhandleStringLiterals(char quote) private voidprivate voidprivate booleanprivate booleanprivate booleanprivate booleanisHtmlAttributeSingleOutput(int nameEndIndex, char quotes) private booleanprivate booleanisHtmlTagIntercepted(String name) private booleanisIndentationCharacter(char c) private booleanprivate booleanprivate booleanprivate booleanprivate charnextChar()voidparse()voidparse(int startingDepth) private TemplateParser.HtmlAttributeprivate charparseHtmlAttributeQuotes(int index) private StringparseHtmlTagName(int index) private voidpop()private voidprivate voidprivate voidpush(TemplateParser.Mode mode) private voidpushHtmlTag(TemplateParser.HtmlTag htmlTag) private voidpushIndent(int endIndex, TemplateParser.Mode mode) private booleanvoidsetEndIndex(int endIndex) voidsetInitialModes(List<TemplateParser.Mode> initialModes) voidsetParamsComplete(boolean paramsComplete) voidsetStartIndex(int startIndex) private StringtrimIndentations(int startIndex, int endIndex, int indentationsToSkip)
-
Field Details
-
templateCode
-
type
-
visitor
-
config
-
contentType
-
htmlPolicy
-
htmlTags
-
trimControlStructures
private final boolean trimControlStructures -
htmlCommentsPreserved
private final boolean htmlCommentsPreserved -
stack
-
indentStack
-
htmlStack
-
currentMode
-
previousControlStructureTrimmed
-
initialModes
-
currentHtmlTag
-
depth
private int depth -
paramsComplete
private boolean paramsComplete -
outputPrevented
private boolean outputPrevented -
tagClosed
private boolean tagClosed -
i
private int i -
startIndex
private int startIndex -
endIndex
private int endIndex -
lastIndex
private int lastIndex -
lastLineIndex
private int lastLineIndex -
lastTrimmedIndex
private int lastTrimmedIndex -
previousChar
private char previousChar -
currentChar
private char currentChar
-
-
Constructor Details
-
TemplateParser
public TemplateParser(String templateCode, TemplateType type, TemplateParserVisitor visitor, TemplateConfig config)
-
-
Method Details
-
setStartIndex
public void setStartIndex(int startIndex) -
setEndIndex
public void setEndIndex(int endIndex) -
setInitialModes
-
setParamsComplete
public void setParamsComplete(boolean paramsComplete) -
parse
public void parse() -
parse
public void parse(int startingDepth) -
doParse
private void doParse(int startingDepth) -
countBefore
private int countBefore(char c) -
nextChar
private char nextChar() -
regionMatches
-
lookAheadRegionMatches
-
handleUnclosedKeywords
private void handleUnclosedKeywords() -
getCurrentTemplateLine
private int getCurrentTemplateLine() -
isCommentAllowed
private boolean isCommentAllowed() -
isParamOrImportAllowed
private boolean isParamOrImportAllowed() -
areParamsComplete
private boolean areParamsComplete(int startIndex) -
isContentExpressionAllowed
private boolean isContentExpressionAllowed() -
extractTextPart
-
extractTextPartAndTrimControlStructures
-
extractTrimmed
private void extractTrimmed(int startIndex, int endIndex) -
trimIndentations
-
pushIndent
-
popIndent
private void popIndent() -
isIndentationCharacter
private boolean isIndentationCharacter(char c) -
getIndentationsToSkip
private int getIndentationsToSkip() -
extractCodePart
private void extractCodePart() -
extractPlainCodePart
private void extractPlainCodePart() -
extractHtmlCodePart
private void extractHtmlCodePart() -
extractComment
-
isHtmlCommentAllowed
private boolean isHtmlCommentAllowed() -
isCssCommentAllowed
private boolean isCssCommentAllowed() -
isJsCommentAllowed
private boolean isJsCommentAllowed() -
interceptHtmlTags
private void interceptHtmlTags() -
handleStringLiterals
private void handleStringLiterals(char quote) -
isOpeningHtmlTag
private boolean isOpeningHtmlTag() -
pushHtmlTag
-
popHtmlTag
private void popHtmlTag() -
parseHtmlTagName
-
parseHtmlAttribute
-
parseHtmlAttributeQuotes
private char parseHtmlAttributeQuotes(int index) -
isHtmlAttributeSingleOutput
private boolean isHtmlAttributeSingleOutput(int nameEndIndex, char quotes) -
isHtmlTagIntercepted
-
push
-
pop
private void pop() -
getPreviousMode
-
extract
private void extract(String templateCode, int startIndex, int endIndex, TemplateParser.VisitorCallback callback) -
completeParamsIfRequired
private void completeParamsIfRequired()
-