-
- All Known Implementing Classes:
CharScannerSyntaxBean
public interface CharScannerSyntaxThis is the interface used to define the syntax to scan characters.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description chargetAltQuoteEnd()This method gets the alternative character used to end a quotation.chargetAltQuoteEscape()This method gets the character used to escape thealt-quote-endcharacter within an quotation opened byalt-quote-start.chargetAltQuoteStart()This method gets the alternative character used to start a quotation that should be terminated by aalt-quote-endcharacter.chargetEntityEnd()This method gets the character used to end an entity.chargetEntityStart()This method gets the character used to start an entity.chargetEscape()This method gets the character used as escape.chargetQuoteEnd()This method gets the character used to end a quotation.chargetQuoteEscape()This method gets the character used to escape thequote-endcharacter within a quotation.chargetQuoteStart()This method gets the character used to start a quotation that should be terminated by aquote-endcharacter.booleanisAltQuoteEscapeLazy()Ifalt-quote-start,alt-quote-endandalt-quote-escapeall point to the same character (which is NOT'\0'), then this method determines ifalt-quotation escapingis lazy.booleanisQuoteEscapeLazy()Ifquote-start,quote-endandquote-escapeall point to the same character (which is NOT'\0'), then this method determines ifquotation escapingis lazy.StringresolveEntity(String entity)This method resolves the givenentity.
-
-
-
Method Detail
-
getQuoteStart
char getQuoteStart()
This method gets the character used to start a quotation that should be terminated by aquote-endcharacter. The text inside the quote is taken as is (without the quote characters).
Common examples for quote characters are the single quotes (') and double quotes (").- Returns:
- the character used to start a quotation or
'\0'to disable.
-
getQuoteEnd
char getQuoteEnd()
This method gets the character used to end a quotation.- Returns:
- the character used to end a quotation or
'\0'to disable. - See Also:
getQuoteStart()
-
getEscape
char getEscape()
This method gets the character used as escape. It is used to mark special characters likegetQuoteStart()to allow these characters also in the payload. The escape itself is removed on decoding while the next character is taken as is without any special interpretation.
The most common escape character is the backslash (\).
Here are some examples for decoding:
This allows to encode special characters like aescapeinput output \ a\b\\c ab\c ~ a~b~~~c ab~c stop-character,quote-start,alt-quote-start, as well as theescapeitself.
ATTENTION:
Theescapeis disabled withinquotations.- Returns:
- the escape character or
'\0'for no escaping. - See Also:
getEntityStart()
-
getQuoteEscape
char getQuoteEscape()
This method gets the character used to escape thequote-endcharacter within a quotation. This may be thequote-enditself so a duplicatequote-endrepresents a single occurrence of that character within a quotation. Otherwise the escape may be any other character.
Please note that this escaping is only active within a quotation opened byquote-startand only escapes thequote-endcharacter and nothing else so in any other case thequote-escapeis treated as a regular character.
quote-startquote-endquote-escapeinput output ' ' ' a'bc'd abcd ' ' ' a'b''c'd ab'cd ' ' \ a'b\c\'d\\'e'f ab\c'd\'ef - Returns:
- the character used to escape the
quote-endcharacter or'\0'to disable.
-
isQuoteEscapeLazy
boolean isQuoteEscapeLazy()
Ifquote-start,quote-endandquote-escapeall point to the same character (which is NOT'\0'), then this method determines ifquotation escapingis lazy. This means that outside a quotation a double occurrence of the quote character is NOT treated as quotation but as escaped quote character. Otherwise if NOT lazy, the double quote character is treated as quotation representing the empty sequence.
Here are some examples:quote-startquote-endquote-escapequote-escape-lazyinput output ' ' ' true '' ' ' ' ' false '' ' ' ' true '''' '' ' ' ' false '''' ' ' ' ' true '''a' 'a ' ' ' false '''a' 'a
Please note that for'''a'the complete sequence is treated as quote ifquote-escape-lazyisfalseand otherwise just the trailing'a'.- Returns:
trueif quote-escaping is lazy,falseotherwise.
-
getAltQuoteStart
char getAltQuoteStart()
This method gets the alternative character used to start a quotation that should be terminated by aalt-quote-endcharacter. The text inside the quote is taken as is (without the quote characters).- Returns:
- the alternative character used to start a quotation or
'\0'to disable. - See Also:
getQuoteStart()
-
getAltQuoteEnd
char getAltQuoteEnd()
This method gets the alternative character used to end a quotation.- Returns:
- the alternative character used to end a quotation.
- See Also:
getAltQuoteStart()
-
getAltQuoteEscape
char getAltQuoteEscape()
This method gets the character used to escape thealt-quote-endcharacter within an quotation opened byalt-quote-start.- Returns:
- the character used to escape the
quote-endcharacter or'\0'to disable. - See Also:
getQuoteEscape()
-
isAltQuoteEscapeLazy
boolean isAltQuoteEscapeLazy()
Ifalt-quote-start,alt-quote-endandalt-quote-escapeall point to the same character (which is NOT'\0'), then this method determines ifalt-quotation escapingis lazy.- Returns:
trueif alt-quote-escaping is lazy,falseotherwise.- See Also:
isQuoteEscapeLazy()
-
getEntityStart
char getEntityStart()
This method gets the character used to start an entity. An entity is a specific encoded string surrounded withentity-startandentity-end. It will be decoded byresolveEntity(String).- Returns:
- the character used to start an entity or
'\0'to disable.
-
getEntityEnd
char getEntityEnd()
This method gets the character used to end an entity.- Returns:
- the character used to end an entity.
- See Also:
getEntityStart()
-
resolveEntity
String resolveEntity(String entity)
This method resolves the givenentity.
E.g. ifentity-startis'&'andgetEntityEnd()is';'then if the string"<"is scanned, this method is called with"lt"asentityargument and may return"<".- Parameters:
entity- is the entity string that was found surrounded byentity-startandentity-endexcluding these characters.- Returns:
- the decoded entity.
-
-