Skip to main content

lol_html/parser/state_machine/syntax/tag/
attributes.rs

1define_state_group!(attributes_states_group = {
2
3    #[inline(never)]
4    before_attribute_name_state {
5        whitespace => ()
6        b'/'       => ( --> self_closing_start_tag_state )
7        b'>'       => ( emit_tag?; --> dyn next_text_parsing_state )
8        eof        => ( emit_raw_without_token_and_eof?; )
9        _          => ( start_attr; --> #[inline] attribute_name_state )
10    }
11
12    attribute_name_state {
13        whitespace => ( finish_attr_name; --> #[inline] after_attribute_name_state )
14        b'='       => ( finish_attr_name; --> #[inline] before_attribute_value_state )
15        b'/'       => ( finish_attr_name; finish_attr; --> self_closing_start_tag_state )
16        b'>'       => ( finish_attr_name; finish_attr; emit_tag?; --> dyn next_text_parsing_state )
17        eof        => ( emit_raw_without_token_and_eof?; )
18        _          => ()
19    }
20
21    after_attribute_name_state {
22        whitespace => ()
23        b'/'       => ( finish_attr; --> self_closing_start_tag_state )
24        b'='       => ( --> #[inline] before_attribute_value_state )
25        b'>'       => ( finish_attr; emit_tag?; --> dyn next_text_parsing_state )
26        eof        => ( emit_raw_without_token_and_eof?; )
27        _          => ( finish_attr; start_attr; --> attribute_name_state )
28    }
29
30    before_attribute_value_state {
31        whitespace => ()
32        b'"'       => ( set_closing_quote_to_double; --> #[inline] attribute_value_double_quoted_state )
33        b'\''      => ( set_closing_quote_to_single; --> #[inline] attribute_value_single_quoted_state )
34        b'>'       => ( finish_attr; emit_tag?; --> data_state )
35        eof        => ( emit_raw_without_token_and_eof?; )
36        _          => ( reconsume in attribute_value_unquoted_state )
37    }
38
39    attribute_value_single_quoted_state <-- ( start_token_part; ) {
40        memchr(b'\'') => ( finish_attr_value; finish_attr; --> before_attribute_name_state )
41        eof           => ( emit_raw_without_token_and_eof?; )
42    }
43
44    attribute_value_double_quoted_state <-- ( start_token_part; ) {
45        memchr(b'"') => ( finish_attr_value; finish_attr; --> before_attribute_name_state )
46        eof           => ( emit_raw_without_token_and_eof?; )
47    }
48
49    attribute_value_unquoted_state <-- ( start_token_part; ) {
50        whitespace => ( finish_attr_value; finish_attr; --> before_attribute_name_state )
51        b'>'       => ( finish_attr_value; finish_attr; emit_tag?; --> dyn next_text_parsing_state )
52        eof        => ( emit_raw_without_token_and_eof?; )
53        _          => ()
54    }
55
56});