| 4041 | # endif /* _LIBC */ |
| 4042 | #endif /* RE_ENABLE_I18N */ |
| 4043 | |
| 4044 | /* Check whether the node accepts the byte which is IDX-th |
| 4045 | byte of the INPUT. */ |
| 4046 | |
| 4047 | static int |
| 4048 | internal_function |
| 4049 | check_node_accept (const re_match_context_t *mctx, const re_token_t *node, |
| 4050 | int idx) |
| 4051 | { |
| 4052 | unsigned char ch; |
| 4053 | ch = re_string_byte_at (&mctx->input, idx); |
| 4054 | switch (node->type) |
| 4055 | { |
| 4056 | case CHARACTER: |
| 4057 | if (node->opr.c != ch) |
| 4058 | return 0; |
| 4059 | break; |
| 4060 | |
| 4061 | case SIMPLE_BRACKET: |
| 4062 | if (!bitset_contain (node->opr.sbcset, ch)) |
| 4063 | return 0; |
| 4064 | break; |
| 4065 | |
| 4066 | #ifdef RE_ENABLE_I18N |
| 4067 | case OP_UTF8_PERIOD: |
| 4068 | if (ch >= 0x80) |
| 4069 | return 0; |
| 4070 | /* FALLTHROUGH */ |
| 4071 | #endif |
| 4072 | case OP_PERIOD: |
| 4073 | if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE)) |
| 4074 | || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL))) |
| 4075 | return 0; |
| 4076 | break; |
| 4077 | |
| 4078 | default: |
| 4079 | return 0; |
| 4080 | } |
| 4081 | |
| 4082 | if (node->constraint) |
| 4083 | { |
| 4084 | /* The node has constraints. Check whether the current context |
| 4085 | satisfies the constraints. */ |
| 4086 | unsigned int context = re_string_context_at (&mctx->input, idx, |
| 4087 | mctx->eflags); |
| 4088 | if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) |
| 4089 | return 0; |
| 4090 | } |
| 4091 | |
| 4092 | return 1; |
no test coverage detected