Modifier and Type | Field and Description |
---|---|
protected CompilationContext |
context |
protected parsii.tokenizer.LookaheadReader |
reader |
Constructor and Description |
---|
Compiler(CompilationContext context,
String input)
Creates a new compiler for the given context and input.
|
Modifier and Type | Method and Description |
---|---|
List<CompileError> |
compile()
Compiles the given source into the template in the given
CompilationContext . |
void |
consumeExpectedCharacter(char expectedCharacter)
Consumes the expected character from the input.
|
CompilationContext |
getContext()
Returns the current context.
|
parsii.tokenizer.LookaheadReader |
getReader() |
boolean |
isAtText(int offset,
String text) |
protected CompositeEmitter |
parseBlock(TagHandler parentHandler,
String waitFor)
Parses a block within the input until a stop sequence is reached.
|
Expression |
parseExpression(boolean skipWhitespaces)
Parses an expression.
|
int |
skipWhitespaces()
Skips all whitespace characters at the current input location.
|
String |
toString() |
protected parsii.tokenizer.LookaheadReader reader
protected CompilationContext context
public Compiler(CompilationContext context, String input)
context
- the context to operate oninput
- the input to compilepublic List<CompileError> compile() throws CompileException
CompilationContext
.
Note that this can only be invoked once per instance.
CompileException
- in case one or more errors
occured.protected CompositeEmitter parseBlock(@Nullable TagHandler parentHandler, @Nullable String waitFor)
parentHandler
- the outer tag handler if presentwaitFor
- the sequence to determine that the block is completely processedpublic Expression parseExpression(boolean skipWhitespaces)
skipWhitespaces
- determines if the parser should stop at a whitespace or continue.public CompilationContext getContext()
public int skipWhitespaces()
public void consumeExpectedCharacter(char expectedCharacter)
If the input does not point to the given character, nothing will be consumed and en error created.
expectedCharacter
- the expected characterpublic boolean isAtText(int offset, String text)
public parsii.tokenizer.LookaheadReader getReader()
Copyright © 2018. All rights reserved.