| Modifier and Type | Class and Description |
|---|---|
| private class | TransliteratorParser.ParseData
This class implements the SymbolTable interface. |
| private static class | TransliteratorParser.RuleArray
RuleBody subclass for a String[] array. |
| private abstract static class | TransliteratorParser.RuleBody
A private abstract class representing the interface to rule source code that is broken up into lines. |
| private static class | TransliteratorParser.RuleHalf
A class representing one side of a rule. |
| Modifier and Type | Field and Description |
|---|---|
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| public UnicodeSet | compoundFilter
PUBLIC data member containing the parsed compound filter, if any. |
| private static final char | |
| private static final char | |
| private RuleBasedTransliterator. | curData
The current data object for which we are parsing rules |
| private static final char | |
| private static final char | |
| public List | dataVector
PUBLIC data member. |
| private int | |
| private static final char | |
| private static final String | |
| private int | dotStandIn
The stand-in character for the 'dot' set, represented by '.' in patterns. |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final String | |
| private static final String | |
| private static final int | |
| public List | idBlockVector
PUBLIC data member. |
| private static UnicodeSet | |
| private static UnicodeSet | |
| private static UnicodeSet | |
| private static final char | |
| private static final char | |
| private static final String | |
| private TransliteratorParser. | parseData
Temporary symbol table used during parsing. |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| private static final char | |
| private List | segmentObjects
Vector of StringMatcher objects for segments. |
| private StringBuffer | segmentStandins
String of standins for segments. |
| private String | undefinedVariableName
When we encounter an undefined variable, we do not immediately signal an error, in case we are defining this variable, e.g., "$a = [a-z];". |
| private static final char | |
| private char | variableLimit
The last available stand-in for variables. |
| private Map | variableNames
Temporary table of variable names. |
| private char | variableNext
The next available stand-in for variables. |
| private List | variablesVector
Temporary vector of set variables. |
| private static final char |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | appendVariableDef(String name, StringBuffer buf)
Append the value of the given variable name to the given StringBuffer. |
| private void | checkVariableRange(int ch, String rule, int start)
Assert that the given character is NOT within the variable range. |
| pack-priv char | generateStandInFor(Object obj)
Generate and return a stand-in for a new UnicodeMatcher or UnicodeReplacer. |
| pack-priv char | |
| public char | |
| public void | |
| private int | Returns: the position index after the final ';' of the pragma, or -1 on failure.offset to the first non-whitespace character
of the rule. pos, int pointer past the last character of the rule. limit)Parse a pragma. |
| private int | |
| pack-priv void | |
| private final char | parseSet(String rule, ParsePosition pos)
Parse a UnicodeSet out, store it, and return the stand-in character used to represent it. |
| private void | pragmaMaximumBackup(int backup)
Set the maximum backup to 'backup', in response to a pragma statement. |
| private void | pragmaNormalizeRules(Normalizer.
Deprecated
as a consequence of
Begin normalizing all rules using the given mode, in response
to a pragma statement.
Normalizer.Mode being deprecated.
|
| pack-priv static boolean | resemblesPragma(String rule, int
offset to the first non-whitespace character
of the rule. pos, int pointer past the last character of the rule. limit)Return true if the given rule looks like a pragma. |
| pack-priv static final int | |
| public void | |
| private void | |
| pack-priv static final void | syntaxError(String
error description msg, String pattern string rule, int position of first character of current rule start)Throw an exception indicating a syntax error. |
| ALT_FORWARD_RULE_OP | back to summary |
|---|---|
| private static final char ALT_FORWARD_RULE_OP | |
| ALT_FUNCTION | back to summary |
|---|---|
| private static final char ALT_FUNCTION | |
| ALT_FWDREV_RULE_OP | back to summary |
|---|---|
| private static final char ALT_FWDREV_RULE_OP | |
| ALT_REVERSE_RULE_OP | back to summary |
|---|---|
| private static final char ALT_REVERSE_RULE_OP | |
| ANCHOR_START | back to summary |
|---|---|
| private static final char ANCHOR_START | |
| compoundFilter | back to summary |
|---|---|
| public UnicodeSet compoundFilter PUBLIC data member containing the parsed compound filter, if any. | |
| CONTEXT_ANTE | back to summary |
|---|---|
| private static final char CONTEXT_ANTE | |
| CONTEXT_POST | back to summary |
|---|---|
| private static final char CONTEXT_POST | |
| curData | back to summary |
|---|---|
| private RuleBasedTransliterator. The current data object for which we are parsing rules | |
| CURSOR_OFFSET | back to summary |
|---|---|
| private static final char CURSOR_OFFSET | |
| CURSOR_POS | back to summary |
|---|---|
| private static final char CURSOR_POS | |
| dataVector | back to summary |
|---|---|
| public List<RuleBasedTransliterator. PUBLIC data member. A Vector of RuleBasedTransliterator.Data objects, one for each discrete group of rules in the rule set | |
| direction | back to summary |
|---|---|
| private int direction | |
| DOT | back to summary |
|---|---|
| private static final char DOT | |
| DOT_SET | back to summary |
|---|---|
| private static final String DOT_SET | |
| dotStandIn | back to summary |
|---|---|
| private int dotStandIn The stand-in character for the 'dot' set, represented by '.' in patterns. This is allocated the first time it is needed, and reused thereafter. | |
| END_OF_RULE | back to summary |
|---|---|
| private static final char END_OF_RULE | |
| ESCAPE | back to summary |
|---|---|
| private static final char ESCAPE | |
| FORWARD_RULE_OP | back to summary |
|---|---|
| private static final char FORWARD_RULE_OP | |
| FUNCTION | back to summary |
|---|---|
| private static final char FUNCTION | |
| FWDREV_RULE_OP | back to summary |
|---|---|
| private static final char FWDREV_RULE_OP | |
| HALF_ENDERS | back to summary |
|---|---|
| private static final String HALF_ENDERS | |
| ID_TOKEN | back to summary |
|---|---|
| private static final String ID_TOKEN | |
| ID_TOKEN_LEN | back to summary |
|---|---|
| private static final int ID_TOKEN_LEN | |
| idBlockVector | back to summary |
|---|---|
| public List<String> idBlockVector PUBLIC data member. A Vector of Strings containing all of the ID blocks in the rule set | |
| ILLEGAL_FUNC | back to summary |
|---|---|
| private static UnicodeSet ILLEGAL_FUNC | |
| ILLEGAL_SEG | back to summary |
|---|---|
| private static UnicodeSet ILLEGAL_SEG | |
| ILLEGAL_TOP | back to summary |
|---|---|
| private static UnicodeSet ILLEGAL_TOP | |
| KLEENE_STAR | back to summary |
|---|---|
| private static final char KLEENE_STAR | |
| ONE_OR_MORE | back to summary |
|---|---|
| private static final char ONE_OR_MORE | |
| OPERATORS | back to summary |
|---|---|
| private static final String OPERATORS | |
| parseData | back to summary |
|---|---|
| private TransliteratorParser. Temporary symbol table used during parsing. | |
| QUOTE | back to summary |
|---|---|
| private static final char QUOTE | |
| REVERSE_RULE_OP | back to summary |
|---|---|
| private static final char REVERSE_RULE_OP | |
| RULE_COMMENT_CHAR | back to summary |
|---|---|
| private static final char RULE_COMMENT_CHAR | |
| SEGMENT_CLOSE | back to summary |
|---|---|
| private static final char SEGMENT_CLOSE | |
| SEGMENT_OPEN | back to summary |
|---|---|
| private static final char SEGMENT_OPEN | |
| segmentObjects | back to summary |
|---|---|
| private List<StringMatcher> segmentObjects Vector of StringMatcher objects for segments. Used during the parsing of a single rule. segmentStandins.charAt(0) is the standin for "$1" and corresponds to StringMatcher object segmentObjects.elementAt(0), etc. | |
| segmentStandins | back to summary |
|---|---|
| private StringBuffer segmentStandins String of standins for segments. Used during the parsing of a single rule. segmentStandins.charAt(0) is the standin for "$1" and corresponds to StringMatcher object segmentObjects.elementAt(0), etc. | |
| undefinedVariableName | back to summary |
|---|---|
| private String undefinedVariableName When we encounter an undefined variable, we do not immediately signal an error, in case we are defining this variable, e.g., "$a = [a-z];". Instead, we save the name of the undefined variable, and substitute in the placeholder char variableLimit - 1, and decrement variableLimit. | |
| VARIABLE_DEF_OP | back to summary |
|---|---|
| private static final char VARIABLE_DEF_OP | |
| variableLimit | back to summary |
|---|---|
| private char variableLimit The last available stand-in for variables. This is discovered
dynamically. At any point during parsing, available variables are
| |
| variableNames | back to summary |
|---|---|
| private Map<String, char[]> variableNames Temporary table of variable names. When parsing is complete, this is copied into data.variableNames. | |
| variableNext | back to summary |
|---|---|
| private char variableNext The next available stand-in for variables. This starts at some point in
the private use area (discovered dynamically) and increments up toward
| |
| variablesVector | back to summary |
|---|---|
| private List<Object> variablesVector Temporary vector of set variables. When parsing is complete, this is copied into the array data.variables. As with data.variables, element 0 corresponds to character data.variablesBase. | |
| ZERO_OR_ONE | back to summary |
|---|---|
| private static final char ZERO_OR_ONE | |
| TransliteratorParser | back to summary |
|---|---|
| public TransliteratorParser() Constructor. | |
| appendVariableDef | back to summary |
|---|---|
| private void appendVariableDef(String name, StringBuffer buf) Append the value of the given variable name to the given StringBuffer.
| |
| checkVariableRange | back to summary |
|---|---|
| private void checkVariableRange(int ch, String rule, int start) Assert that the given character is NOT within the variable range. If it is, signal an error. This is necessary to ensure that the variable range does not overlap characters used in a rule. | |
| generateStandInFor | back to summary |
|---|---|
| pack-priv char generateStandInFor(Object obj) Generate and return a stand-in for a new UnicodeMatcher or UnicodeReplacer. Store the object. | |
| getDotStandIn | back to summary |
|---|---|
| pack-priv char getDotStandIn() Return the stand-in for the dot set. It is allocated the first time and reused thereafter. | |
| getSegmentStandin | back to summary |
|---|---|
| public char getSegmentStandin(int seg) Return the standin for segment seg (1-based). | |
| parse | back to summary |
|---|---|
| public void parse(String rules, int dir) Parse a set of rules. After the parse completes, examine the public data members for results. | |
| parsePragma | back to summary |
|---|---|
| private int parsePragma(String rule, int pos, int limit) Parse a pragma. This method assumes resemblesPragma() has already returned true.
| |
| parseRule | back to summary |
|---|---|
| private int parseRule(String rule, int pos, int limit) MAIN PARSER. Parse the next rule in the given rule string, starting at pos. Return the index after the last character parsed. Do not parse characters at or after limit. Important Note The character at pos must be a non-whitespace character that is not the comment character. This method handles quoting, escaping, and whitespace removal. It parses the end-of-rule character. It recognizes context and cursor indicators. Once it does a lexical breakdown of the rule at pos, it creates a rule object and adds it to our rule list. This method is tightly coupled to the inner class RuleHalf. | |
| parseRules | back to summary |
|---|---|
| pack-priv void parseRules(TransliteratorParser. Parse an array of zero or more rules. The strings in the array are treated as if they were concatenated together, with rule terminators inserted between array elements if not present already. Any previous rules are discarded. Typically this method is called exactly once, during construction. The member this.data will be set to null if there are no rules.
| |
| parseSet | back to summary |
|---|---|
| private final char parseSet(String rule, ParsePosition pos) Parse a UnicodeSet out, store it, and return the stand-in character used to represent it. | |
| pragmaMaximumBackup | back to summary |
|---|---|
| private void pragmaMaximumBackup(int backup) Set the maximum backup to 'backup', in response to a pragma statement. | |
| pragmaNormalizeRules | back to summary |
|---|---|
| private void pragmaNormalizeRules(Normalizer. Deprecated as a consequence of Begin normalizing all rules using the given mode, in response to a pragma statement. | |
| resemblesPragma | back to summary |
|---|---|
| pack-priv static boolean resemblesPragma(String rule, int pos, int limit) Return true if the given rule looks like a pragma.
| |
| ruleEnd | back to summary |
|---|---|
| pack-priv static final int ruleEnd(String rule, int start, int limit) | |
| setSegmentObject | back to summary |
|---|---|
| public void setSegmentObject(int seg, StringMatcher obj) Set the object for segment seg (1-based). | |
| setVariableRange | back to summary |
|---|---|
| private void setVariableRange(int start, int end) Set the variable range to [start, end] (inclusive). | |
| syntaxError | back to summary |
|---|---|
| pack-priv static final void syntaxError(String msg, String rule, int start) Throw an exception indicating a syntax error. Search the rule string for the probable end of the rule. Of course, if the error is that the end of rule marker is missing, then the rule end will not be found. In any case the rule start will be correctly reported. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isMatcher(int ch)
Return true if the given character is a matcher standin or a plain character (non standin). |
| public boolean | isReplacer(int ch)
Return true if the given character is a replacer standin or a plain character (non standin). |
| public char[] | lookup(String
the symbolic name to lookup name)Implements com. |
| public UnicodeMatcher | lookupMatcher(int
a 32-bit code point from 0 to 0x10FFFF inclusive. ch)Implements com. |
| public String | parseReference(String
the text to parse for the name text, ParsePosition on entry, the index of the first character to parse.
This is the character following the SYMBOL_REF character. On
exit, the index after the last parsed character. If the parse
failed, pos is unchanged on exit. pos, int the index after the last character to be parsed. limit)Implements com. |
| ParseData | back to summary |
|---|---|
| private ParseData() | |
| isMatcher | back to summary |
|---|---|
| public boolean isMatcher(int ch) Return true if the given character is a matcher standin or a plain character (non standin). | |
| isReplacer | back to summary |
|---|---|
| public boolean isReplacer(int ch) Return true if the given character is a replacer standin or a plain character (non standin). | |
| lookup | back to summary |
|---|---|
| public char[] lookup(String name) Implements com. Implement SymbolTable API.
| |
| lookupMatcher | back to summary |
|---|---|
| public UnicodeMatcher lookupMatcher(int ch) Implements com. Implement SymbolTable API.
| |
| parseReference | back to summary |
|---|---|
| public String parseReference(String text, ParsePosition pos, int limit) Implements com. Implement SymbolTable API. Parse out a symbol reference name.
| |
| Modifier and Type | Method and Description |
|---|---|
| public String | handleNextLine()
Implements abstract com. |
| public void | reset()
Implements abstract com. |
| RuleArray | back to summary |
|---|---|
| public RuleArray(String[] array) | |
| handleNextLine | back to summary |
|---|---|
| public String handleNextLine() Implements abstract com. Doc from com. Subclass method to return the next line of the source.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements abstract com. Doc from com. Reset to the first line of the source.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract String | |
| pack-priv String | |
| pack-priv abstract void |
| RuleBody | back to summary |
|---|---|
| private RuleBody() | |
| handleNextLine | back to summary |
|---|---|
| pack-priv abstract String handleNextLine() Subclass method to return the next line of the source. | |
| nextLine | back to summary |
|---|---|
| pack-priv String nextLine() Retrieve the next line of the source, or return null if none. Folds lines terminated by a backslash into the next line, without regard for comments, quotes, or escapes. | |
| reset | back to summary |
|---|---|
| pack-priv abstract void reset() Reset to the first line of the source. | |
| Modifier and Type | Field and Description |
|---|---|
| public boolean | |
| public boolean | |
| public int | |
| public int | |
| public int | |
| private int | |
| private int | nextSegmentNumber
The segment number from 1..n of the next '(' we see during parsing; 1-based. |
| public int | |
| public String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isValidInput(TransliteratorParser parser)
Return true if this half looks like valid input, that is, does not contain functions or other special output-only elements. |
| public boolean | isValidOutput(TransliteratorParser parser)
Return true if this half looks like valid output, that is, does not contain quantifiers or other special input-only elements. |
| public int | Returns: the index after the terminating character, or if limit was reached, limitParse one side of a rule, stopping at either the limit, the END_OF_RULE character, or an operator. |
| private int | Returns: the index after the terminating character, or if limit was reached, limitbuffer into which to accumulate the rule pattern
characters, either literal characters from the rule or
standins for UnicodeMatcher objects including segments. buf, UnicodeSet the set of special characters that is illegal during
this parse. illegal, boolean if true, then we've already seen a '(' and
pos on entry points right after it. Accumulate everything
up to the closing ')', put it in a segment matcher object,
generate a standin for it, and add the standin to buf. As
a side effect, update the segments vector with a reference
to the segment matcher. This works recursively for nested
segments. If isSegment is false, just accumulate
characters into buf. isSegment)Parse a section of one side of a rule, stopping at either the limit, the END_OF_RULE character, an operator, or a segment close character. |
| pack-priv void |
| anchorEnd | back to summary |
|---|---|
| public boolean anchorEnd | |
| anchorStart | back to summary |
|---|---|
| public boolean anchorStart | |
| ante | back to summary |
|---|---|
| public int ante | |
| cursor | back to summary |
|---|---|
| public int cursor | |
| cursorOffset | back to summary |
|---|---|
| public int cursorOffset | |
| cursorOffsetPos | back to summary |
|---|---|
| private int cursorOffsetPos | |
| nextSegmentNumber | back to summary |
|---|---|
| private int nextSegmentNumber The segment number from 1..n of the next '(' we see during parsing; 1-based. | |
| post | back to summary |
|---|---|
| public int post | |
| text | back to summary |
|---|---|
| public String text | |
| RuleHalf | back to summary |
|---|---|
| private RuleHalf() | |
| isValidInput | back to summary |
|---|---|
| public boolean isValidInput(TransliteratorParser parser) Return true if this half looks like valid input, that is, does not contain functions or other special output-only elements. | |
| isValidOutput | back to summary |
|---|---|
| public boolean isValidOutput(TransliteratorParser parser) Return true if this half looks like valid output, that is, does not contain quantifiers or other special input-only elements. | |
| parse | back to summary |
|---|---|
| public int parse(String rule, int pos, int limit, TransliteratorParser parser) Parse one side of a rule, stopping at either the limit, the END_OF_RULE character, or an operator.
| |
| parseSection | back to summary |
|---|---|
| private int parseSection(String rule, int pos, int limit, TransliteratorParser parser, StringBuffer buf, UnicodeSet illegal, boolean isSegment) Parse a section of one side of a rule, stopping at either the limit, the END_OF_RULE character, an operator, or a segment close character. This method parses both a top-level rule half and a segment within such a rule half. It calls itself recursively to parse segments and nested segments.
| |
| removeContext | back to summary |
|---|---|
| pack-priv void removeContext() Remove context. | |