| 3736 | STR_IDX is the current index of the input string. |
| 3737 | |
| 3738 | This function handles the nodes which can accept one character, or |
| 3739 | one collating element like '.', '[a-z]', opposite to the other nodes |
| 3740 | can only accept one byte. */ |
| 3741 | |
| 3742 | static int |
| 3743 | internal_function |
| 3744 | check_node_accept_bytes (const re_dfa_t *dfa, int node_idx, |
| 3745 | const re_string_t *input, int str_idx) |
| 3746 | { |
| 3747 | const re_token_t *node = dfa->nodes + node_idx; |
| 3748 | int char_len, elem_len; |
| 3749 | int i; |
| 3750 | wint_t wc; |
| 3751 | |
| 3752 | if (BE (node->type == OP_UTF8_PERIOD, 0)) |
| 3753 | { |
| 3754 | unsigned char c = re_string_byte_at (input, str_idx), d; |
| 3755 | if (BE (c < 0xc2, 1)) |
| 3756 | return 0; |
| 3757 | |
| 3758 | if (str_idx + 2 > input->len) |
| 3759 | return 0; |
| 3760 | |
| 3761 | d = re_string_byte_at (input, str_idx + 1); |
| 3762 | if (c < 0xe0) |
| 3763 | return (d < 0x80 || d > 0xbf) ? 0 : 2; |
| 3764 | else if (c < 0xf0) |
| 3765 | { |
| 3766 | char_len = 3; |
| 3767 | if (c == 0xe0 && d < 0xa0) |
| 3768 | return 0; |
| 3769 | } |
| 3770 | else if (c < 0xf8) |
| 3771 | { |
| 3772 | char_len = 4; |
| 3773 | if (c == 0xf0 && d < 0x90) |
| 3774 | return 0; |
| 3775 | } |
| 3776 | else if (c < 0xfc) |
| 3777 | { |
| 3778 | char_len = 5; |
| 3779 | if (c == 0xf8 && d < 0x88) |
| 3780 | return 0; |
| 3781 | } |
| 3782 | else if (c < 0xfe) |
| 3783 | { |
| 3784 | char_len = 6; |
| 3785 | if (c == 0xfc && d < 0x84) |
| 3786 | return 0; |
| 3787 | } |
| 3788 | else |
| 3789 | return 0; |
| 3790 | |
| 3791 | if (str_idx + char_len > input->len) |
| 3792 | return 0; |
| 3793 | |
| 3794 | for (i = 1; i < char_len; ++i) |
| 3795 | { |
no test coverage detected