aboutsummaryrefslogtreecommitdiff
path: root/src/basic_emitter.rs
blob: 046b6458d97fa12e66833c5f31cc39872a5d1a48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
use std::collections::VecDeque;
use std::ops::Range;

use crate::offset::Offset;
use crate::Emitter;
use crate::Error;
use crate::Token;

/// An [`Emitter`] implementation that yields [`Token`].
pub struct BasicEmitter<O> {
    errors: VecDeque<(Error, Range<O>)>,
}

impl<O: Default> Default for BasicEmitter<O> {
    fn default() -> Self {
        BasicEmitter {
            errors: VecDeque::new(),
        }
    }
}

impl<O> BasicEmitter<O> {
    /// Removes all encountered tokenizer errors and returns them as an iterator.
    pub fn drain_errors(&mut self) -> impl Iterator<Item = (Error, Range<O>)> + '_ {
        self.errors.drain(0..)
    }
}

impl<O> Iterator for BasicEmitter<O> {
    type Item = Token<O>;

    fn next(&mut self) -> Option<Self::Item> {
        todo!()
    }
}

#[allow(unused_variables)]
impl<O: Offset> Emitter<O> for BasicEmitter<O> {
    fn report_error(&mut self, error: Error, span: Range<O>) {
        todo!()
    }

    fn emit_char(&mut self, c: char) {
        todo!()
    }

    fn emit_eof(&mut self) {
        todo!()
    }

    fn init_start_tag(&mut self, tag_offset: O, name_offset: O) {
        todo!()
    }

    fn init_end_tag(&mut self, tag_offset: O, name_offset: O) {
        todo!()
    }

    fn push_tag_name(&mut self, s: &str) {
        todo!()
    }

    fn init_attribute_name(&mut self, offset: O) {
        todo!()
    }

    fn push_attribute_name(&mut self, s: &str) {
        todo!()
    }

    fn push_attribute_value(&mut self, s: &str) {
        todo!()
    }

    fn set_self_closing(&mut self, slash_span: Range<O>) {
        todo!()
    }

    fn emit_current_tag(&mut self, offset: O) {
        todo!()
    }

    fn init_comment(&mut self, data_start_offset: O) {
        todo!()
    }

    fn push_comment(&mut self, s: &str) {
        todo!()
    }

    fn emit_current_comment(&mut self, data_end_offset: O) {
        todo!()
    }

    fn init_doctype(&mut self, offset: O) {
        todo!()
    }

    fn push_doctype_name(&mut self, s: &str) {
        todo!()
    }

    fn init_doctype_public_id(&mut self, offset: O) {
        todo!()
    }

    fn push_doctype_public_id(&mut self, s: &str) {
        todo!()
    }

    fn init_doctype_system_id(&mut self, offset: O) {
        todo!()
    }

    fn push_doctype_system_id(&mut self, s: &str) {
        todo!()
    }

    fn set_force_quirks(&mut self) {
        todo!()
    }

    fn emit_current_doctype(&mut self, offset: O) {
        todo!()
    }
}