Lines Matching refs:pattern
209 // helper functions for matching of pattern syntax pieces ------------------ ***
217 isPerlOpen(const UnicodeString &pattern, int32_t pos) {
219 return pattern.charAt(pos)==BACKSLASH && ((c=pattern.charAt(pos+1))==LOWER_P || c==UPPER_P);
223 isPerlClose(const UnicodeString &pattern, int32_t pos) {
224 return pattern.charAt(pos)==CLOSE_BRACE;
228 isNameOpen(const UnicodeString &pattern, int32_t pos) {
229 return pattern.charAt(pos)==BACKSLASH && pattern.charAt(pos+1)==UPPER_N;
233 isPOSIXOpen(const UnicodeString &pattern, int32_t pos) {
234 return pattern.charAt(pos)==SET_OPEN && pattern.charAt(pos+1)==COLON;
238 isPOSIXClose(const UnicodeString &pattern, int32_t pos) {
239 return pattern.charAt(pos)==COLON && pattern.charAt(pos+1)==SET_CLOSE;
252 * Constructs a set from the given pattern, optionally ignoring
254 * pattern language.
255 * @param pattern a string specifying what characters are in the set
257 UnicodeSet::UnicodeSet(const UnicodeString& pattern,
270 applyPattern(pattern, USET_IGNORE_SPACE, NULL, status);
277 * Constructs a set from the given pattern, optionally ignoring
279 * pattern language.
280 * @param pattern a string specifying what characters are in the set
281 * @param options bitmask for options to apply to the pattern.
284 UnicodeSet::UnicodeSet(const UnicodeString& pattern,
299 applyPattern(pattern, options, symbols, status);
305 UnicodeSet::UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
320 applyPattern(pattern, pos, options, symbols, status);
332 * pattern, optionally ignoring white space. See the class
333 * description for the syntax of the pattern language.
334 * @param pattern a string specifying what characters are in the set
336 * pattern are ignored. Spaces are those characters for which
341 * @exception <code>IllegalArgumentException</code> if the pattern
344 UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
346 return applyPattern(pattern, USET_IGNORE_SPACE, NULL, status);
352 * pattern, optionally ignoring white space. See the class
353 * description for the syntax of the pattern language.
354 * @param pattern a string specifying what characters are in the set
355 * @param options bitmask for options to apply to the pattern.
358 UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
367 applyPattern(pattern, pos, options, symbols, status);
374 ICU_Utility::skipWhitespace(pattern, i, TRUE);
377 if (i != pattern.length()) {
383 UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
391 // Need to build the pattern in a temporary string because
394 RuleCharacterIterator chars(pattern, symbols, pos);
407 * Return true if the given position, in the given pattern, appears
408 * to be the start of a UnicodeSet pattern.
410 UBool UnicodeSet::resemblesPattern(const UnicodeString& pattern, int32_t pos) {
411 return ((pos+1) < pattern.length() &&
412 pattern.charAt(pos) == (UChar)91/*[*/) ||
413 resemblesPropertyPattern(pattern, pos);
417 // Implementation: Pattern parsing
439 * Parse the pattern from the given RuleCharacterIterator. The
440 * iterator is advanced over the parsed pattern.
441 * @param chars iterator over the pattern characters. Upon return
443 * pattern, or the end of the iteration if all characters are
447 * @param rebuiltPat the pattern that was parsed, rebuilt or
448 * copied from the input pattern, as appropriate.
494 // -------- Check for property pattern
505 // opening delimiter for this pattern, parse special
560 // the pattern or represented by a stand-in that has
606 // Entire pattern is a category; leave parse loop
818 * pattern should be compiled case-insensitive, then we need
832 // Use the rebuilt pattern (patLocal) only if necessary. Prefer the
833 // generated pattern.
1135 * Return true if the given position, in the given pattern, appears
1136 * to be the start of a property set pattern.
1138 UBool UnicodeSet::resemblesPropertyPattern(const UnicodeString& pattern,
1141 if ((pos+5) > pattern.length()) {
1146 return isPOSIXOpen(pattern, pos) || isPerlOpen(pattern, pos) || isNameOpen(pattern, pos);
1151 * property pattern. Regardless of the result, return with the
1153 * @param chars iterator over the pattern characters. Upon return
1177 * Parse the given property pattern at the given parse position.
1179 UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern,
1191 if ((pos+5) > pattern.length()) {
1197 if (isPOSIXOpen(pattern, pos)) {
1200 pos = ICU_Utility::skipWhitespace(pattern, pos);
1201 if (pos < pattern.length() && pattern.charAt(pos) == COMPLEMENT) {
1205 } else if (isPerlOpen(pattern, pos) || isNameOpen(pattern, pos)) {
1206 UChar c = pattern.charAt(pos+1);
1210 pos = ICU_Utility::skipWhitespace(pattern, pos);
1211 if (pos == pattern.length() || pattern.charAt(pos++) != OPEN_BRACE) {
1221 int32_t close = pattern.indexOf(posix ? POSIX_CLOSE : PERL_CLOSE, pos);
1229 // pattern.
1230 int32_t equals = pattern.indexOf(EQUALS, pos);
1233 // Equals seen; parse medium/long pattern
1234 pattern.extractBetween(pos, equals, propName);
1235 pattern.extractBetween(equals+1, close, valueName);
1240 pattern.extractBetween(pos, close, propName);
1270 * Parse a property pattern.
1271 * @param chars iterator over the pattern characters. Upon return
1273 * pattern, or the end of the iteration if all characters are
1275 * @param rebuiltPat the pattern that was parsed, rebuilt or
1276 * copied from the input pattern, as appropriate.
1282 UnicodeString pattern;
1283 chars.lookahead(pattern);
1285 applyPropertyPattern(pattern, pos, ec);
1288 // syntaxError(chars, "Invalid property pattern");
1293 rebuiltPat.append(pattern, 0, pos.getIndex());