| 2018 | break; |
| 2019 | default: |
| 2020 | break; |
| 2021 | } |
| 2022 | return 1; |
| 2023 | } |
| 2024 | |
| 2025 | /* Peek a token from INPUT, and return the length of the token. |
| 2026 | We must not use this function out of bracket expressions. */ |
| 2027 | |
| 2028 | static int |
| 2029 | internal_function |
| 2030 | peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) |
| 2031 | { |
| 2032 | unsigned char c; |
| 2033 | if (re_string_eoi (input)) |
| 2034 | { |
| 2035 | token->type = END_OF_RE; |
| 2036 | return 0; |
| 2037 | } |
| 2038 | c = re_string_peek_byte (input, 0); |
| 2039 | token->opr.c = c; |
| 2040 | |
| 2041 | #ifdef RE_ENABLE_I18N |
| 2042 | if (input->mb_cur_max > 1 && |
| 2043 | !re_string_first_byte (input, re_string_cur_idx (input))) |
| 2044 | { |
| 2045 | token->type = CHARACTER; |
| 2046 | return 1; |
| 2047 | } |
| 2048 | #endif /* RE_ENABLE_I18N */ |
| 2049 | |
| 2050 | if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) |
| 2051 | && re_string_cur_idx (input) + 1 < re_string_length (input)) |
| 2052 | { |
| 2053 | /* In this case, '\' escape a character. */ |
| 2054 | unsigned char c2; |
| 2055 | re_string_skip_bytes (input, 1); |
| 2056 | c2 = re_string_peek_byte (input, 0); |
| 2057 | token->opr.c = c2; |
| 2058 | token->type = CHARACTER; |
| 2059 | return 1; |
| 2060 | } |
| 2061 | if (c == '[') /* '[' is a special char in a bracket exps. */ |
| 2062 | { |
| 2063 | unsigned char c2; |
| 2064 | int token_len; |
| 2065 | if (re_string_cur_idx (input) + 1 < re_string_length (input)) |
| 2066 | c2 = re_string_peek_byte (input, 1); |
| 2067 | else |
| 2068 | c2 = 0; |
| 2069 | token->opr.c = c2; |
| 2070 | token_len = 2; |
| 2071 | switch (c2) |
| 2072 | { |
| 2073 | case '.': |
| 2074 | token->type = OP_OPEN_COLL_ELEM; |
| 2075 | break; |
| 2076 | case '=': |
| 2077 | token->type = OP_OPEN_EQUIV_CLASS; |
no outgoing calls
no test coverage detected