Lines Matching +full:posix +full:- +full:character +full:- +full:classes
2 * Perl-Compatible Regular Expressions *
9 Original API code Copyright (c) 1997-2012 University of Cambridge
10 New API code Copyright (c) 2016-2022 University of Cambridge
12 -----------------------------------------------------------------------------
38 -----------------------------------------------------------------------------
68 /* States for POSIX processing */
73 /* Macro to add a character string to the output buffer, checking for overflow. */
93 /* Recognized escaped metacharacters in POSIX basic patterns. */
103 * Convert a POSIX pattern *
106 /* This function handles both basic and extended POSIX patterns.
129 PCRE2_SPTR posix = pattern; in convert_posix() local
132 PCRE2_UCHAR *endp = p + use_length - 1; /* Allow for trailing zero */ in convert_posix()
160 convlength += p - pp; in convert_posix()
164 /* Pick up the next character */ in convert_posix()
167 c = *posix; in convert_posix()
169 GETCHARLENTEST(c, posix, clength); in convert_posix()
171 posix += clength; in convert_posix()
172 plength -= clength; in convert_posix()
177 /* Handle a character within a class. */ in convert_posix()
197 *posix == CHAR_RIGHT_SQUARE_BRACKET) in convert_posix()
200 plength--; in convert_posix()
201 posix++; in convert_posix()
202 continue; /* With next character after :] */ in convert_posix()
218 memcpy(p, posix - clength, CU2BYTES(clength)); in convert_posix()
223 /* Handle a character not within a class. */ in convert_posix()
232 support) but they are not part of POSIX 1003.1. */ in convert_posix()
236 if (posix[0] == CHAR_LEFT_SQUARE_BRACKET && in convert_posix()
237 posix[1] == CHAR_COLON && in convert_posix()
238 (posix[2] == CHAR_LESS_THAN_SIGN || in convert_posix()
239 posix[2] == CHAR_GREATER_THAN_SIGN) && in convert_posix()
240 posix[3] == CHAR_COLON && in convert_posix()
241 posix[4] == CHAR_RIGHT_SQUARE_BRACKET && in convert_posix()
242 posix[5] == CHAR_RIGHT_SQUARE_BRACKET) in convert_posix()
245 memcpy(p, posix, CU2BYTES(6)); in convert_posix()
247 posix += 6; in convert_posix()
248 plength -= 6; in convert_posix()
249 continue; /* With next character */ in convert_posix()
254 /* Handle start of "normal" character classes */ in convert_posix()
262 if (*posix == CHAR_CIRCUMFLEX_ACCENT) in convert_posix()
264 posix++; in convert_posix()
265 plength--; in convert_posix()
268 if (plength > 0 && *posix == CHAR_RIGHT_SQUARE_BRACKET) in convert_posix()
270 posix++; in convert_posix()
271 plength--; in convert_posix()
281 if (*posix < 127 && strchr(posix_meta_escapes, *posix) != NULL) in convert_posix()
283 if (isdigit(*posix)) PUTCHARS(STR_BACKSLASH); in convert_posix()
285 lastspecial = *p++ = *posix++; in convert_posix()
286 plength--; in convert_posix()
294 bracount--; in convert_posix()
346 memcpy(p, posix - clength, CU2BYTES(clength)); in convert_posix()
355 convlength += p - pp; /* Final segment */ in convert_posix()
376 /* Write a character into the output.
380 chr the next character
386 out->output_size++; in convert_glob_write()
388 if (out->output < out->output_end) in convert_glob_write()
389 *out->output++ = chr; in convert_glob_write()
397 length length of out->out_str
403 uint8_t *out_str = out->out_str; in convert_glob_write_str()
404 PCRE2_UCHAR *output = out->output; in convert_glob_write_str()
405 PCRE2_SPTR output_end = out->output_end; in convert_glob_write_str()
406 PCRE2_SIZE output_size = out->output_size; in convert_glob_write_str()
415 while (--length != 0); in convert_glob_write_str()
417 out->output = output; in convert_glob_write_str()
418 out->output_size = output_size; in convert_glob_write_str()
453 out->out_str[0] = CHAR_LEFT_SQUARE_BRACKET; in convert_glob_print_wildcard()
454 out->out_str[1] = CHAR_CIRCUMFLEX_ACCENT; in convert_glob_print_wildcard()
463 /* Parse a posix class.
513 start -= 2; in convert_glob_parse_class()
530 /* Checks whether the character is in the class.
534 c character
536 Returns: !0 => character is found in the class
617 out->out_str[0] = CHAR_LEFT_SQUARE_BRACKET; in convert_glob_parse_range()
618 out->out_str[1] = CHAR_CIRCUMFLEX_ACCENT; in convert_glob_parse_range()
625 out->out_str[len] = CHAR_BACKSLASH; in convert_glob_parse_range()
628 out->out_str[len] = (uint8_t) separator; in convert_glob_parse_range()
641 out->out_str[0] = CHAR_BACKSLASH; in convert_glob_parse_range()
642 out->out_str[1] = CHAR_RIGHT_SQUARE_BRACKET; in convert_glob_parse_range()
660 out->out_str[0] = CHAR_LEFT_PARENTHESIS; in convert_glob_parse_range()
661 out->out_str[1] = CHAR_QUESTION_MARK; in convert_glob_parse_range()
662 out->out_str[2] = CHAR_LESS_THAN_SIGN; in convert_glob_parse_range()
663 out->out_str[3] = CHAR_EXCLAMATION_MARK; in convert_glob_parse_range()
763 out->out_str[0] = CHAR_LEFT_PARENTHESIS; in convert_glob_print_commit()
764 out->out_str[1] = CHAR_ASTERISK; in convert_glob_print_commit()
765 out->out_str[2] = CHAR_C; in convert_glob_print_commit()
766 out->out_str[3] = CHAR_O; in convert_glob_print_commit()
767 out->out_str[4] = CHAR_M; in convert_glob_print_commit()
768 out->out_str[5] = CHAR_M; in convert_glob_print_commit()
769 out->out_str[6] = CHAR_I; in convert_glob_print_commit()
770 out->out_str[7] = CHAR_T; in convert_glob_print_commit()
801 PCRE2_UCHAR separator = ccontext->glob_separator; in convert_glob()
802 PCRE2_UCHAR escape = ccontext->glob_escape; in convert_glob()
870 after_separator = is_start || (pattern[-2] == separator); in convert_glob()
1029 if (!dummyrun && out.output_size != (PCRE2_SIZE) (out.output - use_buffer)) in convert_glob()
1035 *bufflenptr = pattern - pattern_start; in convert_glob()
1039 *bufflenptr = out.output_size - 1; in convert_glob()
1048 /* This is the external-facing function for converting other forms of pattern
1060 Returns: 0 for success, else an error code (+ve or -ve)
1172 /* This frees a converted pattern that was put in newly-allocated memory.
1184 (pcre2_memctl *)((char *)converted - sizeof(pcre2_memctl)); in pcre2_converted_pattern_free()
1185 memctl->free(memctl, memctl->memory_data); in pcre2_converted_pattern_free()