public class TokenReader
extends java.lang.Object
Copyright (C) 2012-2016 JIOWA Business Solutions GmbH, Bettinastr. 30 , 60325 Frankfurt am Main, Germany
Homepage: www.jiowa.de
All rights reserved.
Download: www.jiowa.de/download.html
License: www.jiowa.de/license.html
Modifier and Type | Field and Description |
---|---|
protected TagStartPositionAdjuster |
adjuster |
protected java.lang.StringBuffer |
buf |
protected SecondLevelTokenBuilder |
builder |
protected TemplateContext |
context |
protected ErrorPosition |
errorposition |
protected boolean |
isExternalTemplate |
protected int |
pos |
protected java.util.Queue<Token> |
queue |
protected RedefinitionContentToken |
redefinitionContent |
protected RedefinitionTokenList |
redefTokenList |
protected TokenStateMachine |
statemachine |
protected TextPosition |
textposition |
protected java.util.Iterator<Token> |
tokenIterator |
protected java.util.List<Token> |
tokenList
The tokenList will be delivered in the same way as tokens from a string.
|
Constructor and Description |
---|
TokenReader(boolean isExternalTemplate,
TemplateContext context,
ErrorPosition errorposition)
Constructor for a given template notation and a template as simple string.
|
TokenReader(TemplateContext context,
ErrorPosition errorposition)
Constructor for a given template notation and a template as simple string.
|
TokenReader(TemplateContext context,
java.util.List<Token> tokenList,
ErrorPosition errorposition)
Special constructor.
|
TokenReader(TemplateContext context,
TokenStateMachine statemachineWithGivenState,
ErrorPosition errorposition)
Constructor with a given statemachine (including current state and final state settings).
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<Token> |
buildAdditionalTokens(Token nextToken,
java.lang.String s)
This methods builds additional tokens that are sometimes present between two structural tokens which
haven been taken as states for the tokenization process.
|
protected TextToken |
buildTextToken(java.lang.String s,
TextPosition textposition)
Builds the text token from a string (and removes all quoting characters) and updates the text position.
|
protected void |
changeTemplateNotation()
Changes the template notation according to internatl redefinition content.
|
protected void |
changeTemplateNotation(TemplateNotation newNotation)
Changes the template notation according to the given new template notation.
|
protected void |
checkForEmptyString(java.lang.String s)
Checks for an empty string and logs appropriate error messages
|
protected void |
deliverRedefTokenList()
Delivers the redefinition token list to the
TemplateMapLoader via the TemplateContext . |
Token |
read()
Reads the next token from the template string (and remembers the current state of the reader).
|
protected Token |
read(java.util.SortedSet<SymbolToken> set)
Returns the next token to be read.
|
java.util.List<Token> |
readAll()
Reads all possible tokens at once.
|
protected Token |
readNextToken()
Reads the next token from the text string.
|
protected boolean isExternalTemplate
protected TemplateContext context
protected TokenStateMachine statemachine
protected java.lang.StringBuffer buf
protected int pos
protected java.util.Queue<Token> queue
protected TextPosition textposition
protected ErrorPosition errorposition
protected RedefinitionContentToken redefinitionContent
protected SecondLevelTokenBuilder builder
protected TagStartPositionAdjuster adjuster
protected java.util.List<Token> tokenList
protected java.util.Iterator<Token> tokenIterator
protected RedefinitionTokenList redefTokenList
public TokenReader(boolean isExternalTemplate, TemplateContext context, ErrorPosition errorposition)
isExternalTemplate
- true/false if this template is an external template, i.e. it is not an inline sub templatecontext
- the template contexterrorposition
- the current text position for errors messagespublic TokenReader(TemplateContext context, ErrorPosition errorposition)
context
- the template contexterrorposition
- the current text position for errors messagespublic TokenReader(TemplateContext context, TokenStateMachine statemachineWithGivenState, ErrorPosition errorposition)
context
- the template contextstatemachineWithGivenState
- a TokenStateMachine
with a given state for the parsing processerrorposition
- the current text position for errors messagespublic TokenReader(TemplateContext context, java.util.List<Token> tokenList, ErrorPosition errorposition)
context
- the template contexttokenList
- the list of tokens previously readerrorposition
- the current text position for errors messagespublic Token read()
Token
public java.util.List<Token> readAll()
protected void changeTemplateNotation()
protected void changeTemplateNotation(TemplateNotation newNotation)
newNotation
- the new template notationprotected Token readNextToken()
protected Token read(java.util.SortedSet<SymbolToken> set)
set
- the set of possible SymbolToken
s which could appear after the current text positionprotected TextToken buildTextToken(java.lang.String s, TextPosition textposition)
s
- text contenttextposition
- current text positionprotected java.util.List<Token> buildAdditionalTokens(Token nextToken, java.lang.String s)
protected void deliverRedefTokenList()
TemplateMapLoader
via the TemplateContext
.protected void checkForEmptyString(java.lang.String s)
s
- the string