public abstract class DefaultHandler extends Object implements Handler
Handler that provides a starting point for
implementing custom handlers. This handler provides methods for handling
different types of tokens without having to check their type.| Constructor and Description |
|---|
DefaultHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
done()
Indicates that there are no more events to process.
|
void |
endAttribute(Location location,
TokenProperty<?> property)
An attribute has been cleared.
|
void |
endParagraph(Location location)
A paragraph has ended.
|
void |
endSentence(Location location)
The end of a sentence has been found.
|
protected void |
special(Token token)
Special token has been found.
|
void |
start()
Processing is starting.
|
void |
startAttribute(Location location,
TokenProperty<?> property,
Object value)
An attribute has been set by the source.
|
void |
startParagraph(Location location)
A new paragraph has been started.
|
void |
startSentence(Location location)
The start of a sentence has been found.
|
protected void |
symbol(Token token)
A sequence of one or more symbols has been found in a sentence.
|
void |
token(Token token)
Token has been found, can either be whitespace, symbol or word.
|
protected void |
unknown(Token token)
Unknown token has been found, uncommon case as most language
implementations will not emit unknown tokens.
|
protected void |
whitespace(Token token)
Whitespace either within our outside a sentence.
|
protected void |
word(Token token)
A word has been found in a sentence.
|
public void start()
Handlerpublic void startParagraph(Location location)
HandlerstartParagraph in interface Handlerlocation - the location of the paragraph. Locations are shared, the user should
copy the location if it needs to be used outside the current method.public void endParagraph(Location location)
HandlerendParagraph in interface Handlerlocation - the location of the paragraph end. Locations are shared, the user
should copy the location if it needs to be used outside the current
method.public void startSentence(Location location)
HandlerstartSentence in interface Handlerlocation - the location of the sentence. Locations are shared, the user should
copy the location if it needs to be used outside the current method.public void endSentence(Location location)
HandlerendSentence in interface Handlerlocation - the location of the sentence end. Locations are shared, the user
should copy the location if it needs to be used outside the current
method.public void startAttribute(Location location, TokenProperty<?> property, Object value)
HandlerstartAttribute in interface Handlerlocation - the location where the property is started. Locations are shared, the
user should copy the location if it needs to be used outside the
current method.property - the property to setvalue - the value of the propertypublic void endAttribute(Location location, TokenProperty<?> property)
HandlerendAttribute in interface Handlerlocation - the location where the property is ended. Locations are shared, the
user should copy the location if it needs to be used outside the
current method.public void token(Token token)
Handlertoken in interface Handlertoken - the token that has been found. Tokens are shared and should be copied
via Token.copy() if they need to be used outside of the current
method.public void done()
Handlerprotected void word(Token token)
token - the token representing the word.protected void symbol(Token token)
token - the token representing the symbol.protected void whitespace(Token token)
token - protected void special(Token token)
token - protected void unknown(Token token)
Copyright © 2018. All rights reserved.