public class IncludingCharBuf<D> extends Object
TunableParser
, which expands entities by inserting
their expansion text directly into the delivered character stream.
Modifier and Type | Class and Description |
---|---|
protected class |
IncludingCharBuf.CharBuf
Auxiliary class for
IncludingCharBuf , representing exactly
one source of character data, ie the original file or inserted expansions. |
Modifier and Type | Field and Description |
---|---|
static char |
CHAR_EOTEXT
Reserved character (0x0000) which is only delivered when reading past the end
of the input.
|
protected Location<D> |
eotext_location
The location after consuming the last character is stored here
to be still deliverable when the finished buffer has been discarded.
|
Constructor and Description |
---|
IncludingCharBuf(Reader r,
Location<D> loc)
Initialize with the complete char stream readable from r.
|
IncludingCharBuf(String s)
Deprecated.
|
IncludingCharBuf(String s,
Location<D> loc)
Initialize with the complete content of s.
|
Modifier and Type | Method and Description |
---|---|
void |
consume()
Swallow the next character, advance the location by one position,
and reconstruct the inserting source, in case the inserted source has reached
its end.
|
String |
getCallingLocationString()
Returns the list of the locations in a human-readable string notation.
|
Location<D> |
getCurrentLocation()
Deliver the position of the last executed
consume() . |
List<Location<D>> |
getLocationChain()
Returns the list of the locations: the current parser position, and the
parser positions where the insertion was started, ie where the
expanded macro has been called.
|
void |
include(char[] s,
Location<D> loc)
Insert the complete content of s at the current position.
|
void |
include(String s,
Location<D> loc)
Insert the complete content of s at the current position.
|
char |
LA(int k)
Deliver the k-th look-ahead character.
|
protected Location<D> eotext_location
public static final char CHAR_EOTEXT
public IncludingCharBuf(Reader r, Location<D> loc) throws IOException
r
- character data to start with.loc
- location associated with the BEGIN of the data, for subsequent
error messages.IOException
@Deprecated public IncludingCharBuf(String s)
public void include(String s, Location<D> loc)
s
- character data to insert.loc
- location associated with the BEGIN of the insertion, for subsequent
error messages.public void include(char[] s, Location<D> loc)
s
- character data to insert.loc
- location associated with the BEGIN of the insertion, for subsequent
error messages.public char LA(int k)
IncludingCharBuf.CharBuf
!!)public Location<D> getCurrentLocation()
consume()
.public List<Location<D>> getLocationChain()
public String getCallingLocationString()
public void consume()
CHAR_EOTEXT
.
In this case a further (erroneous!) LA() call would find a further
CHAR_EOTEXT
, infinitely often.see also the complete user documentation .