- All Superinterfaces:
ContentHandler<RuntimeException>,ControlHandler<RuntimeException>,TokenErrorHandler<RuntimeException>,TokenHandler3<RuntimeException>
- All Known Subinterfaces:
TokenHandler
- All Known Implementing Classes:
CommentRemovalHandler,MinificationHandler
A
TokenHandler3 that has no checked exceptions, backwards-compatible
with TokenProducer 2.x.
Most token handlers will report problems through error handlers and produce
no checked exceptions, in which case you should use this handler together
with TokenProducer. In other use cases your handler may want to throw
checked exceptions, and then you must use TokenProducer3 together
with TokenHandler3 instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcharacter(int index, int codePoint) Other characters including punctuation (excluding connector punctuation) and symbols (Sc, Sm and Sk unicode categories) was found, that was not one of the non-alphanumeric characters allowed in words.voidA commented string was found by the parser.voidcontrol(int index, int codePoint) A control character codepoint was found.voidendOfStream(int len) The stream that was being parsed reached its end.default voidendPunctuation(int index, int codePoint) Called when end punctuation (Pe) codepoints are found (except characters handled byrightCurlyBracket(int),rightParenthesis(int)andrightSquareBracket(int)).voiderror(int index, byte errCode, CharSequence context) An error was found while parsing.voidescaped(int index, int codePoint) A codepoint preceded with a backslash was found outside of quoted text.voidleftCurlyBracket(int index) Called when the{codepoint is found.voidleftParenthesis(int index) Called when the(codepoint is found.voidleftSquareBracket(int index) Called when the[codepoint is found.voidquoted(int index, CharSequence quoted, int quote) A quoted string was found by the parser.voidquotedNewlineChar(int index, int codePoint) An unescaped FF/LF/CR control was found while assembling a quoted string.voidquotedWithControl(int index, CharSequence quoted, int quoteCp) A quoted string was found by the parser, and contains control characters.voidrightCurlyBracket(int index) Called when the}codepoint is found.voidrightParenthesis(int index) Called when the)codepoint is found.voidrightSquareBracket(int index) Called when the]codepoint is found.voidseparator(int index, int codePoint) A separator (Zs, Zl and Zp unicode categories) was found.default voidstartPunctuation(int index, int codePoint) Called when start punctuation (Ps) codepoints are found (except characters handled byleftCurlyBracket(int),leftParenthesis(int)andleftSquareBracket(int)).voidtokenStart(TokenControl control) At the beginning of parsing, this method is called, passing theTokenControlobject that can be used to fine-control the parsing.voidword(int index, CharSequence word) A word was found by the parser (includes connector punctuation).
-
Method Details
-
tokenStart
At the beginning of parsing, this method is called, passing theTokenControlobject that can be used to fine-control the parsing.- Specified by:
tokenStartin interfaceControlHandler<RuntimeException>- Parameters:
control- theTokenControlobject in charge of parsing.
-
word
A word was found by the parser (includes connector punctuation).- Specified by:
wordin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the word was found.word- the word.
-
separator
void separator(int index, int codePoint) A separator (Zs, Zl and Zp unicode categories) was found.- Specified by:
separatorin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the separator was found.codePoint- the codepoint of the found separator.
-
quoted
A quoted string was found by the parser.- Specified by:
quotedin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the quoted string was found.quoted- the quoted sequence of characters, without the quotes.quote- the quote character.
-
quotedWithControl
A quoted string was found by the parser, and contains control characters.- Specified by:
quotedWithControlin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the quoted string was found.quoted- the quoted sequence of characters, without the quotes.quoteCp- the quote character codepoint.
-
quotedNewlineChar
void quotedNewlineChar(int index, int codePoint) An unescaped FF/LF/CR control was found while assembling a quoted string.- Specified by:
quotedNewlineCharin interfaceControlHandler<RuntimeException>- Parameters:
index- the index at which the control was found.codePoint- the FF/LF/CR codepoint.
-
leftParenthesis
void leftParenthesis(int index) Called when the(codepoint is found.- Specified by:
leftParenthesisin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
leftSquareBracket
void leftSquareBracket(int index) Called when the[codepoint is found.- Specified by:
leftSquareBracketin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
leftCurlyBracket
void leftCurlyBracket(int index) Called when the{codepoint is found.- Specified by:
leftCurlyBracketin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
rightParenthesis
void rightParenthesis(int index) Called when the)codepoint is found.- Specified by:
rightParenthesisin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
rightSquareBracket
void rightSquareBracket(int index) Called when the]codepoint is found.- Specified by:
rightSquareBracketin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
rightCurlyBracket
void rightCurlyBracket(int index) Called when the}codepoint is found.- Specified by:
rightCurlyBracketin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.
-
startPunctuation
default void startPunctuation(int index, int codePoint) Called when start punctuation (Ps) codepoints are found (except characters handled byleftCurlyBracket(int),leftParenthesis(int)andleftSquareBracket(int)).- Specified by:
startPunctuationin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.codePoint- the found codepoint.
-
endPunctuation
default void endPunctuation(int index, int codePoint) Called when end punctuation (Pe) codepoints are found (except characters handled byrightCurlyBracket(int),rightParenthesis(int)andrightSquareBracket(int)).- Specified by:
endPunctuationin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the codepoint was found.codePoint- the found codepoint.
-
character
void character(int index, int codePoint) Other characters including punctuation (excluding connector punctuation) and symbols (Sc, Sm and Sk unicode categories) was found, that was not one of the non-alphanumeric characters allowed in words.Symbols in So category are considered part of words and won't be handled by this method.
- Specified by:
characterin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the punctuation was found.codePoint- the codepoint of the found punctuation.
-
escaped
void escaped(int index, int codePoint) A codepoint preceded with a backslash was found outside of quoted text.- Specified by:
escapedin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the escaped codepoint was found.codePoint- the escaped codepoint.
-
control
void control(int index, int codePoint) A control character codepoint was found.- Specified by:
controlin interfaceControlHandler<RuntimeException>- Parameters:
index- the index at which the control codepoint was found.codePoint- the control codepoint.
-
commented
A commented string was found by the parser.- Specified by:
commentedin interfaceContentHandler<RuntimeException>- Parameters:
index- the index at which the commented string was found.commentType- the type of comment.comment- the commented string.
-
endOfStream
void endOfStream(int len) The stream that was being parsed reached its end.- Specified by:
endOfStreamin interfaceContentHandler<RuntimeException>- Parameters:
len- the length of the processed stream.
-
error
An error was found while parsing.Something was found that broke the assumptions made by the parser, like an escape character at the end of the stream or an unmatched quote.
- Specified by:
errorin interfaceTokenErrorHandler<RuntimeException>- Parameters:
index- the index at which the error was found.errCode- the error code.context- a context sequence. If a string was parsed, it will contain up to 16 characters before and after the error.
-