Package com.ibm.icu.text
Class TransliteratorParser.RuleHalf
- java.lang.Object
-
- com.ibm.icu.text.TransliteratorParser.RuleHalf
-
- Enclosing class:
- TransliteratorParser
private static class TransliteratorParser.RuleHalf extends java.lang.Object
A class representing one side of a rule. This class knows how to parse half of a rule. It is tightly coupled to the method TransliteratorParser.parseRule().
-
-
Field Summary
Fields Modifier and Type Field Description boolean
anchorEnd
boolean
anchorStart
int
ante
int
cursor
int
cursorOffset
private int
cursorOffsetPos
private int
nextSegmentNumber
The segment number from 1..n of the next '(' we see during parsing; 1-based.int
post
java.lang.String
text
-
Constructor Summary
Constructors Modifier Constructor Description private
RuleHalf()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.int
parse(java.lang.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.private int
parseSection(java.lang.String rule, int pos, int limit, TransliteratorParser parser, java.lang.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.(package private) void
removeContext()
Remove context.
-
-
-
Field Detail
-
text
public java.lang.String text
-
cursor
public int cursor
-
ante
public int ante
-
post
public int post
-
cursorOffset
public int cursorOffset
-
cursorOffsetPos
private int cursorOffsetPos
-
anchorStart
public boolean anchorStart
-
anchorEnd
public boolean anchorEnd
-
nextSegmentNumber
private int nextSegmentNumber
The segment number from 1..n of the next '(' we see during parsing; 1-based.
-
-
Method Detail
-
parse
public int parse(java.lang.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.- Returns:
- the index after the terminating character, or if limit was reached, limit
-
parseSection
private int parseSection(java.lang.String rule, int pos, int limit, TransliteratorParser parser, java.lang.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.- Parameters:
buf
- buffer into which to accumulate the rule pattern characters, either literal characters from the rule or standins for UnicodeMatcher objects including segments.illegal
- the set of special characters that is illegal during this parse.isSegment
- 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.- Returns:
- the index after the terminating character, or if limit was reached, limit
-
removeContext
void removeContext()
Remove context.
-
isValidOutput
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.
-
isValidInput
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.
-
-