SnuggleInput document. This is
slightly non-trivial in that user-defined command and environments generally work as
simple text substitutions, so the state of the document changes during tokenisation.
However, we also need to be able to keep track of where each character in the document
comes from so as to enable decent error reporting. hence the complexity within here.
| Modifier and Type | Class and Description |
|---|---|
| public static class | WorkingDocument.
Represents a block of text that has been imported into this document. |
| public static class | WorkingDocument.
Holds information about how a particular index in the document is resolved against the |
| public static class | WorkingDocument.
Represents a contiguous portion of the document hat comes from the same |
| public static interface | WorkingDocument.
Marker interface that can be applied to classes that provide information for a
|
| public static class | WorkingDocument.
Implementation of |
| Modifier and Type | Field and Description |
|---|---|
| private final StringBuilder | |
| private int | |
| private final SnuggleInput | |
| pack-priv int | lastResolvedSliceIndex
Index in scoreboard of last successful resolution used in |
| private int | length
Current length of document (this is kept in sync with buffer.length()) |
| private final List |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | charAt(final int index)
Implements uk. Returns the character at the given index in the input document, or -1 if the index is not contained within the document. |
| private void | |
| private void | |
| public void | |
| public CharSequence | extract()
Implements uk. Extracts a copy of the current entire content of the input as a |
| public CharSequence | extract(final int startIndex, final int endIndex)
Implements uk. Extracts a copy of a slice of the current entire content of the input as a |
| public FrozenSlice | |
| public SnuggleInput | getInput()
Implements uk. Accesses the underlying |
| public int | |
| public int | indexOf(final int startSearchIndex, final char c)
Implements uk. Returns the first index of the given character, starting the search at the given index. |
| public int | indexOf(final int startSearchIndex, final String s)
Implements uk. Returns the first index of the given String, starting the search at the given index. |
| public boolean | isRegionWhitespace(final int startIndex, final int endIndex)
Implements uk. Tests whether all characters in the document with index satisfying startIndex <= index < endIndex are whitespace. |
| public int | |
| public boolean | matchesAt(final int index, final char c)
Implements uk. Tests whether the character at the given index is equal to that specified. |
| public boolean | matchesAt(final int index, final String s)
Implements uk. Tests whether the characters at the given index are equal to the String specified. |
| public WorkingDocument. | |
| public WorkingDocument. | |
| public void | unfreeze(final int newFreezeIndex)
This is a rather nasty method which resets the "freeze index" of this document back to the given index. |
| buffer | back to summary |
|---|---|
| private final StringBuilder buffer | |
| freezeIndex | back to summary |
|---|---|
| private int freezeIndex | |
| input | back to summary |
|---|---|
| private final SnuggleInput input | |
| lastResolvedSliceIndex | back to summary |
|---|---|
| pack-priv int lastResolvedSliceIndex Index in scoreboard of last successful resolution used in | |
| length | back to summary |
|---|---|
| private int length Current length of document (this is kept in sync with buffer.length()) | |
| scoreBoard | back to summary |
|---|---|
| private final List<WorkingDocument. | |
| WorkingDocument | back to summary |
|---|---|
| pack-priv WorkingDocument(final CharSequence initialData, final SnuggleInputReader inputReader) | |
| charAt | back to summary |
|---|---|
| public int charAt(final int index) Implements uk. Doc from uk. Returns the character at the given index in the input document, or -1 if the index is not contained within the document. | |
| checkIndex | back to summary |
|---|---|
| private void checkIndex(final int index, final String errorStart) | |
| checkRange | back to summary |
|---|---|
| private void checkRange(final int startIndex, final int endIndex) | |
| dumpScoreboard | back to summary |
|---|---|
| public void dumpScoreboard() | |
| extract | back to summary |
|---|---|
| public CharSequence extract() Implements uk. Doc from uk. Extracts a copy of the current entire content of the input as a | |
| extract | back to summary |
|---|---|
| public CharSequence extract(final int startIndex, final int endIndex) Implements uk. Doc from uk. Extracts a copy of a slice of the current entire content of the input as a | |
| freezeSlice | back to summary |
|---|---|
| public FrozenSlice freezeSlice(final int startIndex, final int endIndex) | |
| getInput | back to summary |
|---|---|
| public SnuggleInput getInput() Implements uk. Doc from uk. Accesses the underlying | |
| getSubstitutionDepth | back to summary |
|---|---|
| public int getSubstitutionDepth(final int index) | |
| indexOf | back to summary |
|---|---|
| public int indexOf(final int startSearchIndex, final char c) Implements uk. Doc from uk. Returns the first index of the given character, starting the search at the given index. Returns -1 if not found. | |
| indexOf | back to summary |
|---|---|
| public int indexOf(final int startSearchIndex, final String s) Implements uk. Doc from uk. Returns the first index of the given String, starting the search at the given index. Returns -1 if not found. | |
| isRegionWhitespace | back to summary |
|---|---|
| public boolean isRegionWhitespace(final int startIndex, final int endIndex) Implements uk. Doc from uk. Tests whether all characters in the document with index satisfying startIndex <= index < endIndex are whitespace. | |
| length | back to summary |
|---|---|
| public int length() Implements uk. Doc from uk. Current length of this input | |
| matchesAt | back to summary |
|---|---|
| public boolean matchesAt(final int index, final char c) Implements uk. Doc from uk. Tests whether the character at the given index is equal to that specified. | |
| matchesAt | back to summary |
|---|---|
| public boolean matchesAt(final int index, final String s) Implements uk. Doc from uk. Tests whether the characters at the given index are equal to the String specified. | |
| resolveIndex | back to summary |
|---|---|
| public WorkingDocument. | |
| substitute | back to summary |
|---|---|
| public WorkingDocument. | |
| unfreeze | back to summary |
|---|---|
| public void unfreeze(final int newFreezeIndex) This is a rather nasty method which resets the "freeze index" of this document back to the
given index. Any This class does NOT attempt to enforce this in any way - it is up to the caller to make sure he/she understands the implications of doing this. The main requirement for having this is when evaluating single-argument user-defined commands like \\udc \\alpha where the argument is implicitly taken to be the next valid token. | |
| Modifier and Type | Field and Description |
|---|---|
| public final WorkingDocument. | context
Contextual information about where this data came from |
| private transient String | |
| public final WorkingDocument. | substitutedSource
The block that this block was initially substituted into, or null to indicate that it is "top level" or was appended rather than substituted. |
| public final CharSequence | substitutedText
The text in the parent component that this data replaced, or null
if |
| public final int | substitutionOffset
The offset in |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CharacterSource(final WorkingDocument.
|
| Modifier and Type | Method and Description |
|---|---|
| public String |
| context | back to summary |
|---|---|
| public final WorkingDocument. Contextual information about where this data came from | |
| stringRepresentation | back to summary |
|---|---|
| private transient String stringRepresentation | |
| substitutedSource | back to summary |
|---|---|
| public final WorkingDocument. The block that this block was initially substituted into, or null to indicate that it is "top level" or was appended rather than substituted. | |
| substitutedText | back to summary |
|---|---|
| public final CharSequence substitutedText The text in the parent component that this data replaced, or null
if | |
| substitutionOffset | back to summary |
|---|---|
| public final int substitutionOffset The offset in | |
| CharacterSource | back to summary |
|---|---|
| public CharacterSource(final WorkingDocument. | |
| CharacterSource | back to summary |
|---|---|
| public CharacterSource(final WorkingDocument. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
Slice
in which it is contained.
| Modifier and Type | Field and Description |
|---|---|
| public final int | |
| public final int | |
| public final WorkingDocument. |
| Access | Constructor and Description |
|---|---|
| public | IndexResolution(final int scoreboardIndex, final WorkingDocument.
|
| Modifier and Type | Method and Description |
|---|---|
| public String |
| indexInComponent | back to summary |
|---|---|
| public final int indexInComponent | |
| scoreboardIndex | back to summary |
|---|---|
| public final int scoreboardIndex | |
| slice | back to summary |
|---|---|
| public final WorkingDocument. | |
| IndexResolution | back to summary |
|---|---|
| public IndexResolution(final int scoreboardIndex, final WorkingDocument. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
CharacterSource.
During parsing, Slices will be broken up to create new Slices whenever user-defined
commands and environments are substituted.
| Modifier and Type | Field and Description |
|---|---|
| public final int | |
| public final int | |
| public final WorkingDocument. | |
| public final int |
| Access | Constructor and Description |
|---|---|
| public | Slice(final int startIndex, final int endIndex, final WorkingDocument.
|
| Modifier and Type | Method and Description |
|---|---|
| public String |
| componentIndexOffset | back to summary |
|---|---|
| public final int componentIndexOffset | |
| endIndex | back to summary |
|---|---|
| public final int endIndex | |
| resolvedComponent | back to summary |
|---|---|
| public final WorkingDocument. | |
| startIndex | back to summary |
|---|---|
| public final int startIndex | |
| Slice | back to summary |
|---|---|
| public Slice(final int startIndex, final int endIndex, final WorkingDocument. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
CharacterSource.
SourceContext that represents the result of a substitution.
| Modifier and Type | Field and Description |
|---|---|
| public CharSequence | replacement
The characters that replaced what was originally in the document. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| replacement | back to summary |
|---|---|
| public CharSequence replacement The characters that replaced what was originally in the document. | |
| SubstitutionContext | back to summary |
|---|---|
| public SubstitutionContext(final CharSequence replacement) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |