84 * Current variable expansion, or null if none. 85 */ 86 private char[] buf; 87 88 /** 89 * Position within buf[]. Meaningless if buf == null. 90 */ 91 private int bufPos; 92 93 /** 94 * Flag indicating whether the last character was parsed from an escape. 95 */ 96 private boolean isEscaped; 97 98 /** 99 * Value returned when there are no more characters to iterate. 100 */ 101 public static final int DONE = -1; 102 103 /** 104 * Bitmask option to enable parsing of variable names. If (options & 105 * PARSE_VARIABLES) != 0, then an embedded variable will be expanded to 106 * its value. Variables are parsed using the SymbolTable API. 107 */ 108 public static final int PARSE_VARIABLES = 1; 109 110 /** 111 * Bitmask option to enable parsing of escape sequences. If (options & 112 * PARSE_ESCAPES) != 0, then an embedded escape sequence will be expanded 113 * to its value. Escapes are parsed using Utility.unescapeAt(). 114 */ 115 public static final int PARSE_ESCAPES = 2; 116 117 /** 118 * Bitmask option to enable skipping of whitespace. If (options & 119 * SKIP_WHITESPACE) != 0, then whitespace characters will be silently 120 * skipped, as if they were not present in the input. Whitespace 121 * characters are defined by UCharacterProperty.isRuleWhiteSpace(). 122 */ 123 public static final int SKIP_WHITESPACE = 4; 124 125 /** 126 * Constructs an iterator over the given text, starting at the given 127 * position. 128 * @param text the text to be iterated 129 * @param sym the symbol table, or null if there is none. If sym is null, 130 * then variables will not be deferenced, even if the PARSE_VARIABLES 131 * option is set. 132 * @param pos upon input, the index of the next character to return. If a 133 * variable has been dereferenced, then pos will <em>not</em> increment as 134 * characters of the variable value are iterated. 135 */ 136 public RuleCharacterIterator(String text, SymbolTable sym, 137 ParsePosition pos) { 138 if (text == null || pos.getIndex() > text.length()) { 139 throw new IllegalArgumentException(); | 84 * Current variable expansion, or null if none. 85 */ 86 private char[] buf; 87 88 /** 89 * Position within buf[]. Meaningless if buf == null. 90 */ 91 private int bufPos; 92 93 /** 94 * Flag indicating whether the last character was parsed from an escape. 95 */ 96 private boolean isEscaped; 97 98 /** 99 * Value returned when there are no more characters to iterate. 100 */ 101 public static final int DONE = -1; 102 103 /** 104 * Bitmask option to enable parsing of variable names. 105 * If {@code (options & PARSE_VARIABLES) != 0}, 106 * then an embedded variable will be expanded to 107 * its value. Variables are parsed using the SymbolTable API. 108 */ 109 public static final int PARSE_VARIABLES = 1; 110 111 /** 112 * Bitmask option to enable parsing of escape sequences. 113 * If {@code (options & PARSE_ESCAPES) != 0}, 114 * then an embedded escape sequence will be expanded 115 * to its value. Escapes are parsed using Utility.unescapeAt(). 116 */ 117 public static final int PARSE_ESCAPES = 2; 118 119 /** 120 * Bitmask option to enable skipping of whitespace. 121 * If {@code (options & SKIP_WHITESPACE) != 0}, 122 * then whitespace characters will be silently 123 * skipped, as if they were not present in the input. Whitespace 124 * characters are defined by UCharacterProperty.isRuleWhiteSpace(). 125 */ 126 public static final int SKIP_WHITESPACE = 4; 127 128 /** 129 * Constructs an iterator over the given text, starting at the given 130 * position. 131 * @param text the text to be iterated 132 * @param sym the symbol table, or null if there is none. If sym is null, 133 * then variables will not be deferenced, even if the PARSE_VARIABLES 134 * option is set. 135 * @param pos upon input, the index of the next character to return. If a 136 * variable has been dereferenced, then pos will <em>not</em> increment as 137 * characters of the variable value are iterated. 138 */ 139 public RuleCharacterIterator(String text, SymbolTable sym, 140 ParsePosition pos) { 141 if (text == null || pos.getIndex() > text.length()) { 142 throw new IllegalArgumentException(); |