yozora-tokenizer-html-block 0.1.0

Yozora tokenizer for HTML blocks.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use yozora_character::{AsciiCodePoint, NodePoint};

pub fn eat_start_condition3(node_points: &[NodePoint], i: usize, end: usize) -> Option<usize> {
    (i < end && node_points[i].code_point == AsciiCodePoint::QUESTION_MARK as i32).then_some(i + 1)
}

pub fn eat_end_condition3(node_points: &[NodePoint], start: usize, end: usize) -> Option<usize> {
    (start..end).find_map(|i| {
        (i + 1 < end
            && node_points[i].code_point == AsciiCodePoint::QUESTION_MARK as i32
            && node_points[i + 1].code_point == AsciiCodePoint::CLOSE_ANGLE as i32)
            .then_some(i + 2)
    })
}