Lines Matching refs:pattern
70 # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
81 # define re_compile_pattern(pattern, length, bufp) \
82 __re_compile_pattern (pattern, length, bufp)
172 /* This must be nonzero for the wordchar and notwordchar pattern
413 static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
431 static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
498 the range 0 to one less than the pattern buffer's re_nsub
508 pattern buffer, and one byte with the number of inner groups,
651 /* Common operations on the compiled pattern. */
811 /* Print a compiled pattern string in human-readable form, starting at
828 /* Loop over pattern commands. */
1140 printf ("%td:\tend of pattern.\n", p - start);
1142 printf ("%ld:\tend of pattern.\n", (long int) (p - start));
1318 also be assigned to arbitrarily: each pattern buffer stores its own
1667 DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
1715 PAT -- the saved pattern position.
1752 DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
1863 static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
1887 /* Fetch the next character in the uncompiled pattern---translating it
1910 /* Fetch the next character in the uncompiled pattern, with no
1917 /* Go backwards one character in the pattern. */
1941 /* Macros for outputting the compiled pattern into `buffer'. */
2003 into the pattern are two bytes long. So if 2^16 bytes turns out to
2165 /* Get the next unsigned number in the uncompiled pattern. */
2269 /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
2277 `buffer' is the compiled pattern;
2279 `used' is set to the length of the compiled pattern;
2281 `re_nsub' is the number of subexpressions in PATTERN;
2290 return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
2297 PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
2301 /* We fetch characters from PATTERN here. Even though PATTERN is
2307 /* A temporary space to keep wchar_t pattern and compiled pattern. */
2308 CHAR_T *pattern, *COMPILED_BUFFER_VAR;
2318 /* A random temporary spot in PATTERN. */
2327 /* Points to the current (ending) position in the pattern. */
2332 const CHAR_T *p = pattern;
2333 const CHAR_T *pend = pattern + size;
2336 /* How to translate the characters in the pattern. */
2364 /* Initialize the wchar_t PATTERN and offset_buffer. */
2365 p = pend = pattern = TALLOC(csize + 1, CHAR_T);
2368 if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
2370 free(pattern);
2375 pattern[csize] = L'\0'; /* sentinel */
2376 size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
2380 free(pattern);
2388 DEBUG_PRINT1 ("\nCompiling pattern: ");
2394 PUT_CHAR (pattern[debug_count]);
2404 free(pattern);
2414 /* Initialize the pattern buffer. */
2419 /* Set `used' to zero, so that if we return an error, the pattern
2420 printer (for debugging) will think there's no pattern. We reset it
2439 /* Free bufp->buffer and allocate an array for wchar_t pattern
2467 /* Loop through the uncompiled pattern until we're at the end. */
2476 if ( /* If at start of pattern, it's an operator. */
2477 p == pattern + 1
2481 || PREFIX(at_begline_loc_p) (pattern, p, syntax))
2491 if ( /* If at end of pattern, it's an operator. */
2511 /* If there is no previous pattern... */
2569 /* Star, etc. applied to an empty pattern is equivalent
2570 to an empty pattern. */
2587 assert (p - 1 > pattern);
2592 /* We know we are not at the first character of the pattern,
2769 && !(p - 2 >= pattern && p[-2] == '[')
2770 && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
2808 /* If pattern is `[[:'. */
2886 /* If pattern is `[[=' or '[[.'. */
3180 && !(p - 2 >= pattern && p[-2] == '[')
3181 && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
3213 /* If pattern is `[[:'. */
3338 /* If pattern is `[[='. */
3472 /* If pattern is `[[.'. */
3686 whole pattern moves because of realloc, they will still
3697 represent in the compiled pattern. */
3848 /* Place in the uncompiled pattern (i.e., just after
3911 we're all done, the pattern will look like:
3968 inserting into the middle of the pattern --
4116 || is_exactn_bin != is_binary[p - 1 - pattern]
4141 is_exactn_bin = is_binary[p - 1 - pattern];
4159 /* Through the pattern now. */
4168 the first time we reach the end of the compiled pattern. */
4173 free (pattern);
4189 DEBUG_PRINT1 ("\nCompiled pattern: \n");
4297 /* P points to just after a ^ in PATTERN. Return true if that ^ comes
4302 PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
4306 boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
4359 /* This insert space, which size is "num", into the pattern at "loc".
4438 /* Have to increment the pointer into the pattern string, so the
4446 uncompiled pattern *P_PTR (which ends at PEND). We assume the
4449 ending characters (inclusive) in the compiled pattern B.
4475 /* Have to increment the pointer into the pattern string, so the
4522 /* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
4524 characters can start a string that matches the pattern. This fastmap
4531 the pattern buffer.
4570 /* We need to cast pattern to (wchar_t*), because we casted this compiled
4571 pattern to (char*) in regex_compile. */
4572 UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
4575 UCHAR_T *pattern = bufp->buffer;
4576 register UCHAR_T *pend = pattern + bufp->used;
4578 UCHAR_T *p = pattern;
4586 /* Assume that each path through the pattern can be null until
4606 /* We have reached the (effective) end of pattern. */
4622 /* We should never be about to go beyond the end of the pattern. */
4798 end of the pattern. We don't want to push such a point,
4800 increment `p' past the end of the pattern. We don't need
4802 fastmap entries beyond `pend'. Such a pattern can match
4855 characters for one path of the pattern -- and that the empty
4865 pattern is empty). */
4945 /* Using the compiled pattern in BUFP->buffer, first tries to match the
5059 search for a pattern that must be anchored. */
5167 cannot be the start of a match. If the pattern can match the
5396 we use only one byte in the pattern for the register number), we can
5453 /* re_match_2 matches the compiled pattern in BUFP against the
5589 /* Where we are in the pattern, and the end of the pattern. */
5591 UCHAR_T *pattern, *p;
5610 to resume scanning the pattern; the second one is where to resume
5639 attempt) by a subexpression part of the pattern, that is, the
5640 regnum-th regstart pointer points to where in the pattern we began
5643 keeps track of what the whole pattern matches.) */
5660 matched any of the pattern so far this time through the reg_num-th
5706 no groups in the pattern, as it takes a fair amount of time. If
5708 pattern), even though we never use it, since it simplifies the
5794 /* We need to cast pattern to (wchar_t*), because we casted this compiled
5795 pattern to (char*) in regex_compile. */
5796 p = pattern = (CHAR_T*)bufp->buffer;
5867 /* `p' scans through the pattern as `d' scans through the data.
5905 DEBUG_PRINT1 ("The compiled pattern is:\n");
5911 /* This loops over pattern commands. It exits by returning from the
5923 { /* End of pattern means we might have succeeded. */
5924 DEBUG_PRINT1 ("end of pattern ... ");
5977 For example, the pattern `x.*y.*z' against the
6074 were in the pattern, set the extra elements to -1. If
6106 /* Otherwise match next pattern command. */
6119 /* Match the next n pattern characters exactly. The following
6120 byte in the pattern defines n, and the n bytes after that
6731 /* If the next operation is a jump backwards in the pattern
6735 on_failure_jump's jump in the pattern, and d. */
6993 pattern follows its end. If we can establish that there
7027 /* If we're at the end of the pattern, we can change. */
7036 (" End of pattern: change to `pop_failure_jump'.\n");
7152 on_failure_jump; we got through the pattern to here from the
7202 pop_failure_jump, also, and with a pattern of, say, `a+', we
7208 the code at `fail' tests is the value for the pattern. */
7445 continue; /* Successfully executed one pattern command; keep going. */
7461 /* If we failed to the end of the pattern, don't examine *p. */
7511 Return true if the pattern up to the corresponding stop_memory can
7541 pattern. */
7549 with a jump, e.g., here is the pattern for `a|b|c':
7780 compiles PATTERN (of length SIZE) and puts the result in BUFP.
7781 Returns 0 if the pattern was valid, otherwise an error string.
7789 re_compile_pattern (const char *pattern, size_t length,
7808 ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
7811 ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
7827 /* BSD has one and only one pattern buffer. */
7861 don't need to initialize the pattern buffer fields which affect it. */
7904 `buffer' to the compiled pattern;
7905 `used' to the length of the compiled pattern;
7912 `re_nsub' to the number of subexpressions in PATTERN.
7914 PATTERN is the address of the pattern string.
7935 regcomp (regex_t *preg, const char *pattern, int cflags)
7942 /* regex_compile will allocate the space for the compiled pattern. */
7980 /* POSIX says a null character in the pattern terminates it, so we
7981 can use strlen here in compiling the pattern. */
7984 ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
7987 ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
7995 /* Compute the fastmap now, since regexec cannot modify the pattern
8013 /* regexec searches for a given pattern, specified by PREG, in the