public abstract class AbstractCharScannerSyntax extends StringSyntaxBean implements CharScannerSyntax
CharScannerSyntax
interface. char
s like escape
are realized as simple bean-properties and initialized with
'\0'
so they are disabled by default.CharStreamScanner.readUntil(char, boolean, CharScannerSyntax)
Modifier and Type | Field and Description |
---|---|
private char |
altQuoteEnd |
private char |
altQuoteEscape |
private boolean |
altQuoteEscapeLazy |
private char |
altQuoteStart |
private char |
entityEnd |
private char |
entityStart |
private char |
quoteEscape |
private boolean |
quoteEscapeLazy |
Constructor and Description |
---|
AbstractCharScannerSyntax()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
char |
getAltQuoteEnd()
This method gets the alternative character used to end a quotation.
|
char |
getAltQuoteEscape()
This method gets the character used to escape the
alt-quote-end character within an
quotation opened by alt-quote-start . |
char |
getAltQuoteStart()
This method gets the alternative character used to start a quotation that should be terminated by a
alt-quote-end character. |
char |
getEntityEnd()
This method gets the character used to end an entity.
|
char |
getEntityStart()
This method gets the character used to start an entity.
|
char |
getQuoteEscape()
This method gets the character used to escape the
quote-end character within a quotation. |
boolean |
isAltQuoteEscapeLazy()
If
alt-quote-start , alt-quote-end and
alt-quote-escape all point to the same character (which is NOT '\0' ), then
this method determines if alt-quotation escaping is lazy. |
boolean |
isQuoteEscapeLazy()
If
quote-start , quote-end and quote-escape all point to the same character (which is NOT '\0' ), then this method determines if
quotation escaping is lazy. |
String |
resolveEntity(String entity)
This method resolves the given
entity . |
void |
setAltQuote(char altQuote)
This method sets both the
alt-quote-start and alt-quote-end
character. |
void |
setAltQuoteEnd(char alternativeQuoteEnd)
This method sets the
alt-quote-end character. |
void |
setAltQuoteEscape(char altQuoteEscape) |
void |
setAltQuoteEscapeLazy(boolean altQuoteEscapeLazy) |
void |
setAltQuoteStart(char alternativeQuoteStart) |
void |
setEntityEnd(char entityEnd) |
void |
setEntityStart(char entityStart) |
void |
setQuoteEscape(char quoteEscape) |
void |
setQuoteEscapeLazy(boolean quoteEscapeLazy) |
getEscape, getQuoteEnd, getQuoteStart, setEscape, setQuote, setQuoteEnd, setQuoteStart
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEscape
getQuoteEnd, getQuoteStart
private char quoteEscape
private boolean quoteEscapeLazy
private char altQuoteStart
private char altQuoteEnd
private char altQuoteEscape
private boolean altQuoteEscapeLazy
private char entityStart
private char entityEnd
public char getQuoteEscape()
CharScannerSyntax
quote-end
character within a quotation.
This may be the quote-end
itself so a duplicate quote-end
represents
a single occurrence of that character within a quotation. Otherwise the escape may be any other character. quote-start
and
only escapes the quote-end
character and nothing else so in any other case the
quote-escape
is treated as a regular character. quote-start |
quote-end |
quote-escape |
input | output |
---|---|---|---|---|
' | ' | ' | a'bc'd | abcd |
' | ' | ' | a'b''c'd | ab'cd |
' | ' | \ | a'b\c\'d\\'e'f | ab\c'd\'ef |
getQuoteEscape
in interface CharScannerSyntax
quote-end
character or '\0'
to disable.public void setQuoteEscape(char quoteEscape)
quoteEscape
- is the quote-escape
to set.public boolean isQuoteEscapeLazy()
CharScannerSyntax
quote-start
, quote-end
and quote-escape
all point to the same character (which is NOT '\0'
), then this method determines if
quotation escaping
is 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. quote-start |
quote-end |
quote-escape |
quote-escape-lazy |
input | output |
---|---|---|---|---|---|
' | ' | ' | true | '' | ' |
' | ' | ' | false | '' | |
' | ' | ' | true | '''' | '' |
' | ' | ' | false | '''' | ' |
' | ' | ' | true | '''a' | 'a |
' | ' | ' | false | '''a' | 'a |
'''a'
the complete sequence is treated as quote if quote-escape-lazy
is false
and otherwise just the trailing 'a'
.isQuoteEscapeLazy
in interface CharScannerSyntax
true
if quote-escaping is lazy, false
otherwise.public void setQuoteEscapeLazy(boolean quoteEscapeLazy)
quoteEscapeLazy
- the quote-escape-lazy
flag to setpublic char getAltQuoteStart()
alt-quote-end
character. The text inside the quote is taken as is (without the quote
characters).getAltQuoteStart
in interface CharScannerSyntax
'\0'
for no quotation.StringSyntaxBean.getQuoteStart()
public void setAltQuoteStart(char alternativeQuoteStart)
alternativeQuoteStart
- is the alt-quote-start
character to set.public char getAltQuoteEnd()
getAltQuoteEnd
in interface CharScannerSyntax
getAltQuoteStart()
public void setAltQuoteEnd(char alternativeQuoteEnd)
alt-quote-end
character.alternativeQuoteEnd
- is the alt-quote-end
character.public void setAltQuote(char altQuote)
alt-quote-start
and alt-quote-end
character.altQuote
- the alt-quote character to set.public char getAltQuoteEscape()
CharScannerSyntax
alt-quote-end
character within an
quotation opened by alt-quote-start
.getAltQuoteEscape
in interface CharScannerSyntax
quote-end
character or '\0'
to disable.CharScannerSyntax.getQuoteEscape()
public void setAltQuoteEscape(char altQuoteEscape)
altQuoteEscape
- is the alt-quote-escape
to set.public boolean isAltQuoteEscapeLazy()
CharScannerSyntax
alt-quote-start
, alt-quote-end
and
alt-quote-escape
all point to the same character (which is NOT '\0'
), then
this method determines if alt-quotation escaping
is lazy.isAltQuoteEscapeLazy
in interface CharScannerSyntax
true
if alt-quote-escaping is lazy, false
otherwise.CharScannerSyntax.isQuoteEscapeLazy()
public void setAltQuoteEscapeLazy(boolean altQuoteEscapeLazy)
altQuoteEscapeLazy
- the alt-quote-lazy
flag to setpublic char getEntityStart()
CharScannerSyntax
entity-start
and entity-end
. It will be decoded by
CharScannerSyntax.resolveEntity(String)
.getEntityStart
in interface CharScannerSyntax
'\0'
to disable.public void setEntityStart(char entityStart)
entityStart
- the entity-start
to set.public char getEntityEnd()
CharScannerSyntax
getEntityEnd
in interface CharScannerSyntax
CharScannerSyntax.getEntityStart()
public void setEntityEnd(char entityEnd)
entityEnd
- the entity-end
to set.public String resolveEntity(String entity)
entity
. entity-start
is '&'
and CharScannerSyntax.getEntityEnd()
is ';'
then if
the string "<"
is scanned, this method is called with "lt"
as entity
argument and may
return "<"
.
ATTENTION:use
entities.resolveEntity
in interface CharScannerSyntax
entity
- is the entity string that was found surrounded by entity-start
and
entity-end
excluding these characters.Copyright © 2001–2016 mmm-Team. All rights reserved.