Lines Matching +defs:char +defs:syntax

81 #  define re_set_syntax(syntax) __re_set_syntax (syntax)
118 # include "syntax.h"
130 char *malloc ();
131 char *realloc ();
168 /* Define the syntax stuff for \<, \>, etc. */
193 /* Get the interface, including the syntax bits. */
253 machines, compilers, `char' and `unsigned char' argument types.
257 # define SIGN_EXTEND_CHAR(c) ((signed char) (c))
260 # define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
270 extern char *re_syntax_table;
274 static char re_syntax_table[CHAR_SET_SIZE];
299 # define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
343 /* Assumes a `char *destination' variable. */
345 (destination = (char *) alloca (nsize), \
407 typedef char boolean;
411 static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
412 reg_syntax_t syntax,
416 const char *string1, int size1,
417 const char *string2, int size2,
422 const char *string1, int size1,
423 const char *string2, int size2,
429 static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
430 reg_syntax_t syntax,
435 const char *cstring1, int csize1,
436 const char *cstring2, int csize2,
444 const char *string1, int size1,
445 const char *string2, int size2,
475 /* Matches any one char belonging to specified set. First
588 notwordchar, /* Matches any char that is not a word-constituent. */
601 /* Matches any character whose syntax is specified. Followed by
602 a byte which contains a syntax code, e.g., Sword. */
605 /* Matches any character whose syntax is not that specified. */
614 # define CHAR_T char
615 # define UCHAR_T unsigned char
781 print_fastmap (char *fastmap)
919 length = *workp++; /* the length of char */
1172 printf ("syntax: %lx\n", bufp->syntax);
1246 static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
1248 char *is_binary);
1250 convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
1251 int *offset_buffer, char *is_binary)
1252 /* It hold correspondances between src(char string) and
1263 const unsigned char *psrc = src;
1315 /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
1317 syntax, so it can be changed between regex compilations. */
1323 /* Specify the precise syntax of regexps for compilation. This provides
1328 defined in regex.h. We return the old syntax. */
1331 re_set_syntax (reg_syntax_t syntax)
1335 re_syntax_options = syntax;
1337 if (syntax & RE_DEBUG)
1354 static const char *re_error_msgid[] =
1602 char *destination; \
1863 reg_syntax_t syntax);
1866 reg_syntax_t syntax);
1871 char *translate,
1872 reg_syntax_t syntax,
1878 const char **p_ptr,
1879 const char *pend,
1880 char *translate,
1881 reg_syntax_t syntax,
1882 unsigned char *b);
1887 string passed to us by the user to an unsigned char that we can use
1902 c = (unsigned char) *p++; \
1903 if (translate) c = (unsigned char) translate[c]; \
1921 `char *', to avoid warnings when a string constant is passed. But
1931 ? (char) translate[(unsigned char) (d)] : (d))
1934 (translate ? (char) translate[(unsigned char) (d)] : (char) (d))
2062 bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
2159 (b[((unsigned char) (c)) / BYTEWIDTH] \
2160 |= 1 << (((unsigned char) c) % BYTEWIDTH))
2228 static const char ** regstart, ** regend;
2229 static const char ** old_regstart, ** old_regend;
2230 static const char **best_regstart, **best_regend;
2231 static const char **reg_dummy;
2245 RETALLOC_IF (regstart, num_regs, const char *);
2246 RETALLOC_IF (regend, num_regs, const char *);
2247 RETALLOC_IF (old_regstart, num_regs, const char *);
2248 RETALLOC_IF (old_regend, num_regs, const char *);
2249 RETALLOC_IF (best_regstart, num_regs, const char *);
2250 RETALLOC_IF (best_regend, num_regs, const char *);
2252 RETALLOC_IF (reg_dummy, num_regs, const char *);
2276 `syntax' is set to SYNTAX;
2295 PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
2296 size_t ARG_PREFIX(size), reg_syntax_t syntax,
2300 `char *' (i.e., signed), we declare these variables as unsigned, so
2311 char *is_binary = NULL;
2313 char is_exactn_bin = FALSE;
2365 is_binary = TALLOC(csize + 1, char);
2413 bufp->syntax = syntax;
2426 /* Initialize the syntax table. */
2454 bufp->buffer = (char*)COMPILED_BUFFER_VAR;
2477 || syntax & RE_CONTEXT_INDEP_ANCHORS
2479 || PREFIX(at_begline_loc_p) (pattern, p, syntax))
2492 || syntax & RE_CONTEXT_INDEP_ANCHORS
2494 || PREFIX(at_endline_loc_p) (p, pend, syntax))
2504 if ((syntax & RE_BK_PLUS_QM)
2505 || (syntax & RE_LIMITED_OPS))
2512 if (syntax & RE_CONTEXT_INVALID_OPS)
2514 else if (!(syntax & RE_CONTEXT_INDEP_OPS))
2523 char zero_times_ok = 0, many_times_ok = 0;
2541 || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
2544 else if (syntax & RE_BK_PLUS_QM && c == '\\')
2598 && !(syntax & RE_DOT_NEWLINE))
2692 charset[l+m+n+2o+6] = char
2694 charset[l+m+n+2o+p+5] = char
2724 /* charset_not matches newline according to a syntax bit. */
2726 && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
2740 if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
2777 syntax, b, laststart);
2791 ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
2799 else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
2801 char str[CHAR_CLASS_MAX_LENGTH + 1];
2872 else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
2965 const unsigned char *extra;
2970 char char_str[c1];
2985 extra = (const unsigned char *)
3139 /* charset_not matches newline according to a syntax bit. */
3141 && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
3152 if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
3184 syntax, b);
3196 ret = byte_compile_range (c, &p, pend, translate, syntax, b);
3204 else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
3206 char str[CHAR_CLASS_MAX_LENGTH + 1];
3325 else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
3327 unsigned char str[MB_LEN_MAX + 1];
3382 const unsigned char *weights;
3383 const unsigned char *extra;
3386 const unsigned char *cp = str;
3394 weights = (const unsigned char *)
3396 extra = (const unsigned char *)
3459 else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
3461 unsigned char str[128]; /* Should be large enough. */
3508 range_start = ((const unsigned char *) str)[0];
3519 const unsigned char *extra;
3531 extra = (const unsigned char *)
3621 if (syntax & RE_NO_BK_PARENS)
3628 if (syntax & RE_NO_BK_PARENS)
3635 if (syntax & RE_NEWLINE_ALT)
3642 if (syntax & RE_NO_BK_VBAR)
3649 if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
3666 if (syntax & RE_NO_BK_PARENS)
3716 if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
3720 if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
3742 if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
3786 if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
3789 if (syntax & RE_LIMITED_OPS)
3833 if (!(syntax & RE_INTERVALS)
3836 || (syntax & RE_NO_BK_BRACES))
3841 /* If got here, then the syntax allows intervals. */
3868 if (!(syntax & RE_NO_BK_BRACES))
3881 if (syntax & RE_CONTEXT_INVALID_OPS
3882 && !(syntax & RE_INVALID_INTERVAL_ORD))
3884 else if (syntax & RE_CONTEXT_INDEP_OPS)
3984 if (!(syntax & RE_INVALID_INTERVAL_ORD))
3990 if (syntax & RE_NO_BK_BRACES)
4018 if (syntax & RE_NO_GNU_OPS)
4026 if (syntax & RE_NO_GNU_OPS)
4034 if (syntax & RE_NO_GNU_OPS)
4040 if (syntax & RE_NO_GNU_OPS)
4046 if (syntax & RE_NO_GNU_OPS)
4052 if (syntax & RE_NO_GNU_OPS)
4058 if (syntax & RE_NO_GNU_OPS)
4064 if (syntax & RE_NO_GNU_OPS)
4071 if (syntax & RE_NO_BK_REFS)
4090 if (syntax & RE_BK_PLUS_QM)
4125 || ((syntax & RE_BK_PLUS_QM)
4128 || ((syntax & RE_INTERVALS)
4129 && ((syntax & RE_NO_BK_BRACES)
4167 if (syntax & RE_NO_POSIX_BACKTRACKING)
4301 reg_syntax_t syntax)
4308 (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
4310 || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
4319 reg_syntax_t syntax)
4327 (syntax & RE_NO_BK_PARENS ? *next == ')'
4330 || (syntax & RE_NO_BK_VBAR ? *next == '|'
4374 reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
4390 const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
4392 const unsigned char *extra = (const unsigned char *)
4408 /* Report an error if the range is empty and the syntax prohibits
4410 ret = ((syntax & RE_NO_EMPTY_RANGES)
4425 /* Report an error if the range is empty and the syntax prohibits
4427 ret = ((syntax & RE_NO_EMPTY_RANGES)
4455 byte_compile_range (unsigned int range_start_char, const char **p_ptr,
4456 const char *pend, RE_TRANSLATE_TYPE translate,
4457 reg_syntax_t syntax, unsigned char *b)
4460 const char *p = *p_ptr;
4463 const unsigned char *collseq;
4477 /* Report an error if the range is empty and the syntax prohibits this. */
4478 ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
4481 collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
4484 start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
4485 end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
4486 for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
4488 unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
4498 char' -- we would otherwise go into an infinite loop, since all
4501 /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
4535 truncate wchar_t character to char. */
4536 static unsigned char truncate_wchar (CHAR_T c);
4538 static unsigned char
4541 unsigned char buf[MB_CUR_MAX];
4550 return retval > 0 ? buf[0] : (unsigned char) c;
4562 char *destination;
4565 register char *fastmap = bufp->fastmap;
4569 pattern to (char*) in regex_compile. */
4705 if (!(bufp->syntax & RE_DOT_NEWLINE))
4932 re_search (struct re_pattern_buffer *bufp, const char *string, int size,
4965 re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
4966 const char *string2, int size2, int startpos, int range,
5023 PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
5024 int size1, const char *string2, int size2,
5029 register char *fastmap = bufp->fastmap;
5041 char *is_binary = NULL;
5095 is_binary = TALLOC (size1 + 1, char);
5101 is_binary = REGEX_TALLOC (size1 + 1, char);
5133 is_binary = TALLOC (size2 + 1, char);
5139 is_binary = REGEX_TALLOC (size2 + 1, char);
5172 register const char *d;
5185 && !fastmap[(unsigned char)
5186 translate[(unsigned char) *d++]])
5189 while (range > lim && !fastmap[(unsigned char) *d++])
5200 if (!fastmap[(unsigned char) TRANSLATE (c)])
5410 re_match (struct re_pattern_buffer *bufp, const char *string,
5448 int len, char *translate);
5465 re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
5466 const char *string2, int size2, int pos,
5546 const char *cstring1, int csize1,
5547 const char *cstring2, int csize2,
5561 const char *string1, int size1,
5562 const char *string2, int size2,
5572 char *is_binary = NULL;
5607 registers, and, finally, two char *'s. The first char * is where
5762 is_binary = REGEX_TALLOC (csize1 + 1, char);
5775 is_binary = REGEX_TALLOC (csize2 + 1, char);
5793 pattern to (char*) in regex_compile. */
6134 if ((UCHAR_T) translate[(unsigned char) *d++]
6144 if ((UCHAR_T) translate[(unsigned char) *d++]
6170 if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
6171 || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
6241 const unsigned char *extra = (const unsigned char *)
6492 const char *collseq = (const char *)
6514 at str_buf[4], and compared char at str_buf[2]. */
6558 /* match with char? */
6568 /* Cast to `unsigned' instead of `unsigned char' in case the
7057 (char) c,
7058 (char) p1[3+OFFSET_ADDRESS_SIZE]);
7076 p[-3] = (unsigned char) pop_failure_jump;
7092 p[-3] = (unsigned char) pop_failure_jump;
7109 p[-3] = (unsigned char) pop_failure_jump;
7126 p[-3] = (unsigned char) pop_failure_jump;
7367 if (PTR_CHAR_POS ((unsigned char *) d) >= point)
7373 if (PTR_CHAR_POS ((unsigned char *) d) != point)
7379 if (PTR_CHAR_POS ((unsigned char *) d) <= point)
7783 const char *
7784 re_compile_pattern (const char *pattern, size_t length,
7825 char *
7832 re_comp (const char *s)
7839 return (char *) gettext ("No previous regular expression");
7845 re_comp_buf.buffer = (unsigned char *) malloc (200);
7847 return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
7850 re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
7852 return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
7872 return (char *) gettext (re_error_msgid[(int) ret]);
7880 re_exec (const char *s)
7901 `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
7913 If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
7914 use POSIX basic syntax.
7930 regcomp (regex_t *preg, const char *pattern, int cflags)
7933 reg_syntax_t syntax
7943 preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
7965 syntax &= ~RE_DOT_NEWLINE;
7966 syntax |= RE_HAT_LISTS_NOT_NEWLINE;
7979 ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
7982 ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
8023 regexec (const regex_t *preg, const char *string, size_t nmatch,
8087 char *errbuf, size_t errbuf_size)
8089 const char *msg;
8110 *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';