1use super::{
2 tags::{
3 Tag, TagName,
4 },
5 state::{
6 TaggerState,
7 }
8};
9use crate::{
10 Error,
11 SourceEvent,
12 ParserEvent,
13 Local,
14 ParserResult,
15 Source,
16 Parser, Runtime,
17};
18
19#[derive(Debug,Clone)]
27pub struct Builder {
28 auto_detect: bool,
29 eof_in_tag: Unknown,
30
31 properties: TaggerProperties,
32}
33impl Builder {
34 pub fn new() -> Builder {
35 Builder{
36 auto_detect: false,
37 eof_in_tag: Unknown::Error,
38 properties: TaggerProperties::default(),
39 }
40 }
41 pub fn auto_detect() -> Builder {
42 Builder{
43 auto_detect: true,
44 eof_in_tag: Unknown::Error,
45 properties: TaggerProperties::default(),
46 }
47 }
48 pub fn with_all_attributes(mut self) -> Builder {
49 self.properties.attributes = AttributeProperties::All;
50 self
51 }
52 pub fn with_attribute<S: ToString>(mut self, name: TagName, attr: S) -> Builder {
53 match &mut self.properties.attributes {
54 AttributeProperties::None |
55 AttributeProperties::All => self.properties.attributes = AttributeProperties::Custom(vec![(name,attr.to_string())]),
56 AttributeProperties::Custom(v) => v.push((name,attr.to_string())),
57 };
58 self
59 }
60 pub fn skip_eof_in_tag(mut self) -> Builder {
61 self.eof_in_tag = Unknown::Skip;
62 self
63 }
64 pub fn text_eof_in_tag(mut self) -> Builder {
65 self.eof_in_tag = Unknown::Text;
66 self
67 }
68 pub fn eof_to_named_tag(mut self) -> Builder {
69 self.properties.eof_to_named_tag = true;
70 self
71 }
72 pub fn create(self) -> TagParser {
73 match self.auto_detect {
74 false => TagParser(InnerTagParser::Xhtml(XhtmlParser {
75 done: false,
76 eof_in_tag: self.eof_in_tag,
77 sbuffer: None,
78 pbuffer: None,
79 runtime: Runtime::new(self.properties),
80 final_error: None,
81 })),
82 true => TagParser(InnerTagParser::Detector(Detector{
83 eof_in_tag: self.eof_in_tag,
84 runtime: Runtime::new(self.properties),
85 })),
86 }
87 }
88}
89
90#[derive(Debug,Clone,Copy)]
91enum Unknown {
92 Error,
93 Skip,
94 Text
95}
96
97#[derive(Debug,Clone)]
98pub(in super) enum AttributeProperties {
99 None,
100 Custom(Vec<(TagName,String)>),
101 All,
102}
103
104#[derive(Debug,Clone)]
105pub(in super) struct TaggerProperties {
106 pub attributes: AttributeProperties,
107 pub eof_to_named_tag: bool,
108}
109impl Default for TaggerProperties {
110 fn default() -> TaggerProperties {
111 TaggerProperties {
112 attributes: AttributeProperties::None,
113 eof_to_named_tag: false,
114 }
115 }
116}
117
118pub struct TagParser(InnerTagParser);
119impl Parser for TagParser {
120 type Data = Tag;
121
122 fn next_event<S: Source>(&mut self, src: &mut S) -> ParserResult<Tag> {
123 self.0.next_event(src)
124 }
125}
126
127enum InnerTagParser {
128 None,
129 Detector(Detector),
130 Xhtml(XhtmlParser),
131 Plain(PlainParser),
132}
133impl Parser for InnerTagParser {
134 type Data = Tag;
135
136 fn next_event<S: Source>(&mut self, src: &mut S) -> ParserResult<Tag> {
137 match self {
138 InnerTagParser::Detector(..) => {
139 let mut tmp = InnerTagParser::None;
140 std::mem::swap(&mut tmp, self);
141 let detector = match tmp {
142 InnerTagParser::Detector(d) => d,
143 _ => unreachable!(),
144 };
145
146 let mut r = None;
147 *self = match detector.try_next(src) {
148 DetectorResult::Next(slf,res) => {
149 r = Some(res);
150 InnerTagParser::Detector(slf)
151 },
152 DetectorResult::Xhtml(xhtml) => InnerTagParser::Xhtml(xhtml),
153 DetectorResult::Plain(plain) => InnerTagParser::Plain(plain),
154 };
155 match r {
156 Some(r) => r,
157 None => self.next_event(src),
158 }
159 },
160 InnerTagParser::Xhtml(parser) => parser.next_event(src),
161 InnerTagParser::Plain(parser) => parser.next_event(src),
162 InnerTagParser::None => Ok(None),
163 }
164 }
165}
166
167#[derive(Default)]
168struct Counter {
169 common: usize,
170 named: usize,
171 service: usize,
172 unknown: usize,
173}
174impl Counter {
175 fn push(&mut self, tag: &Tag) {
176 if tag.name.is_common() { self.common += 1; } else {
177 if tag.name.is_named() { self.named += 1; } else {
178 if tag.name.is_service() { self.service += 1; }
179 else { self.unknown += 1; }
180 }
181 }
182 }
183 fn tags(&self) -> usize {
184 self.common + self.named + self.service
185 }
186 fn check(&self) -> bool {
187 ( self.common >= 2 ) || ( self.named >= 5 )
188 }
189}
190
191struct Detector {
192 eof_in_tag: Unknown,
193 runtime: Runtime<TaggerState,Tag,TaggerProperties>,
194}
195enum DetectorResult {
196 Next(Detector,ParserResult<Tag>),
197 Xhtml(XhtmlParser),
198 Plain(PlainParser),
199}
200impl Detector {
201 fn try_next<S: Source>(mut self, src: &mut S) -> DetectorResult {
202 match self.runtime.next_event(src) {
203 Ok(Some(lpe)) => match lpe.data() {
204 ParserEvent::Parsed(tag) => {
205 let mut counter = Counter::default();
206 counter.push(tag);
207 let mut pbuffer = vec![lpe];
208 let mut eof_buffer = None;
209 let mut eof_error = None;
210 let done = loop {
211 match self.runtime.next_event(src) {
212 Ok(Some(lpe)) => match lpe.data() {
213 ParserEvent::Parsed(tag) => {
214 counter.push(tag);
215 pbuffer.push(lpe);
216 },
217 _ => pbuffer.push(lpe),
218 },
219 Ok(None) => break true,
220 Err(Error::EofInTag(raw)) => {
221 eof_buffer = Some(raw);
222 break true;
223 },
224 Err(e) => {
225 eof_error = Some(e);
226 break true;
227 },
228 }
229
230 if counter.check() { break false; }
232 };
233 match counter.tags() > 0 {
235 true => {
236 match (self.eof_in_tag, eof_buffer) {
237 (_,None) |
238 (Unknown::Skip,_) => {},
239 (Unknown::Error,Some(raw)) => eof_error = Some(Error::EofInTag(raw)),
240 (Unknown::Text,Some(raw)) => {
241 for lse in raw {
242 pbuffer.push(lse.map(|se| se.into()));
243 }
244 }
245 }
246 DetectorResult::Xhtml(XhtmlParser {
247 done,
248 eof_in_tag: self.eof_in_tag,
249 sbuffer: None,
250 pbuffer: Some(pbuffer.into_iter()),
251 runtime: self.runtime,
252 final_error: eof_error,
253 })
254 },
255 false => {
256 if let Some(raw) = eof_buffer {
257 for lse in raw {
258 pbuffer.push(lse.map(|se| se.into()));
259 }
260 }
261 DetectorResult::Plain(PlainParser {
262 done,
263 sbuffer: None,
264 pbuffer: Some(pbuffer.into_iter()),
265 runtime: self.runtime,
266 final_error: eof_error,
267 })
268 },
269 }
270 },
271 _ => DetectorResult::Next(self,Ok(Some(lpe))),
272 },
273 Ok(None) => DetectorResult::Next(self,Ok(None)),
274 Err(Error::EofInTag(raw)) => DetectorResult::Plain(PlainParser { done: true,
276 sbuffer: Some(raw.into_iter()),
277 pbuffer: None,
278 runtime: self.runtime,
279 final_error: None
280 }),
281 Err(e) => DetectorResult::Next(self,Err(e)),
282 }
283 }
284}
285
286
287struct PlainParser {
288 done: bool,
289 sbuffer: Option<std::vec::IntoIter<Local<SourceEvent>>>,
290 pbuffer: Option<std::vec::IntoIter<Local<ParserEvent<Tag>>>>,
291 runtime: Runtime<TaggerState,Tag,TaggerProperties>,
292 final_error: Option<Error>,
293}
294impl PlainParser {
295 fn final_err(&mut self) -> ParserResult<Tag> {
296 match self.final_error.take() {
297 None => Ok(None),
298 Some(e) => Err(e),
299 }
300 }
301}
302impl Parser for PlainParser {
303 type Data = Tag;
304
305 fn next_event<S: Source>(&mut self, src: &mut S) -> ParserResult<Tag> {
306 if let Some(sbuf) = &mut self.sbuffer {
308 match sbuf.next() {
309 Some(lse) => return Ok(Some(lse.map(|se| se.into()))),
310 None => self.sbuffer = None,
311 }
312 }
313
314 if let Some(pbuf) = &mut self.pbuffer {
316 match pbuf.next() {
317 Some(lpe) => return match lpe.data() {
318 ParserEvent::Parsed(..) => {
319 let (_,pe) = lpe.into_inner();
320 let tag = match pe {
321 ParserEvent::Parsed(tag) => tag,
322 _ => unreachable!(),
323 };
324 let mut iter = tag.raw.into_iter();
325 match iter.next() {
326 Some(lse) => {
327 self.sbuffer = Some(iter);
328 Ok(Some(lse.map(|se| se.into())))
329 },
330 None => self.final_err(),
331 }
332 },
333 _ => Ok(Some(lpe)),
334 },
335 None => self.pbuffer = None,
336 }
337 }
338
339 match self.done {
340 false => match self.runtime.next_event(src) {
341 Ok(Some(lpe)) => match lpe.data() {
342 ParserEvent::Parsed(..) => {
343 let (_,pe) = lpe.into_inner();
344 let tag = match pe {
345 ParserEvent::Parsed(tag) => tag,
346 _ => unreachable!(),
347 };
348 let mut iter = tag.raw.into_iter();
349 match iter.next() {
350 Some(lse) => {
351 self.sbuffer = Some(iter);
352 Ok(Some(lse.map(|se| se.into())))
353 },
354 None => self.final_err(),
355 }
356 },
357 _ => Ok(Some(lpe)),
358 },
359 Ok(None) => self.final_err(),
360 Err(Error::EofInTag(raw)) => {
361 self.done = true;
362 let mut iter = raw.into_iter();
363 match iter.next() {
364 Some(lse) => {
365 self.sbuffer = Some(iter);
366 Ok(Some(lse.map(|se| se.into())))
367 },
368 None => self.final_err(),
369 }
370 },
371 Err(e) => Err(e),
372 },
373 true => self.final_err(),
374 }
375 }
376}
377
378
379struct XhtmlParser {
380 done: bool,
381 eof_in_tag: Unknown,
382 sbuffer: Option<std::vec::IntoIter<Local<SourceEvent>>>,
383 pbuffer: Option<std::vec::IntoIter<Local<ParserEvent<Tag>>>>,
384 runtime: Runtime<TaggerState,Tag,TaggerProperties>,
385 final_error: Option<Error>,
386}
387impl XhtmlParser {
388 fn final_err(&mut self) -> ParserResult<Tag> {
389 match self.final_error.take() {
390 None => Ok(None),
391 Some(e) => Err(e),
392 }
393 }
394}
395impl Parser for XhtmlParser {
396 type Data = Tag;
397
398 fn next_event<S: Source>(&mut self, src: &mut S) -> ParserResult<Tag> {
399 if let Some(sbuf) = &mut self.sbuffer {
401 match sbuf.next() {
402 Some(lse) => return Ok(Some(lse.map(|se| se.into()))),
403 None => self.sbuffer = None,
404 }
405 }
406
407 if let Some(pbuf) = &mut self.pbuffer {
409 match pbuf.next() {
410 Some(lpe) => return Ok(Some(lpe)),
411 None => self.pbuffer = None,
412 }
413 }
414
415 match self.done {
416 false => loop {
417 match self.runtime.next_event(src) {
418 Ok(Some(lpe)) => break Ok(Some(lpe)),
419 Ok(None) => break self.final_err(),
420 Err(Error::EofInTag(raw)) => {
421 self.done = true;
422 match self.eof_in_tag {
423 Unknown::Error => break Err(Error::EofInTag(raw)),
424 Unknown::Skip => {},
425 Unknown::Text => {
426 let mut iter = raw.into_iter();
427 if let Some(lse) = iter.next() {
428 self.sbuffer = Some(iter);
429 break Ok(Some(lse.map(|se| se.into())));
430 }
431 },
432 }
433 },
434 Err(e) => break Err(e),
435 }
436 },
437 true => self.final_err(),
438 }
439 }
440}
441
442
443#[cfg(test)]
462mod tests {
463 use crate::*;
464 use super::*;
465
466 use crate::tagger::tags::*;
467 use opt_struct::OptVec;
468
469 #[test]
470 fn basic() {
471 let mut src = "<h1>Hello, world!</h1>Привет, мир!".into_source();
472 let mut parser = Builder::new().create();
473
474 let mut res_iter = [
475 ParserEvent::Parsed(Tag {
476 name: TagName::H1, closing: Closing::Open, attributes: OptVec::None,
477 begin: ().localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
478 end: ().localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
479 raw: vec![
480 SourceEvent::Char('<').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
481 SourceEvent::Char('h').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
482 SourceEvent::Char('1').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
483 SourceEvent::Char('>').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
484 ],
485 }).localize(Snip { offset: 0, length: 4 },Snip { offset: 0, length: 4 }),
486 ParserEvent::Char('H').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
487 ParserEvent::Char('e').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
488 ParserEvent::Char('l').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
489 ParserEvent::Char('l').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
490 ParserEvent::Char('o').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
491 ParserEvent::Char(',').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
492 ParserEvent::Char(' ').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
493 ParserEvent::Char('w').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
494 ParserEvent::Char('o').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
495 ParserEvent::Char('r').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
496 ParserEvent::Char('l').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
497 ParserEvent::Char('d').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
498 ParserEvent::Char('!').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
499 ParserEvent::Parsed(Tag {
500 name: TagName::H1, closing: Closing::Close, attributes: OptVec::None,
501 begin: ().localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
502 end: ().localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
503 raw: vec![
504 SourceEvent::Char('<').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
505 SourceEvent::Char('/').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
506 SourceEvent::Char('h').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
507 SourceEvent::Char('1').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
508 SourceEvent::Char('>').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
509 ],
510 }).localize(Snip { offset: 17, length: 5 },Snip { offset: 17, length: 5 }),
511 ParserEvent::Char('П').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 2 }),
512 ParserEvent::Char('р').localize(Snip { offset: 23, length: 1 },Snip { offset: 24, length: 2 }),
513 ParserEvent::Char('и').localize(Snip { offset: 24, length: 1 },Snip { offset: 26, length: 2 }),
514 ParserEvent::Char('в').localize(Snip { offset: 25, length: 1 },Snip { offset: 28, length: 2 }),
515 ParserEvent::Char('е').localize(Snip { offset: 26, length: 1 },Snip { offset: 30, length: 2 }),
516 ParserEvent::Char('т').localize(Snip { offset: 27, length: 1 },Snip { offset: 32, length: 2 }),
517 ParserEvent::Char(',').localize(Snip { offset: 28, length: 1 },Snip { offset: 34, length: 1 }),
518 ParserEvent::Char(' ').localize(Snip { offset: 29, length: 1 },Snip { offset: 35, length: 1 }),
519 ParserEvent::Char('м').localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 2 }),
520 ParserEvent::Char('и').localize(Snip { offset: 31, length: 1 },Snip { offset: 38, length: 2 }),
521 ParserEvent::Char('р').localize(Snip { offset: 32, length: 1 },Snip { offset: 40, length: 2 }),
522 ParserEvent::Char('!').localize(Snip { offset: 33, length: 1 },Snip { offset: 42, length: 1 }),
523 ].into_iter();
524
525 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
526 match res_iter.next() {
536 Some(ev) => {
537 println!("Parser: {:?}",local_event);
538 println!("Result: {:?}",ev);
539 assert_eq!(local_event,ev);
540 },
541 None => {
542 panic!("parser has more events then test result");
543 },
544 }
545 }
546 }
547
548 #[test]
549 fn basic_void() {
550 let mut src = "<h1>Hello, world!</h1>Привет, <tag />мир!".into_source();
551 let mut parser = Builder::new().create();
552
553 let mut res_iter = [
554 ParserEvent::Parsed(Tag {
555 name: TagName::H1, closing: Closing::Open, attributes: OptVec::None,
556 begin: ().localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
557 end: ().localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
558 raw: vec![
559 SourceEvent::Char('<').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
560 SourceEvent::Char('h').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
561 SourceEvent::Char('1').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
562 SourceEvent::Char('>').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
563 ],
564 }).localize(Snip { offset: 0, length: 4 },Snip { offset: 0, length: 4 }),
565 ParserEvent::Char('H').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
566 ParserEvent::Char('e').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
567 ParserEvent::Char('l').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
568 ParserEvent::Char('l').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
569 ParserEvent::Char('o').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
570 ParserEvent::Char(',').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
571 ParserEvent::Char(' ').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
572 ParserEvent::Char('w').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
573 ParserEvent::Char('o').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
574 ParserEvent::Char('r').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
575 ParserEvent::Char('l').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
576 ParserEvent::Char('d').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
577 ParserEvent::Char('!').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
578 ParserEvent::Parsed(Tag {
579 name: TagName::H1, closing: Closing::Close, attributes: OptVec::None,
580 begin: ().localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
581 end: ().localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
582 raw: vec![
583 SourceEvent::Char('<').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
584 SourceEvent::Char('/').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
585 SourceEvent::Char('h').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
586 SourceEvent::Char('1').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
587 SourceEvent::Char('>').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
588 ],
589 }).localize(Snip { offset: 17, length: 5 },Snip { offset: 17, length: 5 }),
590 ParserEvent::Char('П').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 2 }),
591 ParserEvent::Char('р').localize(Snip { offset: 23, length: 1 },Snip { offset: 24, length: 2 }),
592 ParserEvent::Char('и').localize(Snip { offset: 24, length: 1 },Snip { offset: 26, length: 2 }),
593 ParserEvent::Char('в').localize(Snip { offset: 25, length: 1 },Snip { offset: 28, length: 2 }),
594 ParserEvent::Char('е').localize(Snip { offset: 26, length: 1 },Snip { offset: 30, length: 2 }),
595 ParserEvent::Char('т').localize(Snip { offset: 27, length: 1 },Snip { offset: 32, length: 2 }),
596 ParserEvent::Char(',').localize(Snip { offset: 28, length: 1 },Snip { offset: 34, length: 1 }),
597 ParserEvent::Char(' ').localize(Snip { offset: 29, length: 1 },Snip { offset: 35, length: 1 }),
598 ParserEvent::Parsed(Tag {
599 name: TagName::Other("tag".to_string()), closing: Closing::Void, attributes: OptVec::None,
600 begin: ().localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 1 }),
601 end: ().localize(Snip { offset: 36, length: 1 },Snip { offset: 42, length: 1 }),
602 raw: vec![
603 SourceEvent::Char('<').localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 1 }),
604 SourceEvent::Char('t').localize(Snip { offset: 31, length: 1 },Snip { offset: 37, length: 1 }),
605 SourceEvent::Char('a').localize(Snip { offset: 32, length: 1 },Snip { offset: 38, length: 1 }),
606 SourceEvent::Char('g').localize(Snip { offset: 33, length: 1 },Snip { offset: 39, length: 1 }),
607 SourceEvent::Char(' ').localize(Snip { offset: 34, length: 1 },Snip { offset: 40, length: 1 }),
608 SourceEvent::Char('/').localize(Snip { offset: 35, length: 1 },Snip { offset: 41, length: 1 }),
609 SourceEvent::Char('>').localize(Snip { offset: 36, length: 1 },Snip { offset: 42, length: 1 }),
610 ],
611 }).localize(Snip { offset: 30, length: 7 },Snip { offset: 36, length: 7 }),
612 ParserEvent::Char('м').localize(Snip { offset: 37, length: 1 },Snip { offset: 43, length: 2 }),
613 ParserEvent::Char('и').localize(Snip { offset: 38, length: 1 },Snip { offset: 45, length: 2 }),
614 ParserEvent::Char('р').localize(Snip { offset: 39, length: 1 },Snip { offset: 47, length: 2 }),
615 ParserEvent::Char('!').localize(Snip { offset: 40, length: 1 },Snip { offset: 49, length: 1 }),
616 ].into_iter();
617
618 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
619 match res_iter.next() {
629 Some(ev) => {
630 println!("Parser: {:?}",local_event);
631 println!("Result: {:?}",ev);
632 assert_eq!(local_event,ev);
633 },
634 None => {
635 panic!("parser has more events then test result");
636 },
637 }
638 }
639 }
640
641 #[test]
642 fn basic_void_2() {
643 let mut src = "<h1>Hello, world!</h1>Привет, <tags/>мир!".into_source();
644 let mut parser = Builder::new().create();
645
646 let mut res_iter = [
647 ParserEvent::Parsed(Tag {
648 name: TagName::H1, closing: Closing::Open, attributes: OptVec::None,
649 begin: ().localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
650 end: ().localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
651 raw: vec![
652 SourceEvent::Char('<').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
653 SourceEvent::Char('h').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
654 SourceEvent::Char('1').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
655 SourceEvent::Char('>').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
656 ],
657 }).localize(Snip { offset: 0, length: 4 },Snip { offset: 0, length: 4 }),
658 ParserEvent::Char('H').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
659 ParserEvent::Char('e').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
660 ParserEvent::Char('l').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
661 ParserEvent::Char('l').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
662 ParserEvent::Char('o').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
663 ParserEvent::Char(',').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
664 ParserEvent::Char(' ').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
665 ParserEvent::Char('w').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
666 ParserEvent::Char('o').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
667 ParserEvent::Char('r').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
668 ParserEvent::Char('l').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
669 ParserEvent::Char('d').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
670 ParserEvent::Char('!').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
671 ParserEvent::Parsed(Tag {
672 name: TagName::H1, closing: Closing::Close, attributes: OptVec::None,
673 begin: ().localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
674 end: ().localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
675 raw: vec![
676 SourceEvent::Char('<').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
677 SourceEvent::Char('/').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
678 SourceEvent::Char('h').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
679 SourceEvent::Char('1').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
680 SourceEvent::Char('>').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
681 ],
682 }).localize(Snip { offset: 17, length: 5 },Snip { offset: 17, length: 5 }),
683 ParserEvent::Char('П').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 2 }),
684 ParserEvent::Char('р').localize(Snip { offset: 23, length: 1 },Snip { offset: 24, length: 2 }),
685 ParserEvent::Char('и').localize(Snip { offset: 24, length: 1 },Snip { offset: 26, length: 2 }),
686 ParserEvent::Char('в').localize(Snip { offset: 25, length: 1 },Snip { offset: 28, length: 2 }),
687 ParserEvent::Char('е').localize(Snip { offset: 26, length: 1 },Snip { offset: 30, length: 2 }),
688 ParserEvent::Char('т').localize(Snip { offset: 27, length: 1 },Snip { offset: 32, length: 2 }),
689 ParserEvent::Char(',').localize(Snip { offset: 28, length: 1 },Snip { offset: 34, length: 1 }),
690 ParserEvent::Char(' ').localize(Snip { offset: 29, length: 1 },Snip { offset: 35, length: 1 }),
691 ParserEvent::Parsed(Tag {
692 name: TagName::Other("tags".to_string()), closing: Closing::Void, attributes: OptVec::None,
693 begin: ().localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 1 }),
694 end: ().localize(Snip { offset: 36, length: 1 },Snip { offset: 42, length: 1 }),
695 raw: vec![
696 SourceEvent::Char('<').localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 1 }),
697 SourceEvent::Char('t').localize(Snip { offset: 31, length: 1 },Snip { offset: 37, length: 1 }),
698 SourceEvent::Char('a').localize(Snip { offset: 32, length: 1 },Snip { offset: 38, length: 1 }),
699 SourceEvent::Char('g').localize(Snip { offset: 33, length: 1 },Snip { offset: 39, length: 1 }),
700 SourceEvent::Char('s').localize(Snip { offset: 34, length: 1 },Snip { offset: 40, length: 1 }),
701 SourceEvent::Char('/').localize(Snip { offset: 35, length: 1 },Snip { offset: 41, length: 1 }),
702 SourceEvent::Char('>').localize(Snip { offset: 36, length: 1 },Snip { offset: 42, length: 1 }),
703 ],
704 }).localize(Snip { offset: 30, length: 7 },Snip { offset: 36, length: 7 }),
705 ParserEvent::Char('м').localize(Snip { offset: 37, length: 1 },Snip { offset: 43, length: 2 }),
706 ParserEvent::Char('и').localize(Snip { offset: 38, length: 1 },Snip { offset: 45, length: 2 }),
707 ParserEvent::Char('р').localize(Snip { offset: 39, length: 1 },Snip { offset: 47, length: 2 }),
708 ParserEvent::Char('!').localize(Snip { offset: 40, length: 1 },Snip { offset: 49, length: 1 }),
709 ].into_iter();
710
711 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
712 match res_iter.next() {
722 Some(ev) => {
723 println!("Parser: {:?}",local_event);
724 println!("Result: {:?}",ev);
725 assert_eq!(local_event,ev);
726 },
727 None => {
728 panic!("parser has more events then test result");
729 },
730 }
731 }
732 }
733
734
735 #[test]
736 fn a_img() {
737 let mut src = "
738<p>In the common case, <a href=\"apis-in-html-documents.html#dynamic-markup-insertion\" title=\"dynamic markup
739 insertion\">, e.g. using the <code title=\"dom-document-write\"><a href=\"apis-in-html-documents.html#dom-document-write\">document.write()</a></code> API.</p>
740 <p><img alt=\"\" height=\"554\" src=\"https://dev.w3.org/html5/spec/images/parsing-model-overview.png\" width=\"427\"></p>
741 <p id=\"nestedParsing\">There is only one set of states for the
742 tokenizer stage and the tree construction stage...</p>".into_source();
743 let mut parser = Builder::new()
744 .with_attribute(TagName::A,"href")
745 .with_attribute(TagName::Img,"alt")
746 .create();
747
748 let mut res_iter = [
749 ParserEvent::Char('\n').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
750 ParserEvent::Parsed(Tag {
751 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
752 begin: ().localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
753 end: ().localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
754 raw: vec![
755 SourceEvent::Char('<').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
756 SourceEvent::Char('p').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
757 SourceEvent::Char('>').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
758 ],
759 }).localize(Snip { offset: 1, length: 3 },Snip { offset: 1, length: 3 }),
760 ParserEvent::Char('I').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
761 ParserEvent::Char('n').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
762 ParserEvent::Char(' ').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
763 ParserEvent::Char('t').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
764 ParserEvent::Char('h').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
765 ParserEvent::Char('e').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
766 ParserEvent::Char(' ').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
767 ParserEvent::Char('c').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
768 ParserEvent::Char('o').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
769 ParserEvent::Char('m').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
770 ParserEvent::Char('m').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
771 ParserEvent::Char('o').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
772 ParserEvent::Char('n').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
773 ParserEvent::Char(' ').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
774 ParserEvent::Char('c').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
775 ParserEvent::Char('a').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
776 ParserEvent::Char('s').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
777 ParserEvent::Char('e').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
778 ParserEvent::Char(',').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 1 }),
779 ParserEvent::Char(' ').localize(Snip { offset: 23, length: 1 },Snip { offset: 23, length: 1 }),
780 ParserEvent::Parsed(Tag {
781 name: TagName::A, closing: Closing::Open,
782 attributes: OptVec::One(("href".to_string(), Some(Snip{ offset: 9, length: 51 }))),
783 begin: ().localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
784 end: ().localize(Snip { offset: 121, length: 1 },Snip { offset: 121, length: 1 }),
785 raw: vec![
786 SourceEvent::Char('<').localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
787 SourceEvent::Char('a').localize(Snip { offset: 25, length: 1 },Snip { offset: 25, length: 1 }),
788 SourceEvent::Char(' ').localize(Snip { offset: 26, length: 1 },Snip { offset: 26, length: 1 }),
789 SourceEvent::Char('h').localize(Snip { offset: 27, length: 1 },Snip { offset: 27, length: 1 }),
790 SourceEvent::Char('r').localize(Snip { offset: 28, length: 1 },Snip { offset: 28, length: 1 }),
791 SourceEvent::Char('e').localize(Snip { offset: 29, length: 1 },Snip { offset: 29, length: 1 }),
792 SourceEvent::Char('f').localize(Snip { offset: 30, length: 1 },Snip { offset: 30, length: 1 }),
793 SourceEvent::Char('=').localize(Snip { offset: 31, length: 1 },Snip { offset: 31, length: 1 }),
794 SourceEvent::Char('"').localize(Snip { offset: 32, length: 1 },Snip { offset: 32, length: 1 }),
795 SourceEvent::Char('a').localize(Snip { offset: 33, length: 1 },Snip { offset: 33, length: 1 }),
796 SourceEvent::Char('p').localize(Snip { offset: 34, length: 1 },Snip { offset: 34, length: 1 }),
797 SourceEvent::Char('i').localize(Snip { offset: 35, length: 1 },Snip { offset: 35, length: 1 }),
798 SourceEvent::Char('s').localize(Snip { offset: 36, length: 1 },Snip { offset: 36, length: 1 }),
799 SourceEvent::Char('-').localize(Snip { offset: 37, length: 1 },Snip { offset: 37, length: 1 }),
800 SourceEvent::Char('i').localize(Snip { offset: 38, length: 1 },Snip { offset: 38, length: 1 }),
801 SourceEvent::Char('n').localize(Snip { offset: 39, length: 1 },Snip { offset: 39, length: 1 }),
802 SourceEvent::Char('-').localize(Snip { offset: 40, length: 1 },Snip { offset: 40, length: 1 }),
803 SourceEvent::Char('h').localize(Snip { offset: 41, length: 1 },Snip { offset: 41, length: 1 }),
804 SourceEvent::Char('t').localize(Snip { offset: 42, length: 1 },Snip { offset: 42, length: 1 }),
805 SourceEvent::Char('m').localize(Snip { offset: 43, length: 1 },Snip { offset: 43, length: 1 }),
806 SourceEvent::Char('l').localize(Snip { offset: 44, length: 1 },Snip { offset: 44, length: 1 }),
807 SourceEvent::Char('-').localize(Snip { offset: 45, length: 1 },Snip { offset: 45, length: 1 }),
808 SourceEvent::Char('d').localize(Snip { offset: 46, length: 1 },Snip { offset: 46, length: 1 }),
809 SourceEvent::Char('o').localize(Snip { offset: 47, length: 1 },Snip { offset: 47, length: 1 }),
810 SourceEvent::Char('c').localize(Snip { offset: 48, length: 1 },Snip { offset: 48, length: 1 }),
811 SourceEvent::Char('u').localize(Snip { offset: 49, length: 1 },Snip { offset: 49, length: 1 }),
812 SourceEvent::Char('m').localize(Snip { offset: 50, length: 1 },Snip { offset: 50, length: 1 }),
813 SourceEvent::Char('e').localize(Snip { offset: 51, length: 1 },Snip { offset: 51, length: 1 }),
814 SourceEvent::Char('n').localize(Snip { offset: 52, length: 1 },Snip { offset: 52, length: 1 }),
815 SourceEvent::Char('t').localize(Snip { offset: 53, length: 1 },Snip { offset: 53, length: 1 }),
816 SourceEvent::Char('s').localize(Snip { offset: 54, length: 1 },Snip { offset: 54, length: 1 }),
817 SourceEvent::Char('.').localize(Snip { offset: 55, length: 1 },Snip { offset: 55, length: 1 }),
818 SourceEvent::Char('h').localize(Snip { offset: 56, length: 1 },Snip { offset: 56, length: 1 }),
819 SourceEvent::Char('t').localize(Snip { offset: 57, length: 1 },Snip { offset: 57, length: 1 }),
820 SourceEvent::Char('m').localize(Snip { offset: 58, length: 1 },Snip { offset: 58, length: 1 }),
821 SourceEvent::Char('l').localize(Snip { offset: 59, length: 1 },Snip { offset: 59, length: 1 }),
822 SourceEvent::Char('#').localize(Snip { offset: 60, length: 1 },Snip { offset: 60, length: 1 }),
823 SourceEvent::Char('d').localize(Snip { offset: 61, length: 1 },Snip { offset: 61, length: 1 }),
824 SourceEvent::Char('y').localize(Snip { offset: 62, length: 1 },Snip { offset: 62, length: 1 }),
825 SourceEvent::Char('n').localize(Snip { offset: 63, length: 1 },Snip { offset: 63, length: 1 }),
826 SourceEvent::Char('a').localize(Snip { offset: 64, length: 1 },Snip { offset: 64, length: 1 }),
827 SourceEvent::Char('m').localize(Snip { offset: 65, length: 1 },Snip { offset: 65, length: 1 }),
828 SourceEvent::Char('i').localize(Snip { offset: 66, length: 1 },Snip { offset: 66, length: 1 }),
829 SourceEvent::Char('c').localize(Snip { offset: 67, length: 1 },Snip { offset: 67, length: 1 }),
830 SourceEvent::Char('-').localize(Snip { offset: 68, length: 1 },Snip { offset: 68, length: 1 }),
831 SourceEvent::Char('m').localize(Snip { offset: 69, length: 1 },Snip { offset: 69, length: 1 }),
832 SourceEvent::Char('a').localize(Snip { offset: 70, length: 1 },Snip { offset: 70, length: 1 }),
833 SourceEvent::Char('r').localize(Snip { offset: 71, length: 1 },Snip { offset: 71, length: 1 }),
834 SourceEvent::Char('k').localize(Snip { offset: 72, length: 1 },Snip { offset: 72, length: 1 }),
835 SourceEvent::Char('u').localize(Snip { offset: 73, length: 1 },Snip { offset: 73, length: 1 }),
836 SourceEvent::Char('p').localize(Snip { offset: 74, length: 1 },Snip { offset: 74, length: 1 }),
837 SourceEvent::Char('-').localize(Snip { offset: 75, length: 1 },Snip { offset: 75, length: 1 }),
838 SourceEvent::Char('i').localize(Snip { offset: 76, length: 1 },Snip { offset: 76, length: 1 }),
839 SourceEvent::Char('n').localize(Snip { offset: 77, length: 1 },Snip { offset: 77, length: 1 }),
840 SourceEvent::Char('s').localize(Snip { offset: 78, length: 1 },Snip { offset: 78, length: 1 }),
841 SourceEvent::Char('e').localize(Snip { offset: 79, length: 1 },Snip { offset: 79, length: 1 }),
842 SourceEvent::Char('r').localize(Snip { offset: 80, length: 1 },Snip { offset: 80, length: 1 }),
843 SourceEvent::Char('t').localize(Snip { offset: 81, length: 1 },Snip { offset: 81, length: 1 }),
844 SourceEvent::Char('i').localize(Snip { offset: 82, length: 1 },Snip { offset: 82, length: 1 }),
845 SourceEvent::Char('o').localize(Snip { offset: 83, length: 1 },Snip { offset: 83, length: 1 }),
846 SourceEvent::Char('n').localize(Snip { offset: 84, length: 1 },Snip { offset: 84, length: 1 }),
847 SourceEvent::Char('"').localize(Snip { offset: 85, length: 1 },Snip { offset: 85, length: 1 }),
848 SourceEvent::Char(' ').localize(Snip { offset: 86, length: 1 },Snip { offset: 86, length: 1 }),
849 SourceEvent::Char('t').localize(Snip { offset: 87, length: 1 },Snip { offset: 87, length: 1 }),
850 SourceEvent::Char('i').localize(Snip { offset: 88, length: 1 },Snip { offset: 88, length: 1 }),
851 SourceEvent::Char('t').localize(Snip { offset: 89, length: 1 },Snip { offset: 89, length: 1 }),
852 SourceEvent::Char('l').localize(Snip { offset: 90, length: 1 },Snip { offset: 90, length: 1 }),
853 SourceEvent::Char('e').localize(Snip { offset: 91, length: 1 },Snip { offset: 91, length: 1 }),
854 SourceEvent::Char('=').localize(Snip { offset: 92, length: 1 },Snip { offset: 92, length: 1 }),
855 SourceEvent::Char('"').localize(Snip { offset: 93, length: 1 },Snip { offset: 93, length: 1 }),
856 SourceEvent::Char('d').localize(Snip { offset: 94, length: 1 },Snip { offset: 94, length: 1 }),
857 SourceEvent::Char('y').localize(Snip { offset: 95, length: 1 },Snip { offset: 95, length: 1 }),
858 SourceEvent::Char('n').localize(Snip { offset: 96, length: 1 },Snip { offset: 96, length: 1 }),
859 SourceEvent::Char('a').localize(Snip { offset: 97, length: 1 },Snip { offset: 97, length: 1 }),
860 SourceEvent::Char('m').localize(Snip { offset: 98, length: 1 },Snip { offset: 98, length: 1 }),
861 SourceEvent::Char('i').localize(Snip { offset: 99, length: 1 },Snip { offset: 99, length: 1 }),
862 SourceEvent::Char('c').localize(Snip { offset: 100, length: 1 },Snip { offset: 100, length: 1 }),
863 SourceEvent::Char(' ').localize(Snip { offset: 101, length: 1 },Snip { offset: 101, length: 1 }),
864 SourceEvent::Char('m').localize(Snip { offset: 102, length: 1 },Snip { offset: 102, length: 1 }),
865 SourceEvent::Char('a').localize(Snip { offset: 103, length: 1 },Snip { offset: 103, length: 1 }),
866 SourceEvent::Char('r').localize(Snip { offset: 104, length: 1 },Snip { offset: 104, length: 1 }),
867 SourceEvent::Char('k').localize(Snip { offset: 105, length: 1 },Snip { offset: 105, length: 1 }),
868 SourceEvent::Char('u').localize(Snip { offset: 106, length: 1 },Snip { offset: 106, length: 1 }),
869 SourceEvent::Char('p').localize(Snip { offset: 107, length: 1 },Snip { offset: 107, length: 1 }),
870 SourceEvent::Char('\n').localize(Snip { offset: 108, length: 1 },Snip { offset: 108, length: 1 }),
871 SourceEvent::Char(' ').localize(Snip { offset: 109, length: 1 },Snip { offset: 109, length: 1 }),
872 SourceEvent::Char(' ').localize(Snip { offset: 110, length: 1 },Snip { offset: 110, length: 1 }),
873 SourceEvent::Char('i').localize(Snip { offset: 111, length: 1 },Snip { offset: 111, length: 1 }),
874 SourceEvent::Char('n').localize(Snip { offset: 112, length: 1 },Snip { offset: 112, length: 1 }),
875 SourceEvent::Char('s').localize(Snip { offset: 113, length: 1 },Snip { offset: 113, length: 1 }),
876 SourceEvent::Char('e').localize(Snip { offset: 114, length: 1 },Snip { offset: 114, length: 1 }),
877 SourceEvent::Char('r').localize(Snip { offset: 115, length: 1 },Snip { offset: 115, length: 1 }),
878 SourceEvent::Char('t').localize(Snip { offset: 116, length: 1 },Snip { offset: 116, length: 1 }),
879 SourceEvent::Char('i').localize(Snip { offset: 117, length: 1 },Snip { offset: 117, length: 1 }),
880 SourceEvent::Char('o').localize(Snip { offset: 118, length: 1 },Snip { offset: 118, length: 1 }),
881 SourceEvent::Char('n').localize(Snip { offset: 119, length: 1 },Snip { offset: 119, length: 1 }),
882 SourceEvent::Char('"').localize(Snip { offset: 120, length: 1 },Snip { offset: 120, length: 1 }),
883 SourceEvent::Char('>').localize(Snip { offset: 121, length: 1 },Snip { offset: 121, length: 1 }),
884 ],
885 }).localize(Snip { offset: 24, length: 98 },Snip { offset: 24, length: 98 }),
886 ParserEvent::Char(',').localize(Snip { offset: 122, length: 1 },Snip { offset: 122, length: 1 }),
887 ParserEvent::Char(' ').localize(Snip { offset: 123, length: 1 },Snip { offset: 123, length: 1 }),
888 ParserEvent::Char('e').localize(Snip { offset: 124, length: 1 },Snip { offset: 124, length: 1 }),
889 ParserEvent::Char('.').localize(Snip { offset: 125, length: 1 },Snip { offset: 125, length: 1 }),
890 ParserEvent::Char('g').localize(Snip { offset: 126, length: 1 },Snip { offset: 126, length: 1 }),
891 ParserEvent::Char('.').localize(Snip { offset: 127, length: 1 },Snip { offset: 127, length: 1 }),
892 ParserEvent::Char(' ').localize(Snip { offset: 128, length: 1 },Snip { offset: 128, length: 1 }),
893 ParserEvent::Char('u').localize(Snip { offset: 129, length: 1 },Snip { offset: 129, length: 1 }),
894 ParserEvent::Char('s').localize(Snip { offset: 130, length: 1 },Snip { offset: 130, length: 1 }),
895 ParserEvent::Char('i').localize(Snip { offset: 131, length: 1 },Snip { offset: 131, length: 1 }),
896 ParserEvent::Char('n').localize(Snip { offset: 132, length: 1 },Snip { offset: 132, length: 1 }),
897 ParserEvent::Char('g').localize(Snip { offset: 133, length: 1 },Snip { offset: 133, length: 1 }),
898 ParserEvent::Char(' ').localize(Snip { offset: 134, length: 1 },Snip { offset: 134, length: 1 }),
899 ParserEvent::Char('t').localize(Snip { offset: 135, length: 1 },Snip { offset: 135, length: 1 }),
900 ParserEvent::Char('h').localize(Snip { offset: 136, length: 1 },Snip { offset: 136, length: 1 }),
901 ParserEvent::Char('e').localize(Snip { offset: 137, length: 1 },Snip { offset: 137, length: 1 }),
902 ParserEvent::Char(' ').localize(Snip { offset: 138, length: 1 },Snip { offset: 138, length: 1 }),
903 ParserEvent::Parsed(Tag {
904 name: TagName::Code, closing: Closing::Open, attributes: OptVec::None,
905 begin: ().localize(Snip { offset: 139, length: 1 },Snip { offset: 139, length: 1 }),
906 end: ().localize(Snip { offset: 171, length: 1 },Snip { offset: 171, length: 1 }),
907 raw: vec![
908 SourceEvent::Char('<').localize(Snip { offset: 139, length: 1 },Snip { offset: 139, length: 1 }),
909 SourceEvent::Char('c').localize(Snip { offset: 140, length: 1 },Snip { offset: 140, length: 1 }),
910 SourceEvent::Char('o').localize(Snip { offset: 141, length: 1 },Snip { offset: 141, length: 1 }),
911 SourceEvent::Char('d').localize(Snip { offset: 142, length: 1 },Snip { offset: 142, length: 1 }),
912 SourceEvent::Char('e').localize(Snip { offset: 143, length: 1 },Snip { offset: 143, length: 1 }),
913 SourceEvent::Char(' ').localize(Snip { offset: 144, length: 1 },Snip { offset: 144, length: 1 }),
914 SourceEvent::Char('t').localize(Snip { offset: 145, length: 1 },Snip { offset: 145, length: 1 }),
915 SourceEvent::Char('i').localize(Snip { offset: 146, length: 1 },Snip { offset: 146, length: 1 }),
916 SourceEvent::Char('t').localize(Snip { offset: 147, length: 1 },Snip { offset: 147, length: 1 }),
917 SourceEvent::Char('l').localize(Snip { offset: 148, length: 1 },Snip { offset: 148, length: 1 }),
918 SourceEvent::Char('e').localize(Snip { offset: 149, length: 1 },Snip { offset: 149, length: 1 }),
919 SourceEvent::Char('=').localize(Snip { offset: 150, length: 1 },Snip { offset: 150, length: 1 }),
920 SourceEvent::Char('"').localize(Snip { offset: 151, length: 1 },Snip { offset: 151, length: 1 }),
921 SourceEvent::Char('d').localize(Snip { offset: 152, length: 1 },Snip { offset: 152, length: 1 }),
922 SourceEvent::Char('o').localize(Snip { offset: 153, length: 1 },Snip { offset: 153, length: 1 }),
923 SourceEvent::Char('m').localize(Snip { offset: 154, length: 1 },Snip { offset: 154, length: 1 }),
924 SourceEvent::Char('-').localize(Snip { offset: 155, length: 1 },Snip { offset: 155, length: 1 }),
925 SourceEvent::Char('d').localize(Snip { offset: 156, length: 1 },Snip { offset: 156, length: 1 }),
926 SourceEvent::Char('o').localize(Snip { offset: 157, length: 1 },Snip { offset: 157, length: 1 }),
927 SourceEvent::Char('c').localize(Snip { offset: 158, length: 1 },Snip { offset: 158, length: 1 }),
928 SourceEvent::Char('u').localize(Snip { offset: 159, length: 1 },Snip { offset: 159, length: 1 }),
929 SourceEvent::Char('m').localize(Snip { offset: 160, length: 1 },Snip { offset: 160, length: 1 }),
930 SourceEvent::Char('e').localize(Snip { offset: 161, length: 1 },Snip { offset: 161, length: 1 }),
931 SourceEvent::Char('n').localize(Snip { offset: 162, length: 1 },Snip { offset: 162, length: 1 }),
932 SourceEvent::Char('t').localize(Snip { offset: 163, length: 1 },Snip { offset: 163, length: 1 }),
933 SourceEvent::Char('-').localize(Snip { offset: 164, length: 1 },Snip { offset: 164, length: 1 }),
934 SourceEvent::Char('w').localize(Snip { offset: 165, length: 1 },Snip { offset: 165, length: 1 }),
935 SourceEvent::Char('r').localize(Snip { offset: 166, length: 1 },Snip { offset: 166, length: 1 }),
936 SourceEvent::Char('i').localize(Snip { offset: 167, length: 1 },Snip { offset: 167, length: 1 }),
937 SourceEvent::Char('t').localize(Snip { offset: 168, length: 1 },Snip { offset: 168, length: 1 }),
938 SourceEvent::Char('e').localize(Snip { offset: 169, length: 1 },Snip { offset: 169, length: 1 }),
939 SourceEvent::Char('"').localize(Snip { offset: 170, length: 1 },Snip { offset: 170, length: 1 }),
940 SourceEvent::Char('>').localize(Snip { offset: 171, length: 1 },Snip { offset: 171, length: 1 }),
941 ],
942 }).localize(Snip { offset: 139, length: 33 },Snip { offset: 139, length: 33 }),
943 ParserEvent::Parsed(Tag {
944 name: TagName::A, closing: Closing::Open,
945 attributes: OptVec::One(("href".to_string(), Some(Snip{ offset: 9, length: 45 }))),
946 begin: ().localize(Snip { offset: 172, length: 1 },Snip { offset: 172, length: 1 }),
947 end: ().localize(Snip { offset: 228, length: 1 },Snip { offset: 228, length: 1 }),
948 raw: vec![
949 SourceEvent::Char('<').localize(Snip { offset: 172, length: 1 },Snip { offset: 172, length: 1 }),
950 SourceEvent::Char('a').localize(Snip { offset: 173, length: 1 },Snip { offset: 173, length: 1 }),
951 SourceEvent::Char(' ').localize(Snip { offset: 174, length: 1 },Snip { offset: 174, length: 1 }),
952 SourceEvent::Char('h').localize(Snip { offset: 175, length: 1 },Snip { offset: 175, length: 1 }),
953 SourceEvent::Char('r').localize(Snip { offset: 176, length: 1 },Snip { offset: 176, length: 1 }),
954 SourceEvent::Char('e').localize(Snip { offset: 177, length: 1 },Snip { offset: 177, length: 1 }),
955 SourceEvent::Char('f').localize(Snip { offset: 178, length: 1 },Snip { offset: 178, length: 1 }),
956 SourceEvent::Char('=').localize(Snip { offset: 179, length: 1 },Snip { offset: 179, length: 1 }),
957 SourceEvent::Char('"').localize(Snip { offset: 180, length: 1 },Snip { offset: 180, length: 1 }),
958 SourceEvent::Char('a').localize(Snip { offset: 181, length: 1 },Snip { offset: 181, length: 1 }),
959 SourceEvent::Char('p').localize(Snip { offset: 182, length: 1 },Snip { offset: 182, length: 1 }),
960 SourceEvent::Char('i').localize(Snip { offset: 183, length: 1 },Snip { offset: 183, length: 1 }),
961 SourceEvent::Char('s').localize(Snip { offset: 184, length: 1 },Snip { offset: 184, length: 1 }),
962 SourceEvent::Char('-').localize(Snip { offset: 185, length: 1 },Snip { offset: 185, length: 1 }),
963 SourceEvent::Char('i').localize(Snip { offset: 186, length: 1 },Snip { offset: 186, length: 1 }),
964 SourceEvent::Char('n').localize(Snip { offset: 187, length: 1 },Snip { offset: 187, length: 1 }),
965 SourceEvent::Char('-').localize(Snip { offset: 188, length: 1 },Snip { offset: 188, length: 1 }),
966 SourceEvent::Char('h').localize(Snip { offset: 189, length: 1 },Snip { offset: 189, length: 1 }),
967 SourceEvent::Char('t').localize(Snip { offset: 190, length: 1 },Snip { offset: 190, length: 1 }),
968 SourceEvent::Char('m').localize(Snip { offset: 191, length: 1 },Snip { offset: 191, length: 1 }),
969 SourceEvent::Char('l').localize(Snip { offset: 192, length: 1 },Snip { offset: 192, length: 1 }),
970 SourceEvent::Char('-').localize(Snip { offset: 193, length: 1 },Snip { offset: 193, length: 1 }),
971 SourceEvent::Char('d').localize(Snip { offset: 194, length: 1 },Snip { offset: 194, length: 1 }),
972 SourceEvent::Char('o').localize(Snip { offset: 195, length: 1 },Snip { offset: 195, length: 1 }),
973 SourceEvent::Char('c').localize(Snip { offset: 196, length: 1 },Snip { offset: 196, length: 1 }),
974 SourceEvent::Char('u').localize(Snip { offset: 197, length: 1 },Snip { offset: 197, length: 1 }),
975 SourceEvent::Char('m').localize(Snip { offset: 198, length: 1 },Snip { offset: 198, length: 1 }),
976 SourceEvent::Char('e').localize(Snip { offset: 199, length: 1 },Snip { offset: 199, length: 1 }),
977 SourceEvent::Char('n').localize(Snip { offset: 200, length: 1 },Snip { offset: 200, length: 1 }),
978 SourceEvent::Char('t').localize(Snip { offset: 201, length: 1 },Snip { offset: 201, length: 1 }),
979 SourceEvent::Char('s').localize(Snip { offset: 202, length: 1 },Snip { offset: 202, length: 1 }),
980 SourceEvent::Char('.').localize(Snip { offset: 203, length: 1 },Snip { offset: 203, length: 1 }),
981 SourceEvent::Char('h').localize(Snip { offset: 204, length: 1 },Snip { offset: 204, length: 1 }),
982 SourceEvent::Char('t').localize(Snip { offset: 205, length: 1 },Snip { offset: 205, length: 1 }),
983 SourceEvent::Char('m').localize(Snip { offset: 206, length: 1 },Snip { offset: 206, length: 1 }),
984 SourceEvent::Char('l').localize(Snip { offset: 207, length: 1 },Snip { offset: 207, length: 1 }),
985 SourceEvent::Char('#').localize(Snip { offset: 208, length: 1 },Snip { offset: 208, length: 1 }),
986 SourceEvent::Char('d').localize(Snip { offset: 209, length: 1 },Snip { offset: 209, length: 1 }),
987 SourceEvent::Char('o').localize(Snip { offset: 210, length: 1 },Snip { offset: 210, length: 1 }),
988 SourceEvent::Char('m').localize(Snip { offset: 211, length: 1 },Snip { offset: 211, length: 1 }),
989 SourceEvent::Char('-').localize(Snip { offset: 212, length: 1 },Snip { offset: 212, length: 1 }),
990 SourceEvent::Char('d').localize(Snip { offset: 213, length: 1 },Snip { offset: 213, length: 1 }),
991 SourceEvent::Char('o').localize(Snip { offset: 214, length: 1 },Snip { offset: 214, length: 1 }),
992 SourceEvent::Char('c').localize(Snip { offset: 215, length: 1 },Snip { offset: 215, length: 1 }),
993 SourceEvent::Char('u').localize(Snip { offset: 216, length: 1 },Snip { offset: 216, length: 1 }),
994 SourceEvent::Char('m').localize(Snip { offset: 217, length: 1 },Snip { offset: 217, length: 1 }),
995 SourceEvent::Char('e').localize(Snip { offset: 218, length: 1 },Snip { offset: 218, length: 1 }),
996 SourceEvent::Char('n').localize(Snip { offset: 219, length: 1 },Snip { offset: 219, length: 1 }),
997 SourceEvent::Char('t').localize(Snip { offset: 220, length: 1 },Snip { offset: 220, length: 1 }),
998 SourceEvent::Char('-').localize(Snip { offset: 221, length: 1 },Snip { offset: 221, length: 1 }),
999 SourceEvent::Char('w').localize(Snip { offset: 222, length: 1 },Snip { offset: 222, length: 1 }),
1000 SourceEvent::Char('r').localize(Snip { offset: 223, length: 1 },Snip { offset: 223, length: 1 }),
1001 SourceEvent::Char('i').localize(Snip { offset: 224, length: 1 },Snip { offset: 224, length: 1 }),
1002 SourceEvent::Char('t').localize(Snip { offset: 225, length: 1 },Snip { offset: 225, length: 1 }),
1003 SourceEvent::Char('e').localize(Snip { offset: 226, length: 1 },Snip { offset: 226, length: 1 }),
1004 SourceEvent::Char('"').localize(Snip { offset: 227, length: 1 },Snip { offset: 227, length: 1 }),
1005 SourceEvent::Char('>').localize(Snip { offset: 228, length: 1 },Snip { offset: 228, length: 1 }),
1006 ],
1007 }).localize(Snip { offset: 172, length: 57 },Snip { offset: 172, length: 57 }),
1008 ParserEvent::Char('d').localize(Snip { offset: 229, length: 1 },Snip { offset: 229, length: 1 }),
1009 ParserEvent::Char('o').localize(Snip { offset: 230, length: 1 },Snip { offset: 230, length: 1 }),
1010 ParserEvent::Char('c').localize(Snip { offset: 231, length: 1 },Snip { offset: 231, length: 1 }),
1011 ParserEvent::Char('u').localize(Snip { offset: 232, length: 1 },Snip { offset: 232, length: 1 }),
1012 ParserEvent::Char('m').localize(Snip { offset: 233, length: 1 },Snip { offset: 233, length: 1 }),
1013 ParserEvent::Char('e').localize(Snip { offset: 234, length: 1 },Snip { offset: 234, length: 1 }),
1014 ParserEvent::Char('n').localize(Snip { offset: 235, length: 1 },Snip { offset: 235, length: 1 }),
1015 ParserEvent::Char('t').localize(Snip { offset: 236, length: 1 },Snip { offset: 236, length: 1 }),
1016 ParserEvent::Char('.').localize(Snip { offset: 237, length: 1 },Snip { offset: 237, length: 1 }),
1017 ParserEvent::Char('w').localize(Snip { offset: 238, length: 1 },Snip { offset: 238, length: 1 }),
1018 ParserEvent::Char('r').localize(Snip { offset: 239, length: 1 },Snip { offset: 239, length: 1 }),
1019 ParserEvent::Char('i').localize(Snip { offset: 240, length: 1 },Snip { offset: 240, length: 1 }),
1020 ParserEvent::Char('t').localize(Snip { offset: 241, length: 1 },Snip { offset: 241, length: 1 }),
1021 ParserEvent::Char('e').localize(Snip { offset: 242, length: 1 },Snip { offset: 242, length: 1 }),
1022 ParserEvent::Char('(').localize(Snip { offset: 243, length: 1 },Snip { offset: 243, length: 1 }),
1023 ParserEvent::Char(')').localize(Snip { offset: 244, length: 1 },Snip { offset: 244, length: 1 }),
1024 ParserEvent::Parsed(Tag {
1025 name: TagName::A, closing: Closing::Close, attributes: OptVec::None,
1026 begin: ().localize(Snip { offset: 245, length: 1 },Snip { offset: 245, length: 1 }),
1027 end: ().localize(Snip { offset: 248, length: 1 },Snip { offset: 248, length: 1 }),
1028 raw: vec![
1029 SourceEvent::Char('<').localize(Snip { offset: 245, length: 1 },Snip { offset: 245, length: 1 }),
1030 SourceEvent::Char('/').localize(Snip { offset: 246, length: 1 },Snip { offset: 246, length: 1 }),
1031 SourceEvent::Char('a').localize(Snip { offset: 247, length: 1 },Snip { offset: 247, length: 1 }),
1032 SourceEvent::Char('>').localize(Snip { offset: 248, length: 1 },Snip { offset: 248, length: 1 }),
1033 ],
1034 }).localize(Snip { offset: 245, length: 4 },Snip { offset: 245, length: 4 }),
1035 ParserEvent::Parsed(Tag {
1036 name: TagName::Code, closing: Closing::Close, attributes: OptVec::None,
1037 begin: ().localize(Snip { offset: 249, length: 1 },Snip { offset: 249, length: 1 }),
1038 end: ().localize(Snip { offset: 255, length: 1 },Snip { offset: 255, length: 1 }),
1039 raw: vec![
1040 SourceEvent::Char('<').localize(Snip { offset: 249, length: 1 },Snip { offset: 249, length: 1 }),
1041 SourceEvent::Char('/').localize(Snip { offset: 250, length: 1 },Snip { offset: 250, length: 1 }),
1042 SourceEvent::Char('c').localize(Snip { offset: 251, length: 1 },Snip { offset: 251, length: 1 }),
1043 SourceEvent::Char('o').localize(Snip { offset: 252, length: 1 },Snip { offset: 252, length: 1 }),
1044 SourceEvent::Char('d').localize(Snip { offset: 253, length: 1 },Snip { offset: 253, length: 1 }),
1045 SourceEvent::Char('e').localize(Snip { offset: 254, length: 1 },Snip { offset: 254, length: 1 }),
1046 SourceEvent::Char('>').localize(Snip { offset: 255, length: 1 },Snip { offset: 255, length: 1 }),
1047 ],
1048 }).localize(Snip { offset: 249, length: 7 },Snip { offset: 249, length: 7 }),
1049 ParserEvent::Char(' ').localize(Snip { offset: 256, length: 1 },Snip { offset: 256, length: 1 }),
1050 ParserEvent::Char('A').localize(Snip { offset: 257, length: 1 },Snip { offset: 257, length: 1 }),
1051 ParserEvent::Char('P').localize(Snip { offset: 258, length: 1 },Snip { offset: 258, length: 1 }),
1052 ParserEvent::Char('I').localize(Snip { offset: 259, length: 1 },Snip { offset: 259, length: 1 }),
1053 ParserEvent::Char('.').localize(Snip { offset: 260, length: 1 },Snip { offset: 260, length: 1 }),
1054 ParserEvent::Parsed(Tag {
1055 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1056 begin: ().localize(Snip { offset: 261, length: 1 },Snip { offset: 261, length: 1 }),
1057 end: ().localize(Snip { offset: 264, length: 1 },Snip { offset: 264, length: 1 }),
1058 raw: vec![
1059 SourceEvent::Char('<').localize(Snip { offset: 261, length: 1 },Snip { offset: 261, length: 1 }),
1060 SourceEvent::Char('/').localize(Snip { offset: 262, length: 1 },Snip { offset: 262, length: 1 }),
1061 SourceEvent::Char('p').localize(Snip { offset: 263, length: 1 },Snip { offset: 263, length: 1 }),
1062 SourceEvent::Char('>').localize(Snip { offset: 264, length: 1 },Snip { offset: 264, length: 1 }),
1063 ],
1064 }).localize(Snip { offset: 261, length: 4 },Snip { offset: 261, length: 4 }),
1065 ParserEvent::Char('\n').localize(Snip { offset: 265, length: 1 },Snip { offset: 265, length: 1 }),
1066 ParserEvent::Char(' ').localize(Snip { offset: 266, length: 1 },Snip { offset: 266, length: 1 }),
1067 ParserEvent::Char(' ').localize(Snip { offset: 267, length: 1 },Snip { offset: 267, length: 1 }),
1068 ParserEvent::Parsed(Tag {
1069 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
1070 begin: ().localize(Snip { offset: 268, length: 1 },Snip { offset: 268, length: 1 }),
1071 end: ().localize(Snip { offset: 270, length: 1 },Snip { offset: 270, length: 1 }),
1072 raw: vec![
1073 SourceEvent::Char('<').localize(Snip { offset: 268, length: 1 },Snip { offset: 268, length: 1 }),
1074 SourceEvent::Char('p').localize(Snip { offset: 269, length: 1 },Snip { offset: 269, length: 1 }),
1075 SourceEvent::Char('>').localize(Snip { offset: 270, length: 1 },Snip { offset: 270, length: 1 }),
1076 ],
1077 }).localize(Snip { offset: 268, length: 3 },Snip { offset: 268, length: 3 }),
1078 ParserEvent::Parsed(Tag {
1079 name: TagName::Img, closing: Closing::Void,
1080 attributes: OptVec::One(("alt".to_string(), None)),
1081 begin: ().localize(Snip { offset: 271, length: 1 },Snip { offset: 271, length: 1 }),
1082 end: ().localize(Snip { offset: 377, length: 1 },Snip { offset: 377, length: 1 }),
1083 raw: vec![
1084 SourceEvent::Char('<').localize(Snip { offset: 271, length: 1 },Snip { offset: 271, length: 1 }),
1085 SourceEvent::Char('i').localize(Snip { offset: 272, length: 1 },Snip { offset: 272, length: 1 }),
1086 SourceEvent::Char('m').localize(Snip { offset: 273, length: 1 },Snip { offset: 273, length: 1 }),
1087 SourceEvent::Char('g').localize(Snip { offset: 274, length: 1 },Snip { offset: 274, length: 1 }),
1088 SourceEvent::Char(' ').localize(Snip { offset: 275, length: 1 },Snip { offset: 275, length: 1 }),
1089 SourceEvent::Char('a').localize(Snip { offset: 276, length: 1 },Snip { offset: 276, length: 1 }),
1090 SourceEvent::Char('l').localize(Snip { offset: 277, length: 1 },Snip { offset: 277, length: 1 }),
1091 SourceEvent::Char('t').localize(Snip { offset: 278, length: 1 },Snip { offset: 278, length: 1 }),
1092 SourceEvent::Char('=').localize(Snip { offset: 279, length: 1 },Snip { offset: 279, length: 1 }),
1093 SourceEvent::Char('"').localize(Snip { offset: 280, length: 1 },Snip { offset: 280, length: 1 }),
1094 SourceEvent::Char('"').localize(Snip { offset: 281, length: 1 },Snip { offset: 281, length: 1 }),
1095 SourceEvent::Char(' ').localize(Snip { offset: 282, length: 1 },Snip { offset: 282, length: 1 }),
1096 SourceEvent::Char('h').localize(Snip { offset: 283, length: 1 },Snip { offset: 283, length: 1 }),
1097 SourceEvent::Char('e').localize(Snip { offset: 284, length: 1 },Snip { offset: 284, length: 1 }),
1098 SourceEvent::Char('i').localize(Snip { offset: 285, length: 1 },Snip { offset: 285, length: 1 }),
1099 SourceEvent::Char('g').localize(Snip { offset: 286, length: 1 },Snip { offset: 286, length: 1 }),
1100 SourceEvent::Char('h').localize(Snip { offset: 287, length: 1 },Snip { offset: 287, length: 1 }),
1101 SourceEvent::Char('t').localize(Snip { offset: 288, length: 1 },Snip { offset: 288, length: 1 }),
1102 SourceEvent::Char('=').localize(Snip { offset: 289, length: 1 },Snip { offset: 289, length: 1 }),
1103 SourceEvent::Char('"').localize(Snip { offset: 290, length: 1 },Snip { offset: 290, length: 1 }),
1104 SourceEvent::Char('5').localize(Snip { offset: 291, length: 1 },Snip { offset: 291, length: 1 }),
1105 SourceEvent::Char('5').localize(Snip { offset: 292, length: 1 },Snip { offset: 292, length: 1 }),
1106 SourceEvent::Char('4').localize(Snip { offset: 293, length: 1 },Snip { offset: 293, length: 1 }),
1107 SourceEvent::Char('"').localize(Snip { offset: 294, length: 1 },Snip { offset: 294, length: 1 }),
1108 SourceEvent::Char(' ').localize(Snip { offset: 295, length: 1 },Snip { offset: 295, length: 1 }),
1109 SourceEvent::Char('s').localize(Snip { offset: 296, length: 1 },Snip { offset: 296, length: 1 }),
1110 SourceEvent::Char('r').localize(Snip { offset: 297, length: 1 },Snip { offset: 297, length: 1 }),
1111 SourceEvent::Char('c').localize(Snip { offset: 298, length: 1 },Snip { offset: 298, length: 1 }),
1112 SourceEvent::Char('=').localize(Snip { offset: 299, length: 1 },Snip { offset: 299, length: 1 }),
1113 SourceEvent::Char('"').localize(Snip { offset: 300, length: 1 },Snip { offset: 300, length: 1 }),
1114 SourceEvent::Char('h').localize(Snip { offset: 301, length: 1 },Snip { offset: 301, length: 1 }),
1115 SourceEvent::Char('t').localize(Snip { offset: 302, length: 1 },Snip { offset: 302, length: 1 }),
1116 SourceEvent::Char('t').localize(Snip { offset: 303, length: 1 },Snip { offset: 303, length: 1 }),
1117 SourceEvent::Char('p').localize(Snip { offset: 304, length: 1 },Snip { offset: 304, length: 1 }),
1118 SourceEvent::Char('s').localize(Snip { offset: 305, length: 1 },Snip { offset: 305, length: 1 }),
1119 SourceEvent::Char(':').localize(Snip { offset: 306, length: 1 },Snip { offset: 306, length: 1 }),
1120 SourceEvent::Char('/').localize(Snip { offset: 307, length: 1 },Snip { offset: 307, length: 1 }),
1121 SourceEvent::Char('/').localize(Snip { offset: 308, length: 1 },Snip { offset: 308, length: 1 }),
1122 SourceEvent::Char('d').localize(Snip { offset: 309, length: 1 },Snip { offset: 309, length: 1 }),
1123 SourceEvent::Char('e').localize(Snip { offset: 310, length: 1 },Snip { offset: 310, length: 1 }),
1124 SourceEvent::Char('v').localize(Snip { offset: 311, length: 1 },Snip { offset: 311, length: 1 }),
1125 SourceEvent::Char('.').localize(Snip { offset: 312, length: 1 },Snip { offset: 312, length: 1 }),
1126 SourceEvent::Char('w').localize(Snip { offset: 313, length: 1 },Snip { offset: 313, length: 1 }),
1127 SourceEvent::Char('3').localize(Snip { offset: 314, length: 1 },Snip { offset: 314, length: 1 }),
1128 SourceEvent::Char('.').localize(Snip { offset: 315, length: 1 },Snip { offset: 315, length: 1 }),
1129 SourceEvent::Char('o').localize(Snip { offset: 316, length: 1 },Snip { offset: 316, length: 1 }),
1130 SourceEvent::Char('r').localize(Snip { offset: 317, length: 1 },Snip { offset: 317, length: 1 }),
1131 SourceEvent::Char('g').localize(Snip { offset: 318, length: 1 },Snip { offset: 318, length: 1 }),
1132 SourceEvent::Char('/').localize(Snip { offset: 319, length: 1 },Snip { offset: 319, length: 1 }),
1133 SourceEvent::Char('h').localize(Snip { offset: 320, length: 1 },Snip { offset: 320, length: 1 }),
1134 SourceEvent::Char('t').localize(Snip { offset: 321, length: 1 },Snip { offset: 321, length: 1 }),
1135 SourceEvent::Char('m').localize(Snip { offset: 322, length: 1 },Snip { offset: 322, length: 1 }),
1136 SourceEvent::Char('l').localize(Snip { offset: 323, length: 1 },Snip { offset: 323, length: 1 }),
1137 SourceEvent::Char('5').localize(Snip { offset: 324, length: 1 },Snip { offset: 324, length: 1 }),
1138 SourceEvent::Char('/').localize(Snip { offset: 325, length: 1 },Snip { offset: 325, length: 1 }),
1139 SourceEvent::Char('s').localize(Snip { offset: 326, length: 1 },Snip { offset: 326, length: 1 }),
1140 SourceEvent::Char('p').localize(Snip { offset: 327, length: 1 },Snip { offset: 327, length: 1 }),
1141 SourceEvent::Char('e').localize(Snip { offset: 328, length: 1 },Snip { offset: 328, length: 1 }),
1142 SourceEvent::Char('c').localize(Snip { offset: 329, length: 1 },Snip { offset: 329, length: 1 }),
1143 SourceEvent::Char('/').localize(Snip { offset: 330, length: 1 },Snip { offset: 330, length: 1 }),
1144 SourceEvent::Char('i').localize(Snip { offset: 331, length: 1 },Snip { offset: 331, length: 1 }),
1145 SourceEvent::Char('m').localize(Snip { offset: 332, length: 1 },Snip { offset: 332, length: 1 }),
1146 SourceEvent::Char('a').localize(Snip { offset: 333, length: 1 },Snip { offset: 333, length: 1 }),
1147 SourceEvent::Char('g').localize(Snip { offset: 334, length: 1 },Snip { offset: 334, length: 1 }),
1148 SourceEvent::Char('e').localize(Snip { offset: 335, length: 1 },Snip { offset: 335, length: 1 }),
1149 SourceEvent::Char('s').localize(Snip { offset: 336, length: 1 },Snip { offset: 336, length: 1 }),
1150 SourceEvent::Char('/').localize(Snip { offset: 337, length: 1 },Snip { offset: 337, length: 1 }),
1151 SourceEvent::Char('p').localize(Snip { offset: 338, length: 1 },Snip { offset: 338, length: 1 }),
1152 SourceEvent::Char('a').localize(Snip { offset: 339, length: 1 },Snip { offset: 339, length: 1 }),
1153 SourceEvent::Char('r').localize(Snip { offset: 340, length: 1 },Snip { offset: 340, length: 1 }),
1154 SourceEvent::Char('s').localize(Snip { offset: 341, length: 1 },Snip { offset: 341, length: 1 }),
1155 SourceEvent::Char('i').localize(Snip { offset: 342, length: 1 },Snip { offset: 342, length: 1 }),
1156 SourceEvent::Char('n').localize(Snip { offset: 343, length: 1 },Snip { offset: 343, length: 1 }),
1157 SourceEvent::Char('g').localize(Snip { offset: 344, length: 1 },Snip { offset: 344, length: 1 }),
1158 SourceEvent::Char('-').localize(Snip { offset: 345, length: 1 },Snip { offset: 345, length: 1 }),
1159 SourceEvent::Char('m').localize(Snip { offset: 346, length: 1 },Snip { offset: 346, length: 1 }),
1160 SourceEvent::Char('o').localize(Snip { offset: 347, length: 1 },Snip { offset: 347, length: 1 }),
1161 SourceEvent::Char('d').localize(Snip { offset: 348, length: 1 },Snip { offset: 348, length: 1 }),
1162 SourceEvent::Char('e').localize(Snip { offset: 349, length: 1 },Snip { offset: 349, length: 1 }),
1163 SourceEvent::Char('l').localize(Snip { offset: 350, length: 1 },Snip { offset: 350, length: 1 }),
1164 SourceEvent::Char('-').localize(Snip { offset: 351, length: 1 },Snip { offset: 351, length: 1 }),
1165 SourceEvent::Char('o').localize(Snip { offset: 352, length: 1 },Snip { offset: 352, length: 1 }),
1166 SourceEvent::Char('v').localize(Snip { offset: 353, length: 1 },Snip { offset: 353, length: 1 }),
1167 SourceEvent::Char('e').localize(Snip { offset: 354, length: 1 },Snip { offset: 354, length: 1 }),
1168 SourceEvent::Char('r').localize(Snip { offset: 355, length: 1 },Snip { offset: 355, length: 1 }),
1169 SourceEvent::Char('v').localize(Snip { offset: 356, length: 1 },Snip { offset: 356, length: 1 }),
1170 SourceEvent::Char('i').localize(Snip { offset: 357, length: 1 },Snip { offset: 357, length: 1 }),
1171 SourceEvent::Char('e').localize(Snip { offset: 358, length: 1 },Snip { offset: 358, length: 1 }),
1172 SourceEvent::Char('w').localize(Snip { offset: 359, length: 1 },Snip { offset: 359, length: 1 }),
1173 SourceEvent::Char('.').localize(Snip { offset: 360, length: 1 },Snip { offset: 360, length: 1 }),
1174 SourceEvent::Char('p').localize(Snip { offset: 361, length: 1 },Snip { offset: 361, length: 1 }),
1175 SourceEvent::Char('n').localize(Snip { offset: 362, length: 1 },Snip { offset: 362, length: 1 }),
1176 SourceEvent::Char('g').localize(Snip { offset: 363, length: 1 },Snip { offset: 363, length: 1 }),
1177 SourceEvent::Char('"').localize(Snip { offset: 364, length: 1 },Snip { offset: 364, length: 1 }),
1178 SourceEvent::Char(' ').localize(Snip { offset: 365, length: 1 },Snip { offset: 365, length: 1 }),
1179 SourceEvent::Char('w').localize(Snip { offset: 366, length: 1 },Snip { offset: 366, length: 1 }),
1180 SourceEvent::Char('i').localize(Snip { offset: 367, length: 1 },Snip { offset: 367, length: 1 }),
1181 SourceEvent::Char('d').localize(Snip { offset: 368, length: 1 },Snip { offset: 368, length: 1 }),
1182 SourceEvent::Char('t').localize(Snip { offset: 369, length: 1 },Snip { offset: 369, length: 1 }),
1183 SourceEvent::Char('h').localize(Snip { offset: 370, length: 1 },Snip { offset: 370, length: 1 }),
1184 SourceEvent::Char('=').localize(Snip { offset: 371, length: 1 },Snip { offset: 371, length: 1 }),
1185 SourceEvent::Char('"').localize(Snip { offset: 372, length: 1 },Snip { offset: 372, length: 1 }),
1186 SourceEvent::Char('4').localize(Snip { offset: 373, length: 1 },Snip { offset: 373, length: 1 }),
1187 SourceEvent::Char('2').localize(Snip { offset: 374, length: 1 },Snip { offset: 374, length: 1 }),
1188 SourceEvent::Char('7').localize(Snip { offset: 375, length: 1 },Snip { offset: 375, length: 1 }),
1189 SourceEvent::Char('"').localize(Snip { offset: 376, length: 1 },Snip { offset: 376, length: 1 }),
1190 SourceEvent::Char('>').localize(Snip { offset: 377, length: 1 },Snip { offset: 377, length: 1 }),
1191 ],
1192 }).localize(Snip { offset: 271, length: 107 },Snip { offset: 271, length: 107 }),
1193 ParserEvent::Parsed(Tag {
1194 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1195 begin: ().localize(Snip { offset: 378, length: 1 },Snip { offset: 378, length: 1 }),
1196 end: ().localize(Snip { offset: 381, length: 1 },Snip { offset: 381, length: 1 }),
1197 raw: vec![
1198 SourceEvent::Char('<').localize(Snip { offset: 378, length: 1 },Snip { offset: 378, length: 1 }),
1199 SourceEvent::Char('/').localize(Snip { offset: 379, length: 1 },Snip { offset: 379, length: 1 }),
1200 SourceEvent::Char('p').localize(Snip { offset: 380, length: 1 },Snip { offset: 380, length: 1 }),
1201 SourceEvent::Char('>').localize(Snip { offset: 381, length: 1 },Snip { offset: 381, length: 1 }),
1202 ],
1203 }).localize(Snip { offset: 378, length: 4 },Snip { offset: 378, length: 4 }),
1204 ParserEvent::Char('\n').localize(Snip { offset: 382, length: 1 },Snip { offset: 382, length: 1 }),
1205 ParserEvent::Char(' ').localize(Snip { offset: 383, length: 1 },Snip { offset: 383, length: 1 }),
1206 ParserEvent::Char(' ').localize(Snip { offset: 384, length: 1 },Snip { offset: 384, length: 1 }),
1207 ParserEvent::Parsed(Tag {
1208 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
1209 begin: ().localize(Snip { offset: 385, length: 1 },Snip { offset: 385, length: 1 }),
1210 end: ().localize(Snip { offset: 406, length: 1 },Snip { offset: 406, length: 1 }),
1211 raw: vec![
1212 SourceEvent::Char('<').localize(Snip { offset: 385, length: 1 },Snip { offset: 385, length: 1 }),
1213 SourceEvent::Char('p').localize(Snip { offset: 386, length: 1 },Snip { offset: 386, length: 1 }),
1214 SourceEvent::Char(' ').localize(Snip { offset: 387, length: 1 },Snip { offset: 387, length: 1 }),
1215 SourceEvent::Char('i').localize(Snip { offset: 388, length: 1 },Snip { offset: 388, length: 1 }),
1216 SourceEvent::Char('d').localize(Snip { offset: 389, length: 1 },Snip { offset: 389, length: 1 }),
1217 SourceEvent::Char('=').localize(Snip { offset: 390, length: 1 },Snip { offset: 390, length: 1 }),
1218 SourceEvent::Char('"').localize(Snip { offset: 391, length: 1 },Snip { offset: 391, length: 1 }),
1219 SourceEvent::Char('n').localize(Snip { offset: 392, length: 1 },Snip { offset: 392, length: 1 }),
1220 SourceEvent::Char('e').localize(Snip { offset: 393, length: 1 },Snip { offset: 393, length: 1 }),
1221 SourceEvent::Char('s').localize(Snip { offset: 394, length: 1 },Snip { offset: 394, length: 1 }),
1222 SourceEvent::Char('t').localize(Snip { offset: 395, length: 1 },Snip { offset: 395, length: 1 }),
1223 SourceEvent::Char('e').localize(Snip { offset: 396, length: 1 },Snip { offset: 396, length: 1 }),
1224 SourceEvent::Char('d').localize(Snip { offset: 397, length: 1 },Snip { offset: 397, length: 1 }),
1225 SourceEvent::Char('P').localize(Snip { offset: 398, length: 1 },Snip { offset: 398, length: 1 }),
1226 SourceEvent::Char('a').localize(Snip { offset: 399, length: 1 },Snip { offset: 399, length: 1 }),
1227 SourceEvent::Char('r').localize(Snip { offset: 400, length: 1 },Snip { offset: 400, length: 1 }),
1228 SourceEvent::Char('s').localize(Snip { offset: 401, length: 1 },Snip { offset: 401, length: 1 }),
1229 SourceEvent::Char('i').localize(Snip { offset: 402, length: 1 },Snip { offset: 402, length: 1 }),
1230 SourceEvent::Char('n').localize(Snip { offset: 403, length: 1 },Snip { offset: 403, length: 1 }),
1231 SourceEvent::Char('g').localize(Snip { offset: 404, length: 1 },Snip { offset: 404, length: 1 }),
1232 SourceEvent::Char('"').localize(Snip { offset: 405, length: 1 },Snip { offset: 405, length: 1 }),
1233 SourceEvent::Char('>').localize(Snip { offset: 406, length: 1 },Snip { offset: 406, length: 1 }),
1234 ],
1235 }).localize(Snip { offset: 385, length: 22 },Snip { offset: 385, length: 22 }),
1236 ParserEvent::Char('T').localize(Snip { offset: 407, length: 1 },Snip { offset: 407, length: 1 }),
1237 ParserEvent::Char('h').localize(Snip { offset: 408, length: 1 },Snip { offset: 408, length: 1 }),
1238 ParserEvent::Char('e').localize(Snip { offset: 409, length: 1 },Snip { offset: 409, length: 1 }),
1239 ParserEvent::Char('r').localize(Snip { offset: 410, length: 1 },Snip { offset: 410, length: 1 }),
1240 ParserEvent::Char('e').localize(Snip { offset: 411, length: 1 },Snip { offset: 411, length: 1 }),
1241 ParserEvent::Char(' ').localize(Snip { offset: 412, length: 1 },Snip { offset: 412, length: 1 }),
1242 ParserEvent::Char('i').localize(Snip { offset: 413, length: 1 },Snip { offset: 413, length: 1 }),
1243 ParserEvent::Char('s').localize(Snip { offset: 414, length: 1 },Snip { offset: 414, length: 1 }),
1244 ParserEvent::Char(' ').localize(Snip { offset: 415, length: 1 },Snip { offset: 415, length: 1 }),
1245 ParserEvent::Char('o').localize(Snip { offset: 416, length: 1 },Snip { offset: 416, length: 1 }),
1246 ParserEvent::Char('n').localize(Snip { offset: 417, length: 1 },Snip { offset: 417, length: 1 }),
1247 ParserEvent::Char('l').localize(Snip { offset: 418, length: 1 },Snip { offset: 418, length: 1 }),
1248 ParserEvent::Char('y').localize(Snip { offset: 419, length: 1 },Snip { offset: 419, length: 1 }),
1249 ParserEvent::Char(' ').localize(Snip { offset: 420, length: 1 },Snip { offset: 420, length: 1 }),
1250 ParserEvent::Char('o').localize(Snip { offset: 421, length: 1 },Snip { offset: 421, length: 1 }),
1251 ParserEvent::Char('n').localize(Snip { offset: 422, length: 1 },Snip { offset: 422, length: 1 }),
1252 ParserEvent::Char('e').localize(Snip { offset: 423, length: 1 },Snip { offset: 423, length: 1 }),
1253 ParserEvent::Char(' ').localize(Snip { offset: 424, length: 1 },Snip { offset: 424, length: 1 }),
1254 ParserEvent::Char('s').localize(Snip { offset: 425, length: 1 },Snip { offset: 425, length: 1 }),
1255 ParserEvent::Char('e').localize(Snip { offset: 426, length: 1 },Snip { offset: 426, length: 1 }),
1256 ParserEvent::Char('t').localize(Snip { offset: 427, length: 1 },Snip { offset: 427, length: 1 }),
1257 ParserEvent::Char(' ').localize(Snip { offset: 428, length: 1 },Snip { offset: 428, length: 1 }),
1258 ParserEvent::Char('o').localize(Snip { offset: 429, length: 1 },Snip { offset: 429, length: 1 }),
1259 ParserEvent::Char('f').localize(Snip { offset: 430, length: 1 },Snip { offset: 430, length: 1 }),
1260 ParserEvent::Char(' ').localize(Snip { offset: 431, length: 1 },Snip { offset: 431, length: 1 }),
1261 ParserEvent::Char('s').localize(Snip { offset: 432, length: 1 },Snip { offset: 432, length: 1 }),
1262 ParserEvent::Char('t').localize(Snip { offset: 433, length: 1 },Snip { offset: 433, length: 1 }),
1263 ParserEvent::Char('a').localize(Snip { offset: 434, length: 1 },Snip { offset: 434, length: 1 }),
1264 ParserEvent::Char('t').localize(Snip { offset: 435, length: 1 },Snip { offset: 435, length: 1 }),
1265 ParserEvent::Char('e').localize(Snip { offset: 436, length: 1 },Snip { offset: 436, length: 1 }),
1266 ParserEvent::Char('s').localize(Snip { offset: 437, length: 1 },Snip { offset: 437, length: 1 }),
1267 ParserEvent::Char(' ').localize(Snip { offset: 438, length: 1 },Snip { offset: 438, length: 1 }),
1268 ParserEvent::Char('f').localize(Snip { offset: 439, length: 1 },Snip { offset: 439, length: 1 }),
1269 ParserEvent::Char('o').localize(Snip { offset: 440, length: 1 },Snip { offset: 440, length: 1 }),
1270 ParserEvent::Char('r').localize(Snip { offset: 441, length: 1 },Snip { offset: 441, length: 1 }),
1271 ParserEvent::Char(' ').localize(Snip { offset: 442, length: 1 },Snip { offset: 442, length: 1 }),
1272 ParserEvent::Char('t').localize(Snip { offset: 443, length: 1 },Snip { offset: 443, length: 1 }),
1273 ParserEvent::Char('h').localize(Snip { offset: 444, length: 1 },Snip { offset: 444, length: 1 }),
1274 ParserEvent::Char('e').localize(Snip { offset: 445, length: 1 },Snip { offset: 445, length: 1 }),
1275 ParserEvent::Char('\n').localize(Snip { offset: 446, length: 1 },Snip { offset: 446, length: 1 }),
1276 ParserEvent::Char(' ').localize(Snip { offset: 447, length: 1 },Snip { offset: 447, length: 1 }),
1277 ParserEvent::Char(' ').localize(Snip { offset: 448, length: 1 },Snip { offset: 448, length: 1 }),
1278 ParserEvent::Char('t').localize(Snip { offset: 449, length: 1 },Snip { offset: 449, length: 1 }),
1279 ParserEvent::Char('o').localize(Snip { offset: 450, length: 1 },Snip { offset: 450, length: 1 }),
1280 ParserEvent::Char('k').localize(Snip { offset: 451, length: 1 },Snip { offset: 451, length: 1 }),
1281 ParserEvent::Char('e').localize(Snip { offset: 452, length: 1 },Snip { offset: 452, length: 1 }),
1282 ParserEvent::Char('n').localize(Snip { offset: 453, length: 1 },Snip { offset: 453, length: 1 }),
1283 ParserEvent::Char('i').localize(Snip { offset: 454, length: 1 },Snip { offset: 454, length: 1 }),
1284 ParserEvent::Char('z').localize(Snip { offset: 455, length: 1 },Snip { offset: 455, length: 1 }),
1285 ParserEvent::Char('e').localize(Snip { offset: 456, length: 1 },Snip { offset: 456, length: 1 }),
1286 ParserEvent::Char('r').localize(Snip { offset: 457, length: 1 },Snip { offset: 457, length: 1 }),
1287 ParserEvent::Char(' ').localize(Snip { offset: 458, length: 1 },Snip { offset: 458, length: 1 }),
1288 ParserEvent::Char('s').localize(Snip { offset: 459, length: 1 },Snip { offset: 459, length: 1 }),
1289 ParserEvent::Char('t').localize(Snip { offset: 460, length: 1 },Snip { offset: 460, length: 1 }),
1290 ParserEvent::Char('a').localize(Snip { offset: 461, length: 1 },Snip { offset: 461, length: 1 }),
1291 ParserEvent::Char('g').localize(Snip { offset: 462, length: 1 },Snip { offset: 462, length: 1 }),
1292 ParserEvent::Char('e').localize(Snip { offset: 463, length: 1 },Snip { offset: 463, length: 1 }),
1293 ParserEvent::Char(' ').localize(Snip { offset: 464, length: 1 },Snip { offset: 464, length: 1 }),
1294 ParserEvent::Char('a').localize(Snip { offset: 465, length: 1 },Snip { offset: 465, length: 1 }),
1295 ParserEvent::Char('n').localize(Snip { offset: 466, length: 1 },Snip { offset: 466, length: 1 }),
1296 ParserEvent::Char('d').localize(Snip { offset: 467, length: 1 },Snip { offset: 467, length: 1 }),
1297 ParserEvent::Char(' ').localize(Snip { offset: 468, length: 1 },Snip { offset: 468, length: 1 }),
1298 ParserEvent::Char('t').localize(Snip { offset: 469, length: 1 },Snip { offset: 469, length: 1 }),
1299 ParserEvent::Char('h').localize(Snip { offset: 470, length: 1 },Snip { offset: 470, length: 1 }),
1300 ParserEvent::Char('e').localize(Snip { offset: 471, length: 1 },Snip { offset: 471, length: 1 }),
1301 ParserEvent::Char(' ').localize(Snip { offset: 472, length: 1 },Snip { offset: 472, length: 1 }),
1302 ParserEvent::Char('t').localize(Snip { offset: 473, length: 1 },Snip { offset: 473, length: 1 }),
1303 ParserEvent::Char('r').localize(Snip { offset: 474, length: 1 },Snip { offset: 474, length: 1 }),
1304 ParserEvent::Char('e').localize(Snip { offset: 475, length: 1 },Snip { offset: 475, length: 1 }),
1305 ParserEvent::Char('e').localize(Snip { offset: 476, length: 1 },Snip { offset: 476, length: 1 }),
1306 ParserEvent::Char(' ').localize(Snip { offset: 477, length: 1 },Snip { offset: 477, length: 1 }),
1307 ParserEvent::Char('c').localize(Snip { offset: 478, length: 1 },Snip { offset: 478, length: 1 }),
1308 ParserEvent::Char('o').localize(Snip { offset: 479, length: 1 },Snip { offset: 479, length: 1 }),
1309 ParserEvent::Char('n').localize(Snip { offset: 480, length: 1 },Snip { offset: 480, length: 1 }),
1310 ParserEvent::Char('s').localize(Snip { offset: 481, length: 1 },Snip { offset: 481, length: 1 }),
1311 ParserEvent::Char('t').localize(Snip { offset: 482, length: 1 },Snip { offset: 482, length: 1 }),
1312 ParserEvent::Char('r').localize(Snip { offset: 483, length: 1 },Snip { offset: 483, length: 1 }),
1313 ParserEvent::Char('u').localize(Snip { offset: 484, length: 1 },Snip { offset: 484, length: 1 }),
1314 ParserEvent::Char('c').localize(Snip { offset: 485, length: 1 },Snip { offset: 485, length: 1 }),
1315 ParserEvent::Char('t').localize(Snip { offset: 486, length: 1 },Snip { offset: 486, length: 1 }),
1316 ParserEvent::Char('i').localize(Snip { offset: 487, length: 1 },Snip { offset: 487, length: 1 }),
1317 ParserEvent::Char('o').localize(Snip { offset: 488, length: 1 },Snip { offset: 488, length: 1 }),
1318 ParserEvent::Char('n').localize(Snip { offset: 489, length: 1 },Snip { offset: 489, length: 1 }),
1319 ParserEvent::Char(' ').localize(Snip { offset: 490, length: 1 },Snip { offset: 490, length: 1 }),
1320 ParserEvent::Char('s').localize(Snip { offset: 491, length: 1 },Snip { offset: 491, length: 1 }),
1321 ParserEvent::Char('t').localize(Snip { offset: 492, length: 1 },Snip { offset: 492, length: 1 }),
1322 ParserEvent::Char('a').localize(Snip { offset: 493, length: 1 },Snip { offset: 493, length: 1 }),
1323 ParserEvent::Char('g').localize(Snip { offset: 494, length: 1 },Snip { offset: 494, length: 1 }),
1324 ParserEvent::Char('e').localize(Snip { offset: 495, length: 1 },Snip { offset: 495, length: 1 }),
1325 ParserEvent::Char('.').localize(Snip { offset: 496, length: 1 },Snip { offset: 496, length: 1 }),
1326 ParserEvent::Char('.').localize(Snip { offset: 497, length: 1 },Snip { offset: 497, length: 1 }),
1327 ParserEvent::Char('.').localize(Snip { offset: 498, length: 1 },Snip { offset: 498, length: 1 }),
1328 ParserEvent::Parsed(Tag {
1329 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1330 begin: ().localize(Snip { offset: 499, length: 1 },Snip { offset: 499, length: 1 }),
1331 end: ().localize(Snip { offset: 502, length: 1 },Snip { offset: 502, length: 1 }),
1332 raw: vec![
1333 SourceEvent::Char('<').localize(Snip { offset: 499, length: 1 },Snip { offset: 499, length: 1 }),
1334 SourceEvent::Char('/').localize(Snip { offset: 500, length: 1 },Snip { offset: 500, length: 1 }),
1335 SourceEvent::Char('p').localize(Snip { offset: 501, length: 1 },Snip { offset: 501, length: 1 }),
1336 SourceEvent::Char('>').localize(Snip { offset: 502, length: 1 },Snip { offset: 502, length: 1 }),
1337 ],
1338 }).localize(Snip { offset: 499, length: 4 },Snip { offset: 499, length: 4 }),
1339 ].into_iter();
1340
1341 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
1342 match res_iter.next() {
1352 Some(ev) => {
1353 println!("Parser: {:?}",local_event);
1354 println!("Result: {:?}",ev);
1355 assert_eq!(local_event,ev);
1356 },
1357 None => {
1358 panic!("parser has more events then test result");
1359 },
1360 }
1361 }
1362 }
1363
1364
1365 #[test]
1366 fn a_img_2() {
1367 let mut src = "
1368<p>In the common case, <a href=\"apis-in-html-documents.html#dynamic-markup-insertion\" title=\"dynamic markup
1369 insertion\">, e.g. using the <code title=\"dom-document-write\"><a href=\"apis-in-html-documents.html#dom-document-write\">document.write()</a></code> API.</p>
1370 <p><img alt=\"\" height=\"554\" src=\"https://dev.w3.org/html5/spec/images/parsing-model-overview.png\" width=\"427\"></p>
1371 <p id=\"nestedParsing\">There is only one set of states for the
1372 tokenizer stage and the tree construction stage...</p>".into_source().into_separator().merge_separators();
1373 let mut parser = Builder::new()
1374 .with_attribute(TagName::A,"href")
1375 .with_attribute(TagName::Img,"alt")
1376 .create();
1377
1378 let mut res_iter = [
1379 ParserEvent::Breaker(Breaker::Line).localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
1380 ParserEvent::Parsed(Tag {
1381 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
1382 begin: ().localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
1383 end: ().localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
1384 raw: vec![
1385 SourceEvent::Char('<').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
1386 SourceEvent::Char('p').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
1387 SourceEvent::Char('>').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
1388 ],
1389 }).localize(Snip { offset: 1, length: 3 },Snip { offset: 1, length: 3 }),
1390 ParserEvent::Char('I').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
1391 ParserEvent::Char('n').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
1392 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
1393 ParserEvent::Char('t').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
1394 ParserEvent::Char('h').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
1395 ParserEvent::Char('e').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
1396 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
1397 ParserEvent::Char('c').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
1398 ParserEvent::Char('o').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
1399 ParserEvent::Char('m').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
1400 ParserEvent::Char('m').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
1401 ParserEvent::Char('o').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
1402 ParserEvent::Char('n').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
1403 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
1404 ParserEvent::Char('c').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
1405 ParserEvent::Char('a').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
1406 ParserEvent::Char('s').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
1407 ParserEvent::Char('e').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
1408 ParserEvent::Char(',').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 1 }),
1409 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 23, length: 1 },Snip { offset: 23, length: 1 }),
1410 ParserEvent::Parsed(Tag {
1411 name: TagName::A, closing: Closing::Open,
1412 attributes: OptVec::One(("href".to_string(), Some(Snip{ offset: 9, length: 51 }))),
1413 begin: ().localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
1414 end: ().localize(Snip { offset: 121, length: 1 },Snip { offset: 121, length: 1 }),
1415 raw: vec![
1416 SourceEvent::Char('<').localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
1417 SourceEvent::Char('a').localize(Snip { offset: 25, length: 1 },Snip { offset: 25, length: 1 }),
1418 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 26, length: 1 },Snip { offset: 26, length: 1 }),
1419 SourceEvent::Char('h').localize(Snip { offset: 27, length: 1 },Snip { offset: 27, length: 1 }),
1420 SourceEvent::Char('r').localize(Snip { offset: 28, length: 1 },Snip { offset: 28, length: 1 }),
1421 SourceEvent::Char('e').localize(Snip { offset: 29, length: 1 },Snip { offset: 29, length: 1 }),
1422 SourceEvent::Char('f').localize(Snip { offset: 30, length: 1 },Snip { offset: 30, length: 1 }),
1423 SourceEvent::Char('=').localize(Snip { offset: 31, length: 1 },Snip { offset: 31, length: 1 }),
1424 SourceEvent::Char('"').localize(Snip { offset: 32, length: 1 },Snip { offset: 32, length: 1 }),
1425 SourceEvent::Char('a').localize(Snip { offset: 33, length: 1 },Snip { offset: 33, length: 1 }),
1426 SourceEvent::Char('p').localize(Snip { offset: 34, length: 1 },Snip { offset: 34, length: 1 }),
1427 SourceEvent::Char('i').localize(Snip { offset: 35, length: 1 },Snip { offset: 35, length: 1 }),
1428 SourceEvent::Char('s').localize(Snip { offset: 36, length: 1 },Snip { offset: 36, length: 1 }),
1429 SourceEvent::Char('-').localize(Snip { offset: 37, length: 1 },Snip { offset: 37, length: 1 }),
1430 SourceEvent::Char('i').localize(Snip { offset: 38, length: 1 },Snip { offset: 38, length: 1 }),
1431 SourceEvent::Char('n').localize(Snip { offset: 39, length: 1 },Snip { offset: 39, length: 1 }),
1432 SourceEvent::Char('-').localize(Snip { offset: 40, length: 1 },Snip { offset: 40, length: 1 }),
1433 SourceEvent::Char('h').localize(Snip { offset: 41, length: 1 },Snip { offset: 41, length: 1 }),
1434 SourceEvent::Char('t').localize(Snip { offset: 42, length: 1 },Snip { offset: 42, length: 1 }),
1435 SourceEvent::Char('m').localize(Snip { offset: 43, length: 1 },Snip { offset: 43, length: 1 }),
1436 SourceEvent::Char('l').localize(Snip { offset: 44, length: 1 },Snip { offset: 44, length: 1 }),
1437 SourceEvent::Char('-').localize(Snip { offset: 45, length: 1 },Snip { offset: 45, length: 1 }),
1438 SourceEvent::Char('d').localize(Snip { offset: 46, length: 1 },Snip { offset: 46, length: 1 }),
1439 SourceEvent::Char('o').localize(Snip { offset: 47, length: 1 },Snip { offset: 47, length: 1 }),
1440 SourceEvent::Char('c').localize(Snip { offset: 48, length: 1 },Snip { offset: 48, length: 1 }),
1441 SourceEvent::Char('u').localize(Snip { offset: 49, length: 1 },Snip { offset: 49, length: 1 }),
1442 SourceEvent::Char('m').localize(Snip { offset: 50, length: 1 },Snip { offset: 50, length: 1 }),
1443 SourceEvent::Char('e').localize(Snip { offset: 51, length: 1 },Snip { offset: 51, length: 1 }),
1444 SourceEvent::Char('n').localize(Snip { offset: 52, length: 1 },Snip { offset: 52, length: 1 }),
1445 SourceEvent::Char('t').localize(Snip { offset: 53, length: 1 },Snip { offset: 53, length: 1 }),
1446 SourceEvent::Char('s').localize(Snip { offset: 54, length: 1 },Snip { offset: 54, length: 1 }),
1447 SourceEvent::Char('.').localize(Snip { offset: 55, length: 1 },Snip { offset: 55, length: 1 }),
1448 SourceEvent::Char('h').localize(Snip { offset: 56, length: 1 },Snip { offset: 56, length: 1 }),
1449 SourceEvent::Char('t').localize(Snip { offset: 57, length: 1 },Snip { offset: 57, length: 1 }),
1450 SourceEvent::Char('m').localize(Snip { offset: 58, length: 1 },Snip { offset: 58, length: 1 }),
1451 SourceEvent::Char('l').localize(Snip { offset: 59, length: 1 },Snip { offset: 59, length: 1 }),
1452 SourceEvent::Char('#').localize(Snip { offset: 60, length: 1 },Snip { offset: 60, length: 1 }),
1453 SourceEvent::Char('d').localize(Snip { offset: 61, length: 1 },Snip { offset: 61, length: 1 }),
1454 SourceEvent::Char('y').localize(Snip { offset: 62, length: 1 },Snip { offset: 62, length: 1 }),
1455 SourceEvent::Char('n').localize(Snip { offset: 63, length: 1 },Snip { offset: 63, length: 1 }),
1456 SourceEvent::Char('a').localize(Snip { offset: 64, length: 1 },Snip { offset: 64, length: 1 }),
1457 SourceEvent::Char('m').localize(Snip { offset: 65, length: 1 },Snip { offset: 65, length: 1 }),
1458 SourceEvent::Char('i').localize(Snip { offset: 66, length: 1 },Snip { offset: 66, length: 1 }),
1459 SourceEvent::Char('c').localize(Snip { offset: 67, length: 1 },Snip { offset: 67, length: 1 }),
1460 SourceEvent::Char('-').localize(Snip { offset: 68, length: 1 },Snip { offset: 68, length: 1 }),
1461 SourceEvent::Char('m').localize(Snip { offset: 69, length: 1 },Snip { offset: 69, length: 1 }),
1462 SourceEvent::Char('a').localize(Snip { offset: 70, length: 1 },Snip { offset: 70, length: 1 }),
1463 SourceEvent::Char('r').localize(Snip { offset: 71, length: 1 },Snip { offset: 71, length: 1 }),
1464 SourceEvent::Char('k').localize(Snip { offset: 72, length: 1 },Snip { offset: 72, length: 1 }),
1465 SourceEvent::Char('u').localize(Snip { offset: 73, length: 1 },Snip { offset: 73, length: 1 }),
1466 SourceEvent::Char('p').localize(Snip { offset: 74, length: 1 },Snip { offset: 74, length: 1 }),
1467 SourceEvent::Char('-').localize(Snip { offset: 75, length: 1 },Snip { offset: 75, length: 1 }),
1468 SourceEvent::Char('i').localize(Snip { offset: 76, length: 1 },Snip { offset: 76, length: 1 }),
1469 SourceEvent::Char('n').localize(Snip { offset: 77, length: 1 },Snip { offset: 77, length: 1 }),
1470 SourceEvent::Char('s').localize(Snip { offset: 78, length: 1 },Snip { offset: 78, length: 1 }),
1471 SourceEvent::Char('e').localize(Snip { offset: 79, length: 1 },Snip { offset: 79, length: 1 }),
1472 SourceEvent::Char('r').localize(Snip { offset: 80, length: 1 },Snip { offset: 80, length: 1 }),
1473 SourceEvent::Char('t').localize(Snip { offset: 81, length: 1 },Snip { offset: 81, length: 1 }),
1474 SourceEvent::Char('i').localize(Snip { offset: 82, length: 1 },Snip { offset: 82, length: 1 }),
1475 SourceEvent::Char('o').localize(Snip { offset: 83, length: 1 },Snip { offset: 83, length: 1 }),
1476 SourceEvent::Char('n').localize(Snip { offset: 84, length: 1 },Snip { offset: 84, length: 1 }),
1477 SourceEvent::Char('"').localize(Snip { offset: 85, length: 1 },Snip { offset: 85, length: 1 }),
1478 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 86, length: 1 },Snip { offset: 86, length: 1 }),
1479 SourceEvent::Char('t').localize(Snip { offset: 87, length: 1 },Snip { offset: 87, length: 1 }),
1480 SourceEvent::Char('i').localize(Snip { offset: 88, length: 1 },Snip { offset: 88, length: 1 }),
1481 SourceEvent::Char('t').localize(Snip { offset: 89, length: 1 },Snip { offset: 89, length: 1 }),
1482 SourceEvent::Char('l').localize(Snip { offset: 90, length: 1 },Snip { offset: 90, length: 1 }),
1483 SourceEvent::Char('e').localize(Snip { offset: 91, length: 1 },Snip { offset: 91, length: 1 }),
1484 SourceEvent::Char('=').localize(Snip { offset: 92, length: 1 },Snip { offset: 92, length: 1 }),
1485 SourceEvent::Char('"').localize(Snip { offset: 93, length: 1 },Snip { offset: 93, length: 1 }),
1486 SourceEvent::Char('d').localize(Snip { offset: 94, length: 1 },Snip { offset: 94, length: 1 }),
1487 SourceEvent::Char('y').localize(Snip { offset: 95, length: 1 },Snip { offset: 95, length: 1 }),
1488 SourceEvent::Char('n').localize(Snip { offset: 96, length: 1 },Snip { offset: 96, length: 1 }),
1489 SourceEvent::Char('a').localize(Snip { offset: 97, length: 1 },Snip { offset: 97, length: 1 }),
1490 SourceEvent::Char('m').localize(Snip { offset: 98, length: 1 },Snip { offset: 98, length: 1 }),
1491 SourceEvent::Char('i').localize(Snip { offset: 99, length: 1 },Snip { offset: 99, length: 1 }),
1492 SourceEvent::Char('c').localize(Snip { offset: 100, length: 1 },Snip { offset: 100, length: 1 }),
1493 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 101, length: 1 },Snip { offset: 101, length: 1 }),
1494 SourceEvent::Char('m').localize(Snip { offset: 102, length: 1 },Snip { offset: 102, length: 1 }),
1495 SourceEvent::Char('a').localize(Snip { offset: 103, length: 1 },Snip { offset: 103, length: 1 }),
1496 SourceEvent::Char('r').localize(Snip { offset: 104, length: 1 },Snip { offset: 104, length: 1 }),
1497 SourceEvent::Char('k').localize(Snip { offset: 105, length: 1 },Snip { offset: 105, length: 1 }),
1498 SourceEvent::Char('u').localize(Snip { offset: 106, length: 1 },Snip { offset: 106, length: 1 }),
1499 SourceEvent::Char('p').localize(Snip { offset: 107, length: 1 },Snip { offset: 107, length: 1 }),
1500 SourceEvent::Breaker(Breaker::Line).localize(Snip { offset: 108, length: 3 },Snip { offset: 108, length: 3 }),
1501 SourceEvent::Char('i').localize(Snip { offset: 111, length: 1 },Snip { offset: 111, length: 1 }),
1502 SourceEvent::Char('n').localize(Snip { offset: 112, length: 1 },Snip { offset: 112, length: 1 }),
1503 SourceEvent::Char('s').localize(Snip { offset: 113, length: 1 },Snip { offset: 113, length: 1 }),
1504 SourceEvent::Char('e').localize(Snip { offset: 114, length: 1 },Snip { offset: 114, length: 1 }),
1505 SourceEvent::Char('r').localize(Snip { offset: 115, length: 1 },Snip { offset: 115, length: 1 }),
1506 SourceEvent::Char('t').localize(Snip { offset: 116, length: 1 },Snip { offset: 116, length: 1 }),
1507 SourceEvent::Char('i').localize(Snip { offset: 117, length: 1 },Snip { offset: 117, length: 1 }),
1508 SourceEvent::Char('o').localize(Snip { offset: 118, length: 1 },Snip { offset: 118, length: 1 }),
1509 SourceEvent::Char('n').localize(Snip { offset: 119, length: 1 },Snip { offset: 119, length: 1 }),
1510 SourceEvent::Char('"').localize(Snip { offset: 120, length: 1 },Snip { offset: 120, length: 1 }),
1511 SourceEvent::Char('>').localize(Snip { offset: 121, length: 1 },Snip { offset: 121, length: 1 }),
1512 ],
1513 }).localize(Snip { offset: 24, length: 98 },Snip { offset: 24, length: 98 }),
1514 ParserEvent::Char(',').localize(Snip { offset: 122, length: 1 },Snip { offset: 122, length: 1 }),
1515 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 123, length: 1 },Snip { offset: 123, length: 1 }),
1516 ParserEvent::Char('e').localize(Snip { offset: 124, length: 1 },Snip { offset: 124, length: 1 }),
1517 ParserEvent::Char('.').localize(Snip { offset: 125, length: 1 },Snip { offset: 125, length: 1 }),
1518 ParserEvent::Char('g').localize(Snip { offset: 126, length: 1 },Snip { offset: 126, length: 1 }),
1519 ParserEvent::Char('.').localize(Snip { offset: 127, length: 1 },Snip { offset: 127, length: 1 }),
1520 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 128, length: 1 },Snip { offset: 128, length: 1 }),
1521 ParserEvent::Char('u').localize(Snip { offset: 129, length: 1 },Snip { offset: 129, length: 1 }),
1522 ParserEvent::Char('s').localize(Snip { offset: 130, length: 1 },Snip { offset: 130, length: 1 }),
1523 ParserEvent::Char('i').localize(Snip { offset: 131, length: 1 },Snip { offset: 131, length: 1 }),
1524 ParserEvent::Char('n').localize(Snip { offset: 132, length: 1 },Snip { offset: 132, length: 1 }),
1525 ParserEvent::Char('g').localize(Snip { offset: 133, length: 1 },Snip { offset: 133, length: 1 }),
1526 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 134, length: 1 },Snip { offset: 134, length: 1 }),
1527 ParserEvent::Char('t').localize(Snip { offset: 135, length: 1 },Snip { offset: 135, length: 1 }),
1528 ParserEvent::Char('h').localize(Snip { offset: 136, length: 1 },Snip { offset: 136, length: 1 }),
1529 ParserEvent::Char('e').localize(Snip { offset: 137, length: 1 },Snip { offset: 137, length: 1 }),
1530 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 138, length: 1 },Snip { offset: 138, length: 1 }),
1531 ParserEvent::Parsed(Tag {
1532 name: TagName::Code, closing: Closing::Open, attributes: OptVec::None,
1533 begin: ().localize(Snip { offset: 139, length: 1 },Snip { offset: 139, length: 1 }),
1534 end: ().localize(Snip { offset: 171, length: 1 },Snip { offset: 171, length: 1 }),
1535 raw: vec![
1536 SourceEvent::Char('<').localize(Snip { offset: 139, length: 1 },Snip { offset: 139, length: 1 }),
1537 SourceEvent::Char('c').localize(Snip { offset: 140, length: 1 },Snip { offset: 140, length: 1 }),
1538 SourceEvent::Char('o').localize(Snip { offset: 141, length: 1 },Snip { offset: 141, length: 1 }),
1539 SourceEvent::Char('d').localize(Snip { offset: 142, length: 1 },Snip { offset: 142, length: 1 }),
1540 SourceEvent::Char('e').localize(Snip { offset: 143, length: 1 },Snip { offset: 143, length: 1 }),
1541 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 144, length: 1 },Snip { offset: 144, length: 1 }),
1542 SourceEvent::Char('t').localize(Snip { offset: 145, length: 1 },Snip { offset: 145, length: 1 }),
1543 SourceEvent::Char('i').localize(Snip { offset: 146, length: 1 },Snip { offset: 146, length: 1 }),
1544 SourceEvent::Char('t').localize(Snip { offset: 147, length: 1 },Snip { offset: 147, length: 1 }),
1545 SourceEvent::Char('l').localize(Snip { offset: 148, length: 1 },Snip { offset: 148, length: 1 }),
1546 SourceEvent::Char('e').localize(Snip { offset: 149, length: 1 },Snip { offset: 149, length: 1 }),
1547 SourceEvent::Char('=').localize(Snip { offset: 150, length: 1 },Snip { offset: 150, length: 1 }),
1548 SourceEvent::Char('"').localize(Snip { offset: 151, length: 1 },Snip { offset: 151, length: 1 }),
1549 SourceEvent::Char('d').localize(Snip { offset: 152, length: 1 },Snip { offset: 152, length: 1 }),
1550 SourceEvent::Char('o').localize(Snip { offset: 153, length: 1 },Snip { offset: 153, length: 1 }),
1551 SourceEvent::Char('m').localize(Snip { offset: 154, length: 1 },Snip { offset: 154, length: 1 }),
1552 SourceEvent::Char('-').localize(Snip { offset: 155, length: 1 },Snip { offset: 155, length: 1 }),
1553 SourceEvent::Char('d').localize(Snip { offset: 156, length: 1 },Snip { offset: 156, length: 1 }),
1554 SourceEvent::Char('o').localize(Snip { offset: 157, length: 1 },Snip { offset: 157, length: 1 }),
1555 SourceEvent::Char('c').localize(Snip { offset: 158, length: 1 },Snip { offset: 158, length: 1 }),
1556 SourceEvent::Char('u').localize(Snip { offset: 159, length: 1 },Snip { offset: 159, length: 1 }),
1557 SourceEvent::Char('m').localize(Snip { offset: 160, length: 1 },Snip { offset: 160, length: 1 }),
1558 SourceEvent::Char('e').localize(Snip { offset: 161, length: 1 },Snip { offset: 161, length: 1 }),
1559 SourceEvent::Char('n').localize(Snip { offset: 162, length: 1 },Snip { offset: 162, length: 1 }),
1560 SourceEvent::Char('t').localize(Snip { offset: 163, length: 1 },Snip { offset: 163, length: 1 }),
1561 SourceEvent::Char('-').localize(Snip { offset: 164, length: 1 },Snip { offset: 164, length: 1 }),
1562 SourceEvent::Char('w').localize(Snip { offset: 165, length: 1 },Snip { offset: 165, length: 1 }),
1563 SourceEvent::Char('r').localize(Snip { offset: 166, length: 1 },Snip { offset: 166, length: 1 }),
1564 SourceEvent::Char('i').localize(Snip { offset: 167, length: 1 },Snip { offset: 167, length: 1 }),
1565 SourceEvent::Char('t').localize(Snip { offset: 168, length: 1 },Snip { offset: 168, length: 1 }),
1566 SourceEvent::Char('e').localize(Snip { offset: 169, length: 1 },Snip { offset: 169, length: 1 }),
1567 SourceEvent::Char('"').localize(Snip { offset: 170, length: 1 },Snip { offset: 170, length: 1 }),
1568 SourceEvent::Char('>').localize(Snip { offset: 171, length: 1 },Snip { offset: 171, length: 1 }),
1569 ],
1570 }).localize(Snip { offset: 139, length: 33 },Snip { offset: 139, length: 33 }),
1571 ParserEvent::Parsed(Tag {
1572 name: TagName::A, closing: Closing::Open,
1573 attributes: OptVec::One(("href".to_string(), Some(Snip{ offset: 9, length: 45 }))),
1574 begin: ().localize(Snip { offset: 172, length: 1 },Snip { offset: 172, length: 1 }),
1575 end: ().localize(Snip { offset: 228, length: 1 },Snip { offset: 228, length: 1 }),
1576 raw: vec![
1577 SourceEvent::Char('<').localize(Snip { offset: 172, length: 1 },Snip { offset: 172, length: 1 }),
1578 SourceEvent::Char('a').localize(Snip { offset: 173, length: 1 },Snip { offset: 173, length: 1 }),
1579 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 174, length: 1 },Snip { offset: 174, length: 1 }),
1580 SourceEvent::Char('h').localize(Snip { offset: 175, length: 1 },Snip { offset: 175, length: 1 }),
1581 SourceEvent::Char('r').localize(Snip { offset: 176, length: 1 },Snip { offset: 176, length: 1 }),
1582 SourceEvent::Char('e').localize(Snip { offset: 177, length: 1 },Snip { offset: 177, length: 1 }),
1583 SourceEvent::Char('f').localize(Snip { offset: 178, length: 1 },Snip { offset: 178, length: 1 }),
1584 SourceEvent::Char('=').localize(Snip { offset: 179, length: 1 },Snip { offset: 179, length: 1 }),
1585 SourceEvent::Char('"').localize(Snip { offset: 180, length: 1 },Snip { offset: 180, length: 1 }),
1586 SourceEvent::Char('a').localize(Snip { offset: 181, length: 1 },Snip { offset: 181, length: 1 }),
1587 SourceEvent::Char('p').localize(Snip { offset: 182, length: 1 },Snip { offset: 182, length: 1 }),
1588 SourceEvent::Char('i').localize(Snip { offset: 183, length: 1 },Snip { offset: 183, length: 1 }),
1589 SourceEvent::Char('s').localize(Snip { offset: 184, length: 1 },Snip { offset: 184, length: 1 }),
1590 SourceEvent::Char('-').localize(Snip { offset: 185, length: 1 },Snip { offset: 185, length: 1 }),
1591 SourceEvent::Char('i').localize(Snip { offset: 186, length: 1 },Snip { offset: 186, length: 1 }),
1592 SourceEvent::Char('n').localize(Snip { offset: 187, length: 1 },Snip { offset: 187, length: 1 }),
1593 SourceEvent::Char('-').localize(Snip { offset: 188, length: 1 },Snip { offset: 188, length: 1 }),
1594 SourceEvent::Char('h').localize(Snip { offset: 189, length: 1 },Snip { offset: 189, length: 1 }),
1595 SourceEvent::Char('t').localize(Snip { offset: 190, length: 1 },Snip { offset: 190, length: 1 }),
1596 SourceEvent::Char('m').localize(Snip { offset: 191, length: 1 },Snip { offset: 191, length: 1 }),
1597 SourceEvent::Char('l').localize(Snip { offset: 192, length: 1 },Snip { offset: 192, length: 1 }),
1598 SourceEvent::Char('-').localize(Snip { offset: 193, length: 1 },Snip { offset: 193, length: 1 }),
1599 SourceEvent::Char('d').localize(Snip { offset: 194, length: 1 },Snip { offset: 194, length: 1 }),
1600 SourceEvent::Char('o').localize(Snip { offset: 195, length: 1 },Snip { offset: 195, length: 1 }),
1601 SourceEvent::Char('c').localize(Snip { offset: 196, length: 1 },Snip { offset: 196, length: 1 }),
1602 SourceEvent::Char('u').localize(Snip { offset: 197, length: 1 },Snip { offset: 197, length: 1 }),
1603 SourceEvent::Char('m').localize(Snip { offset: 198, length: 1 },Snip { offset: 198, length: 1 }),
1604 SourceEvent::Char('e').localize(Snip { offset: 199, length: 1 },Snip { offset: 199, length: 1 }),
1605 SourceEvent::Char('n').localize(Snip { offset: 200, length: 1 },Snip { offset: 200, length: 1 }),
1606 SourceEvent::Char('t').localize(Snip { offset: 201, length: 1 },Snip { offset: 201, length: 1 }),
1607 SourceEvent::Char('s').localize(Snip { offset: 202, length: 1 },Snip { offset: 202, length: 1 }),
1608 SourceEvent::Char('.').localize(Snip { offset: 203, length: 1 },Snip { offset: 203, length: 1 }),
1609 SourceEvent::Char('h').localize(Snip { offset: 204, length: 1 },Snip { offset: 204, length: 1 }),
1610 SourceEvent::Char('t').localize(Snip { offset: 205, length: 1 },Snip { offset: 205, length: 1 }),
1611 SourceEvent::Char('m').localize(Snip { offset: 206, length: 1 },Snip { offset: 206, length: 1 }),
1612 SourceEvent::Char('l').localize(Snip { offset: 207, length: 1 },Snip { offset: 207, length: 1 }),
1613 SourceEvent::Char('#').localize(Snip { offset: 208, length: 1 },Snip { offset: 208, length: 1 }),
1614 SourceEvent::Char('d').localize(Snip { offset: 209, length: 1 },Snip { offset: 209, length: 1 }),
1615 SourceEvent::Char('o').localize(Snip { offset: 210, length: 1 },Snip { offset: 210, length: 1 }),
1616 SourceEvent::Char('m').localize(Snip { offset: 211, length: 1 },Snip { offset: 211, length: 1 }),
1617 SourceEvent::Char('-').localize(Snip { offset: 212, length: 1 },Snip { offset: 212, length: 1 }),
1618 SourceEvent::Char('d').localize(Snip { offset: 213, length: 1 },Snip { offset: 213, length: 1 }),
1619 SourceEvent::Char('o').localize(Snip { offset: 214, length: 1 },Snip { offset: 214, length: 1 }),
1620 SourceEvent::Char('c').localize(Snip { offset: 215, length: 1 },Snip { offset: 215, length: 1 }),
1621 SourceEvent::Char('u').localize(Snip { offset: 216, length: 1 },Snip { offset: 216, length: 1 }),
1622 SourceEvent::Char('m').localize(Snip { offset: 217, length: 1 },Snip { offset: 217, length: 1 }),
1623 SourceEvent::Char('e').localize(Snip { offset: 218, length: 1 },Snip { offset: 218, length: 1 }),
1624 SourceEvent::Char('n').localize(Snip { offset: 219, length: 1 },Snip { offset: 219, length: 1 }),
1625 SourceEvent::Char('t').localize(Snip { offset: 220, length: 1 },Snip { offset: 220, length: 1 }),
1626 SourceEvent::Char('-').localize(Snip { offset: 221, length: 1 },Snip { offset: 221, length: 1 }),
1627 SourceEvent::Char('w').localize(Snip { offset: 222, length: 1 },Snip { offset: 222, length: 1 }),
1628 SourceEvent::Char('r').localize(Snip { offset: 223, length: 1 },Snip { offset: 223, length: 1 }),
1629 SourceEvent::Char('i').localize(Snip { offset: 224, length: 1 },Snip { offset: 224, length: 1 }),
1630 SourceEvent::Char('t').localize(Snip { offset: 225, length: 1 },Snip { offset: 225, length: 1 }),
1631 SourceEvent::Char('e').localize(Snip { offset: 226, length: 1 },Snip { offset: 226, length: 1 }),
1632 SourceEvent::Char('"').localize(Snip { offset: 227, length: 1 },Snip { offset: 227, length: 1 }),
1633 SourceEvent::Char('>').localize(Snip { offset: 228, length: 1 },Snip { offset: 228, length: 1 }),
1634 ],
1635 }).localize(Snip { offset: 172, length: 57 },Snip { offset: 172, length: 57 }),
1636 ParserEvent::Char('d').localize(Snip { offset: 229, length: 1 },Snip { offset: 229, length: 1 }),
1637 ParserEvent::Char('o').localize(Snip { offset: 230, length: 1 },Snip { offset: 230, length: 1 }),
1638 ParserEvent::Char('c').localize(Snip { offset: 231, length: 1 },Snip { offset: 231, length: 1 }),
1639 ParserEvent::Char('u').localize(Snip { offset: 232, length: 1 },Snip { offset: 232, length: 1 }),
1640 ParserEvent::Char('m').localize(Snip { offset: 233, length: 1 },Snip { offset: 233, length: 1 }),
1641 ParserEvent::Char('e').localize(Snip { offset: 234, length: 1 },Snip { offset: 234, length: 1 }),
1642 ParserEvent::Char('n').localize(Snip { offset: 235, length: 1 },Snip { offset: 235, length: 1 }),
1643 ParserEvent::Char('t').localize(Snip { offset: 236, length: 1 },Snip { offset: 236, length: 1 }),
1644 ParserEvent::Char('.').localize(Snip { offset: 237, length: 1 },Snip { offset: 237, length: 1 }),
1645 ParserEvent::Char('w').localize(Snip { offset: 238, length: 1 },Snip { offset: 238, length: 1 }),
1646 ParserEvent::Char('r').localize(Snip { offset: 239, length: 1 },Snip { offset: 239, length: 1 }),
1647 ParserEvent::Char('i').localize(Snip { offset: 240, length: 1 },Snip { offset: 240, length: 1 }),
1648 ParserEvent::Char('t').localize(Snip { offset: 241, length: 1 },Snip { offset: 241, length: 1 }),
1649 ParserEvent::Char('e').localize(Snip { offset: 242, length: 1 },Snip { offset: 242, length: 1 }),
1650 ParserEvent::Char('(').localize(Snip { offset: 243, length: 1 },Snip { offset: 243, length: 1 }),
1651 ParserEvent::Char(')').localize(Snip { offset: 244, length: 1 },Snip { offset: 244, length: 1 }),
1652 ParserEvent::Parsed(Tag {
1653 name: TagName::A, closing: Closing::Close, attributes: OptVec::None,
1654 begin: ().localize(Snip { offset: 245, length: 1 },Snip { offset: 245, length: 1 }),
1655 end: ().localize(Snip { offset: 248, length: 1 },Snip { offset: 248, length: 1 }),
1656 raw: vec![
1657 SourceEvent::Char('<').localize(Snip { offset: 245, length: 1 },Snip { offset: 245, length: 1 }),
1658 SourceEvent::Char('/').localize(Snip { offset: 246, length: 1 },Snip { offset: 246, length: 1 }),
1659 SourceEvent::Char('a').localize(Snip { offset: 247, length: 1 },Snip { offset: 247, length: 1 }),
1660 SourceEvent::Char('>').localize(Snip { offset: 248, length: 1 },Snip { offset: 248, length: 1 }),
1661 ],
1662 }).localize(Snip { offset: 245, length: 4 },Snip { offset: 245, length: 4 }),
1663 ParserEvent::Parsed(Tag {
1664 name: TagName::Code, closing: Closing::Close, attributes: OptVec::None,
1665 begin: ().localize(Snip { offset: 249, length: 1 },Snip { offset: 249, length: 1 }),
1666 end: ().localize(Snip { offset: 255, length: 1 },Snip { offset: 255, length: 1 }),
1667 raw: vec![
1668 SourceEvent::Char('<').localize(Snip { offset: 249, length: 1 },Snip { offset: 249, length: 1 }),
1669 SourceEvent::Char('/').localize(Snip { offset: 250, length: 1 },Snip { offset: 250, length: 1 }),
1670 SourceEvent::Char('c').localize(Snip { offset: 251, length: 1 },Snip { offset: 251, length: 1 }),
1671 SourceEvent::Char('o').localize(Snip { offset: 252, length: 1 },Snip { offset: 252, length: 1 }),
1672 SourceEvent::Char('d').localize(Snip { offset: 253, length: 1 },Snip { offset: 253, length: 1 }),
1673 SourceEvent::Char('e').localize(Snip { offset: 254, length: 1 },Snip { offset: 254, length: 1 }),
1674 SourceEvent::Char('>').localize(Snip { offset: 255, length: 1 },Snip { offset: 255, length: 1 }),
1675 ],
1676 }).localize(Snip { offset: 249, length: 7 },Snip { offset: 249, length: 7 }),
1677 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 256, length: 1 },Snip { offset: 256, length: 1 }),
1678 ParserEvent::Char('A').localize(Snip { offset: 257, length: 1 },Snip { offset: 257, length: 1 }),
1679 ParserEvent::Char('P').localize(Snip { offset: 258, length: 1 },Snip { offset: 258, length: 1 }),
1680 ParserEvent::Char('I').localize(Snip { offset: 259, length: 1 },Snip { offset: 259, length: 1 }),
1681 ParserEvent::Char('.').localize(Snip { offset: 260, length: 1 },Snip { offset: 260, length: 1 }),
1682 ParserEvent::Parsed(Tag {
1683 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1684 begin: ().localize(Snip { offset: 261, length: 1 },Snip { offset: 261, length: 1 }),
1685 end: ().localize(Snip { offset: 264, length: 1 },Snip { offset: 264, length: 1 }),
1686 raw: vec![
1687 SourceEvent::Char('<').localize(Snip { offset: 261, length: 1 },Snip { offset: 261, length: 1 }),
1688 SourceEvent::Char('/').localize(Snip { offset: 262, length: 1 },Snip { offset: 262, length: 1 }),
1689 SourceEvent::Char('p').localize(Snip { offset: 263, length: 1 },Snip { offset: 263, length: 1 }),
1690 SourceEvent::Char('>').localize(Snip { offset: 264, length: 1 },Snip { offset: 264, length: 1 }),
1691 ],
1692 }).localize(Snip { offset: 261, length: 4 },Snip { offset: 261, length: 4 }),
1693 ParserEvent::Breaker(Breaker::Line).localize(Snip { offset: 265, length: 3 },Snip { offset: 265, length: 3 }),
1694 ParserEvent::Parsed(Tag {
1695 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
1696 begin: ().localize(Snip { offset: 268, length: 1 },Snip { offset: 268, length: 1 }),
1697 end: ().localize(Snip { offset: 270, length: 1 },Snip { offset: 270, length: 1 }),
1698 raw: vec![
1699 SourceEvent::Char('<').localize(Snip { offset: 268, length: 1 },Snip { offset: 268, length: 1 }),
1700 SourceEvent::Char('p').localize(Snip { offset: 269, length: 1 },Snip { offset: 269, length: 1 }),
1701 SourceEvent::Char('>').localize(Snip { offset: 270, length: 1 },Snip { offset: 270, length: 1 }),
1702 ],
1703 }).localize(Snip { offset: 268, length: 3 },Snip { offset: 268, length: 3 }),
1704 ParserEvent::Parsed(Tag {
1705 name: TagName::Img, closing: Closing::Void,
1706 attributes: OptVec::One(("alt".to_string(), None)),
1707 begin: ().localize(Snip { offset: 271, length: 1 },Snip { offset: 271, length: 1 }),
1708 end: ().localize(Snip { offset: 377, length: 1 },Snip { offset: 377, length: 1 }),
1709 raw: vec![
1710 SourceEvent::Char('<').localize(Snip { offset: 271, length: 1 },Snip { offset: 271, length: 1 }),
1711 SourceEvent::Char('i').localize(Snip { offset: 272, length: 1 },Snip { offset: 272, length: 1 }),
1712 SourceEvent::Char('m').localize(Snip { offset: 273, length: 1 },Snip { offset: 273, length: 1 }),
1713 SourceEvent::Char('g').localize(Snip { offset: 274, length: 1 },Snip { offset: 274, length: 1 }),
1714 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 275, length: 1 },Snip { offset: 275, length: 1 }),
1715 SourceEvent::Char('a').localize(Snip { offset: 276, length: 1 },Snip { offset: 276, length: 1 }),
1716 SourceEvent::Char('l').localize(Snip { offset: 277, length: 1 },Snip { offset: 277, length: 1 }),
1717 SourceEvent::Char('t').localize(Snip { offset: 278, length: 1 },Snip { offset: 278, length: 1 }),
1718 SourceEvent::Char('=').localize(Snip { offset: 279, length: 1 },Snip { offset: 279, length: 1 }),
1719 SourceEvent::Char('"').localize(Snip { offset: 280, length: 1 },Snip { offset: 280, length: 1 }),
1720 SourceEvent::Char('"').localize(Snip { offset: 281, length: 1 },Snip { offset: 281, length: 1 }),
1721 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 282, length: 1 },Snip { offset: 282, length: 1 }),
1722 SourceEvent::Char('h').localize(Snip { offset: 283, length: 1 },Snip { offset: 283, length: 1 }),
1723 SourceEvent::Char('e').localize(Snip { offset: 284, length: 1 },Snip { offset: 284, length: 1 }),
1724 SourceEvent::Char('i').localize(Snip { offset: 285, length: 1 },Snip { offset: 285, length: 1 }),
1725 SourceEvent::Char('g').localize(Snip { offset: 286, length: 1 },Snip { offset: 286, length: 1 }),
1726 SourceEvent::Char('h').localize(Snip { offset: 287, length: 1 },Snip { offset: 287, length: 1 }),
1727 SourceEvent::Char('t').localize(Snip { offset: 288, length: 1 },Snip { offset: 288, length: 1 }),
1728 SourceEvent::Char('=').localize(Snip { offset: 289, length: 1 },Snip { offset: 289, length: 1 }),
1729 SourceEvent::Char('"').localize(Snip { offset: 290, length: 1 },Snip { offset: 290, length: 1 }),
1730 SourceEvent::Char('5').localize(Snip { offset: 291, length: 1 },Snip { offset: 291, length: 1 }),
1731 SourceEvent::Char('5').localize(Snip { offset: 292, length: 1 },Snip { offset: 292, length: 1 }),
1732 SourceEvent::Char('4').localize(Snip { offset: 293, length: 1 },Snip { offset: 293, length: 1 }),
1733 SourceEvent::Char('"').localize(Snip { offset: 294, length: 1 },Snip { offset: 294, length: 1 }),
1734 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 295, length: 1 },Snip { offset: 295, length: 1 }),
1735 SourceEvent::Char('s').localize(Snip { offset: 296, length: 1 },Snip { offset: 296, length: 1 }),
1736 SourceEvent::Char('r').localize(Snip { offset: 297, length: 1 },Snip { offset: 297, length: 1 }),
1737 SourceEvent::Char('c').localize(Snip { offset: 298, length: 1 },Snip { offset: 298, length: 1 }),
1738 SourceEvent::Char('=').localize(Snip { offset: 299, length: 1 },Snip { offset: 299, length: 1 }),
1739 SourceEvent::Char('"').localize(Snip { offset: 300, length: 1 },Snip { offset: 300, length: 1 }),
1740 SourceEvent::Char('h').localize(Snip { offset: 301, length: 1 },Snip { offset: 301, length: 1 }),
1741 SourceEvent::Char('t').localize(Snip { offset: 302, length: 1 },Snip { offset: 302, length: 1 }),
1742 SourceEvent::Char('t').localize(Snip { offset: 303, length: 1 },Snip { offset: 303, length: 1 }),
1743 SourceEvent::Char('p').localize(Snip { offset: 304, length: 1 },Snip { offset: 304, length: 1 }),
1744 SourceEvent::Char('s').localize(Snip { offset: 305, length: 1 },Snip { offset: 305, length: 1 }),
1745 SourceEvent::Char(':').localize(Snip { offset: 306, length: 1 },Snip { offset: 306, length: 1 }),
1746 SourceEvent::Char('/').localize(Snip { offset: 307, length: 1 },Snip { offset: 307, length: 1 }),
1747 SourceEvent::Char('/').localize(Snip { offset: 308, length: 1 },Snip { offset: 308, length: 1 }),
1748 SourceEvent::Char('d').localize(Snip { offset: 309, length: 1 },Snip { offset: 309, length: 1 }),
1749 SourceEvent::Char('e').localize(Snip { offset: 310, length: 1 },Snip { offset: 310, length: 1 }),
1750 SourceEvent::Char('v').localize(Snip { offset: 311, length: 1 },Snip { offset: 311, length: 1 }),
1751 SourceEvent::Char('.').localize(Snip { offset: 312, length: 1 },Snip { offset: 312, length: 1 }),
1752 SourceEvent::Char('w').localize(Snip { offset: 313, length: 1 },Snip { offset: 313, length: 1 }),
1753 SourceEvent::Char('3').localize(Snip { offset: 314, length: 1 },Snip { offset: 314, length: 1 }),
1754 SourceEvent::Char('.').localize(Snip { offset: 315, length: 1 },Snip { offset: 315, length: 1 }),
1755 SourceEvent::Char('o').localize(Snip { offset: 316, length: 1 },Snip { offset: 316, length: 1 }),
1756 SourceEvent::Char('r').localize(Snip { offset: 317, length: 1 },Snip { offset: 317, length: 1 }),
1757 SourceEvent::Char('g').localize(Snip { offset: 318, length: 1 },Snip { offset: 318, length: 1 }),
1758 SourceEvent::Char('/').localize(Snip { offset: 319, length: 1 },Snip { offset: 319, length: 1 }),
1759 SourceEvent::Char('h').localize(Snip { offset: 320, length: 1 },Snip { offset: 320, length: 1 }),
1760 SourceEvent::Char('t').localize(Snip { offset: 321, length: 1 },Snip { offset: 321, length: 1 }),
1761 SourceEvent::Char('m').localize(Snip { offset: 322, length: 1 },Snip { offset: 322, length: 1 }),
1762 SourceEvent::Char('l').localize(Snip { offset: 323, length: 1 },Snip { offset: 323, length: 1 }),
1763 SourceEvent::Char('5').localize(Snip { offset: 324, length: 1 },Snip { offset: 324, length: 1 }),
1764 SourceEvent::Char('/').localize(Snip { offset: 325, length: 1 },Snip { offset: 325, length: 1 }),
1765 SourceEvent::Char('s').localize(Snip { offset: 326, length: 1 },Snip { offset: 326, length: 1 }),
1766 SourceEvent::Char('p').localize(Snip { offset: 327, length: 1 },Snip { offset: 327, length: 1 }),
1767 SourceEvent::Char('e').localize(Snip { offset: 328, length: 1 },Snip { offset: 328, length: 1 }),
1768 SourceEvent::Char('c').localize(Snip { offset: 329, length: 1 },Snip { offset: 329, length: 1 }),
1769 SourceEvent::Char('/').localize(Snip { offset: 330, length: 1 },Snip { offset: 330, length: 1 }),
1770 SourceEvent::Char('i').localize(Snip { offset: 331, length: 1 },Snip { offset: 331, length: 1 }),
1771 SourceEvent::Char('m').localize(Snip { offset: 332, length: 1 },Snip { offset: 332, length: 1 }),
1772 SourceEvent::Char('a').localize(Snip { offset: 333, length: 1 },Snip { offset: 333, length: 1 }),
1773 SourceEvent::Char('g').localize(Snip { offset: 334, length: 1 },Snip { offset: 334, length: 1 }),
1774 SourceEvent::Char('e').localize(Snip { offset: 335, length: 1 },Snip { offset: 335, length: 1 }),
1775 SourceEvent::Char('s').localize(Snip { offset: 336, length: 1 },Snip { offset: 336, length: 1 }),
1776 SourceEvent::Char('/').localize(Snip { offset: 337, length: 1 },Snip { offset: 337, length: 1 }),
1777 SourceEvent::Char('p').localize(Snip { offset: 338, length: 1 },Snip { offset: 338, length: 1 }),
1778 SourceEvent::Char('a').localize(Snip { offset: 339, length: 1 },Snip { offset: 339, length: 1 }),
1779 SourceEvent::Char('r').localize(Snip { offset: 340, length: 1 },Snip { offset: 340, length: 1 }),
1780 SourceEvent::Char('s').localize(Snip { offset: 341, length: 1 },Snip { offset: 341, length: 1 }),
1781 SourceEvent::Char('i').localize(Snip { offset: 342, length: 1 },Snip { offset: 342, length: 1 }),
1782 SourceEvent::Char('n').localize(Snip { offset: 343, length: 1 },Snip { offset: 343, length: 1 }),
1783 SourceEvent::Char('g').localize(Snip { offset: 344, length: 1 },Snip { offset: 344, length: 1 }),
1784 SourceEvent::Char('-').localize(Snip { offset: 345, length: 1 },Snip { offset: 345, length: 1 }),
1785 SourceEvent::Char('m').localize(Snip { offset: 346, length: 1 },Snip { offset: 346, length: 1 }),
1786 SourceEvent::Char('o').localize(Snip { offset: 347, length: 1 },Snip { offset: 347, length: 1 }),
1787 SourceEvent::Char('d').localize(Snip { offset: 348, length: 1 },Snip { offset: 348, length: 1 }),
1788 SourceEvent::Char('e').localize(Snip { offset: 349, length: 1 },Snip { offset: 349, length: 1 }),
1789 SourceEvent::Char('l').localize(Snip { offset: 350, length: 1 },Snip { offset: 350, length: 1 }),
1790 SourceEvent::Char('-').localize(Snip { offset: 351, length: 1 },Snip { offset: 351, length: 1 }),
1791 SourceEvent::Char('o').localize(Snip { offset: 352, length: 1 },Snip { offset: 352, length: 1 }),
1792 SourceEvent::Char('v').localize(Snip { offset: 353, length: 1 },Snip { offset: 353, length: 1 }),
1793 SourceEvent::Char('e').localize(Snip { offset: 354, length: 1 },Snip { offset: 354, length: 1 }),
1794 SourceEvent::Char('r').localize(Snip { offset: 355, length: 1 },Snip { offset: 355, length: 1 }),
1795 SourceEvent::Char('v').localize(Snip { offset: 356, length: 1 },Snip { offset: 356, length: 1 }),
1796 SourceEvent::Char('i').localize(Snip { offset: 357, length: 1 },Snip { offset: 357, length: 1 }),
1797 SourceEvent::Char('e').localize(Snip { offset: 358, length: 1 },Snip { offset: 358, length: 1 }),
1798 SourceEvent::Char('w').localize(Snip { offset: 359, length: 1 },Snip { offset: 359, length: 1 }),
1799 SourceEvent::Char('.').localize(Snip { offset: 360, length: 1 },Snip { offset: 360, length: 1 }),
1800 SourceEvent::Char('p').localize(Snip { offset: 361, length: 1 },Snip { offset: 361, length: 1 }),
1801 SourceEvent::Char('n').localize(Snip { offset: 362, length: 1 },Snip { offset: 362, length: 1 }),
1802 SourceEvent::Char('g').localize(Snip { offset: 363, length: 1 },Snip { offset: 363, length: 1 }),
1803 SourceEvent::Char('"').localize(Snip { offset: 364, length: 1 },Snip { offset: 364, length: 1 }),
1804 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 365, length: 1 },Snip { offset: 365, length: 1 }),
1805 SourceEvent::Char('w').localize(Snip { offset: 366, length: 1 },Snip { offset: 366, length: 1 }),
1806 SourceEvent::Char('i').localize(Snip { offset: 367, length: 1 },Snip { offset: 367, length: 1 }),
1807 SourceEvent::Char('d').localize(Snip { offset: 368, length: 1 },Snip { offset: 368, length: 1 }),
1808 SourceEvent::Char('t').localize(Snip { offset: 369, length: 1 },Snip { offset: 369, length: 1 }),
1809 SourceEvent::Char('h').localize(Snip { offset: 370, length: 1 },Snip { offset: 370, length: 1 }),
1810 SourceEvent::Char('=').localize(Snip { offset: 371, length: 1 },Snip { offset: 371, length: 1 }),
1811 SourceEvent::Char('"').localize(Snip { offset: 372, length: 1 },Snip { offset: 372, length: 1 }),
1812 SourceEvent::Char('4').localize(Snip { offset: 373, length: 1 },Snip { offset: 373, length: 1 }),
1813 SourceEvent::Char('2').localize(Snip { offset: 374, length: 1 },Snip { offset: 374, length: 1 }),
1814 SourceEvent::Char('7').localize(Snip { offset: 375, length: 1 },Snip { offset: 375, length: 1 }),
1815 SourceEvent::Char('"').localize(Snip { offset: 376, length: 1 },Snip { offset: 376, length: 1 }),
1816 SourceEvent::Char('>').localize(Snip { offset: 377, length: 1 },Snip { offset: 377, length: 1 }),
1817 ],
1818 }).localize(Snip { offset: 271, length: 107 },Snip { offset: 271, length: 107 }),
1819 ParserEvent::Parsed(Tag {
1820 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1821 begin: ().localize(Snip { offset: 378, length: 1 },Snip { offset: 378, length: 1 }),
1822 end: ().localize(Snip { offset: 381, length: 1 },Snip { offset: 381, length: 1 }),
1823 raw: vec![
1824 SourceEvent::Char('<').localize(Snip { offset: 378, length: 1 },Snip { offset: 378, length: 1 }),
1825 SourceEvent::Char('/').localize(Snip { offset: 379, length: 1 },Snip { offset: 379, length: 1 }),
1826 SourceEvent::Char('p').localize(Snip { offset: 380, length: 1 },Snip { offset: 380, length: 1 }),
1827 SourceEvent::Char('>').localize(Snip { offset: 381, length: 1 },Snip { offset: 381, length: 1 }),
1828 ],
1829 }).localize(Snip { offset: 378, length: 4 },Snip { offset: 378, length: 4 }),
1830 ParserEvent::Breaker(Breaker::Line).localize(Snip { offset: 382, length: 3 },Snip { offset: 382, length: 3 }),
1831 ParserEvent::Parsed(Tag {
1832 name: TagName::P, closing: Closing::Open, attributes: OptVec::None,
1833 begin: ().localize(Snip { offset: 385, length: 1 },Snip { offset: 385, length: 1 }),
1834 end: ().localize(Snip { offset: 406, length: 1 },Snip { offset: 406, length: 1 }),
1835 raw: vec![
1836 SourceEvent::Char('<').localize(Snip { offset: 385, length: 1 },Snip { offset: 385, length: 1 }),
1837 SourceEvent::Char('p').localize(Snip { offset: 386, length: 1 },Snip { offset: 386, length: 1 }),
1838 SourceEvent::Breaker(Breaker::Space).localize(Snip { offset: 387, length: 1 },Snip { offset: 387, length: 1 }),
1839 SourceEvent::Char('i').localize(Snip { offset: 388, length: 1 },Snip { offset: 388, length: 1 }),
1840 SourceEvent::Char('d').localize(Snip { offset: 389, length: 1 },Snip { offset: 389, length: 1 }),
1841 SourceEvent::Char('=').localize(Snip { offset: 390, length: 1 },Snip { offset: 390, length: 1 }),
1842 SourceEvent::Char('"').localize(Snip { offset: 391, length: 1 },Snip { offset: 391, length: 1 }),
1843 SourceEvent::Char('n').localize(Snip { offset: 392, length: 1 },Snip { offset: 392, length: 1 }),
1844 SourceEvent::Char('e').localize(Snip { offset: 393, length: 1 },Snip { offset: 393, length: 1 }),
1845 SourceEvent::Char('s').localize(Snip { offset: 394, length: 1 },Snip { offset: 394, length: 1 }),
1846 SourceEvent::Char('t').localize(Snip { offset: 395, length: 1 },Snip { offset: 395, length: 1 }),
1847 SourceEvent::Char('e').localize(Snip { offset: 396, length: 1 },Snip { offset: 396, length: 1 }),
1848 SourceEvent::Char('d').localize(Snip { offset: 397, length: 1 },Snip { offset: 397, length: 1 }),
1849 SourceEvent::Char('P').localize(Snip { offset: 398, length: 1 },Snip { offset: 398, length: 1 }),
1850 SourceEvent::Char('a').localize(Snip { offset: 399, length: 1 },Snip { offset: 399, length: 1 }),
1851 SourceEvent::Char('r').localize(Snip { offset: 400, length: 1 },Snip { offset: 400, length: 1 }),
1852 SourceEvent::Char('s').localize(Snip { offset: 401, length: 1 },Snip { offset: 401, length: 1 }),
1853 SourceEvent::Char('i').localize(Snip { offset: 402, length: 1 },Snip { offset: 402, length: 1 }),
1854 SourceEvent::Char('n').localize(Snip { offset: 403, length: 1 },Snip { offset: 403, length: 1 }),
1855 SourceEvent::Char('g').localize(Snip { offset: 404, length: 1 },Snip { offset: 404, length: 1 }),
1856 SourceEvent::Char('"').localize(Snip { offset: 405, length: 1 },Snip { offset: 405, length: 1 }),
1857 SourceEvent::Char('>').localize(Snip { offset: 406, length: 1 },Snip { offset: 406, length: 1 }),
1858 ],
1859 }).localize(Snip { offset: 385, length: 22 },Snip { offset: 385, length: 22 }),
1860 ParserEvent::Char('T').localize(Snip { offset: 407, length: 1 },Snip { offset: 407, length: 1 }),
1861 ParserEvent::Char('h').localize(Snip { offset: 408, length: 1 },Snip { offset: 408, length: 1 }),
1862 ParserEvent::Char('e').localize(Snip { offset: 409, length: 1 },Snip { offset: 409, length: 1 }),
1863 ParserEvent::Char('r').localize(Snip { offset: 410, length: 1 },Snip { offset: 410, length: 1 }),
1864 ParserEvent::Char('e').localize(Snip { offset: 411, length: 1 },Snip { offset: 411, length: 1 }),
1865 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 412, length: 1 },Snip { offset: 412, length: 1 }),
1866 ParserEvent::Char('i').localize(Snip { offset: 413, length: 1 },Snip { offset: 413, length: 1 }),
1867 ParserEvent::Char('s').localize(Snip { offset: 414, length: 1 },Snip { offset: 414, length: 1 }),
1868 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 415, length: 1 },Snip { offset: 415, length: 1 }),
1869 ParserEvent::Char('o').localize(Snip { offset: 416, length: 1 },Snip { offset: 416, length: 1 }),
1870 ParserEvent::Char('n').localize(Snip { offset: 417, length: 1 },Snip { offset: 417, length: 1 }),
1871 ParserEvent::Char('l').localize(Snip { offset: 418, length: 1 },Snip { offset: 418, length: 1 }),
1872 ParserEvent::Char('y').localize(Snip { offset: 419, length: 1 },Snip { offset: 419, length: 1 }),
1873 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 420, length: 1 },Snip { offset: 420, length: 1 }),
1874 ParserEvent::Char('o').localize(Snip { offset: 421, length: 1 },Snip { offset: 421, length: 1 }),
1875 ParserEvent::Char('n').localize(Snip { offset: 422, length: 1 },Snip { offset: 422, length: 1 }),
1876 ParserEvent::Char('e').localize(Snip { offset: 423, length: 1 },Snip { offset: 423, length: 1 }),
1877 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 424, length: 1 },Snip { offset: 424, length: 1 }),
1878 ParserEvent::Char('s').localize(Snip { offset: 425, length: 1 },Snip { offset: 425, length: 1 }),
1879 ParserEvent::Char('e').localize(Snip { offset: 426, length: 1 },Snip { offset: 426, length: 1 }),
1880 ParserEvent::Char('t').localize(Snip { offset: 427, length: 1 },Snip { offset: 427, length: 1 }),
1881 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 428, length: 1 },Snip { offset: 428, length: 1 }),
1882 ParserEvent::Char('o').localize(Snip { offset: 429, length: 1 },Snip { offset: 429, length: 1 }),
1883 ParserEvent::Char('f').localize(Snip { offset: 430, length: 1 },Snip { offset: 430, length: 1 }),
1884 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 431, length: 1 },Snip { offset: 431, length: 1 }),
1885 ParserEvent::Char('s').localize(Snip { offset: 432, length: 1 },Snip { offset: 432, length: 1 }),
1886 ParserEvent::Char('t').localize(Snip { offset: 433, length: 1 },Snip { offset: 433, length: 1 }),
1887 ParserEvent::Char('a').localize(Snip { offset: 434, length: 1 },Snip { offset: 434, length: 1 }),
1888 ParserEvent::Char('t').localize(Snip { offset: 435, length: 1 },Snip { offset: 435, length: 1 }),
1889 ParserEvent::Char('e').localize(Snip { offset: 436, length: 1 },Snip { offset: 436, length: 1 }),
1890 ParserEvent::Char('s').localize(Snip { offset: 437, length: 1 },Snip { offset: 437, length: 1 }),
1891 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 438, length: 1 },Snip { offset: 438, length: 1 }),
1892 ParserEvent::Char('f').localize(Snip { offset: 439, length: 1 },Snip { offset: 439, length: 1 }),
1893 ParserEvent::Char('o').localize(Snip { offset: 440, length: 1 },Snip { offset: 440, length: 1 }),
1894 ParserEvent::Char('r').localize(Snip { offset: 441, length: 1 },Snip { offset: 441, length: 1 }),
1895 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 442, length: 1 },Snip { offset: 442, length: 1 }),
1896 ParserEvent::Char('t').localize(Snip { offset: 443, length: 1 },Snip { offset: 443, length: 1 }),
1897 ParserEvent::Char('h').localize(Snip { offset: 444, length: 1 },Snip { offset: 444, length: 1 }),
1898 ParserEvent::Char('e').localize(Snip { offset: 445, length: 1 },Snip { offset: 445, length: 1 }),
1899 ParserEvent::Breaker(Breaker::Line).localize(Snip { offset: 446, length: 3 },Snip { offset: 446, length: 3 }),
1900 ParserEvent::Char('t').localize(Snip { offset: 449, length: 1 },Snip { offset: 449, length: 1 }),
1901 ParserEvent::Char('o').localize(Snip { offset: 450, length: 1 },Snip { offset: 450, length: 1 }),
1902 ParserEvent::Char('k').localize(Snip { offset: 451, length: 1 },Snip { offset: 451, length: 1 }),
1903 ParserEvent::Char('e').localize(Snip { offset: 452, length: 1 },Snip { offset: 452, length: 1 }),
1904 ParserEvent::Char('n').localize(Snip { offset: 453, length: 1 },Snip { offset: 453, length: 1 }),
1905 ParserEvent::Char('i').localize(Snip { offset: 454, length: 1 },Snip { offset: 454, length: 1 }),
1906 ParserEvent::Char('z').localize(Snip { offset: 455, length: 1 },Snip { offset: 455, length: 1 }),
1907 ParserEvent::Char('e').localize(Snip { offset: 456, length: 1 },Snip { offset: 456, length: 1 }),
1908 ParserEvent::Char('r').localize(Snip { offset: 457, length: 1 },Snip { offset: 457, length: 1 }),
1909 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 458, length: 1 },Snip { offset: 458, length: 1 }),
1910 ParserEvent::Char('s').localize(Snip { offset: 459, length: 1 },Snip { offset: 459, length: 1 }),
1911 ParserEvent::Char('t').localize(Snip { offset: 460, length: 1 },Snip { offset: 460, length: 1 }),
1912 ParserEvent::Char('a').localize(Snip { offset: 461, length: 1 },Snip { offset: 461, length: 1 }),
1913 ParserEvent::Char('g').localize(Snip { offset: 462, length: 1 },Snip { offset: 462, length: 1 }),
1914 ParserEvent::Char('e').localize(Snip { offset: 463, length: 1 },Snip { offset: 463, length: 1 }),
1915 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 464, length: 1 },Snip { offset: 464, length: 1 }),
1916 ParserEvent::Char('a').localize(Snip { offset: 465, length: 1 },Snip { offset: 465, length: 1 }),
1917 ParserEvent::Char('n').localize(Snip { offset: 466, length: 1 },Snip { offset: 466, length: 1 }),
1918 ParserEvent::Char('d').localize(Snip { offset: 467, length: 1 },Snip { offset: 467, length: 1 }),
1919 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 468, length: 1 },Snip { offset: 468, length: 1 }),
1920 ParserEvent::Char('t').localize(Snip { offset: 469, length: 1 },Snip { offset: 469, length: 1 }),
1921 ParserEvent::Char('h').localize(Snip { offset: 470, length: 1 },Snip { offset: 470, length: 1 }),
1922 ParserEvent::Char('e').localize(Snip { offset: 471, length: 1 },Snip { offset: 471, length: 1 }),
1923 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 472, length: 1 },Snip { offset: 472, length: 1 }),
1924 ParserEvent::Char('t').localize(Snip { offset: 473, length: 1 },Snip { offset: 473, length: 1 }),
1925 ParserEvent::Char('r').localize(Snip { offset: 474, length: 1 },Snip { offset: 474, length: 1 }),
1926 ParserEvent::Char('e').localize(Snip { offset: 475, length: 1 },Snip { offset: 475, length: 1 }),
1927 ParserEvent::Char('e').localize(Snip { offset: 476, length: 1 },Snip { offset: 476, length: 1 }),
1928 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 477, length: 1 },Snip { offset: 477, length: 1 }),
1929 ParserEvent::Char('c').localize(Snip { offset: 478, length: 1 },Snip { offset: 478, length: 1 }),
1930 ParserEvent::Char('o').localize(Snip { offset: 479, length: 1 },Snip { offset: 479, length: 1 }),
1931 ParserEvent::Char('n').localize(Snip { offset: 480, length: 1 },Snip { offset: 480, length: 1 }),
1932 ParserEvent::Char('s').localize(Snip { offset: 481, length: 1 },Snip { offset: 481, length: 1 }),
1933 ParserEvent::Char('t').localize(Snip { offset: 482, length: 1 },Snip { offset: 482, length: 1 }),
1934 ParserEvent::Char('r').localize(Snip { offset: 483, length: 1 },Snip { offset: 483, length: 1 }),
1935 ParserEvent::Char('u').localize(Snip { offset: 484, length: 1 },Snip { offset: 484, length: 1 }),
1936 ParserEvent::Char('c').localize(Snip { offset: 485, length: 1 },Snip { offset: 485, length: 1 }),
1937 ParserEvent::Char('t').localize(Snip { offset: 486, length: 1 },Snip { offset: 486, length: 1 }),
1938 ParserEvent::Char('i').localize(Snip { offset: 487, length: 1 },Snip { offset: 487, length: 1 }),
1939 ParserEvent::Char('o').localize(Snip { offset: 488, length: 1 },Snip { offset: 488, length: 1 }),
1940 ParserEvent::Char('n').localize(Snip { offset: 489, length: 1 },Snip { offset: 489, length: 1 }),
1941 ParserEvent::Breaker(Breaker::Space).localize(Snip { offset: 490, length: 1 },Snip { offset: 490, length: 1 }),
1942 ParserEvent::Char('s').localize(Snip { offset: 491, length: 1 },Snip { offset: 491, length: 1 }),
1943 ParserEvent::Char('t').localize(Snip { offset: 492, length: 1 },Snip { offset: 492, length: 1 }),
1944 ParserEvent::Char('a').localize(Snip { offset: 493, length: 1 },Snip { offset: 493, length: 1 }),
1945 ParserEvent::Char('g').localize(Snip { offset: 494, length: 1 },Snip { offset: 494, length: 1 }),
1946 ParserEvent::Char('e').localize(Snip { offset: 495, length: 1 },Snip { offset: 495, length: 1 }),
1947 ParserEvent::Char('.').localize(Snip { offset: 496, length: 1 },Snip { offset: 496, length: 1 }),
1948 ParserEvent::Char('.').localize(Snip { offset: 497, length: 1 },Snip { offset: 497, length: 1 }),
1949 ParserEvent::Char('.').localize(Snip { offset: 498, length: 1 },Snip { offset: 498, length: 1 }),
1950 ParserEvent::Parsed(Tag {
1951 name: TagName::P, closing: Closing::Close, attributes: OptVec::None,
1952 begin: ().localize(Snip { offset: 499, length: 1 },Snip { offset: 499, length: 1 }),
1953 end: ().localize(Snip { offset: 502, length: 1 },Snip { offset: 502, length: 1 }),
1954 raw: vec![
1955 SourceEvent::Char('<').localize(Snip { offset: 499, length: 1 },Snip { offset: 499, length: 1 }),
1956 SourceEvent::Char('/').localize(Snip { offset: 500, length: 1 },Snip { offset: 500, length: 1 }),
1957 SourceEvent::Char('p').localize(Snip { offset: 501, length: 1 },Snip { offset: 501, length: 1 }),
1958 SourceEvent::Char('>').localize(Snip { offset: 502, length: 1 },Snip { offset: 502, length: 1 }),
1959 ],
1960 }).localize(Snip { offset: 499, length: 4 },Snip { offset: 499, length: 4 }),
1961 ].into_iter();
1962
1963 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
1964 match res_iter.next() {
1974 Some(ev) => {
1975 println!("Parser: {:?}",local_event);
1976 println!("Result: {:?}",ev);
1977 assert_eq!(local_event,ev);
1991 },
1992 None => {
1993 panic!("parser has more events then test result");
1994 },
1995 }
1996 }
1997 }
1998
1999 #[test]
2000 fn no_tag() {
2001 let mut src = "#include<iostream>\nusing namespace std;\nint main(){\ncout<<”Hello world!”<<endl;\nreturn 0;\n}\nOutput: Hello world!\n".into_source();
2002 let mut parser = Builder::new().create();
2003
2004 let mut res_iter = [
2005 ParserEvent::Char('#').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
2006 ParserEvent::Char('i').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
2007 ParserEvent::Char('n').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
2008 ParserEvent::Char('c').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
2009 ParserEvent::Char('l').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
2010 ParserEvent::Char('u').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
2011 ParserEvent::Char('d').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
2012 ParserEvent::Char('e').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
2013 ParserEvent::Parsed(Tag {
2014 name: TagName::Other("iostream".to_string()), closing: Closing::Open, attributes: OptVec::None,
2015 begin: ().localize(Snip { offset: 8, length: 1 }, Snip { offset: 8, length: 1 }),
2016 end: ().localize(Snip { offset: 17, length: 1 }, Snip { offset: 17, length: 1 }),
2017 raw: vec![
2018 SourceEvent::Char('<').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
2019 SourceEvent::Char('i').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
2020 SourceEvent::Char('o').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
2021 SourceEvent::Char('s').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
2022 SourceEvent::Char('t').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
2023 SourceEvent::Char('r').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
2024 SourceEvent::Char('e').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
2025 SourceEvent::Char('a').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
2026 SourceEvent::Char('m').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
2027 SourceEvent::Char('>').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
2028 ],
2029 }).localize(Snip { offset: 8, length: 10 },Snip { offset: 8, length: 10 }),
2030 ParserEvent::Char('\n').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
2031 ParserEvent::Char('u').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
2032 ParserEvent::Char('s').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
2033 ParserEvent::Char('i').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
2034 ParserEvent::Char('n').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 1 }),
2035 ParserEvent::Char('g').localize(Snip { offset: 23, length: 1 },Snip { offset: 23, length: 1 }),
2036 ParserEvent::Char(' ').localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
2037 ParserEvent::Char('n').localize(Snip { offset: 25, length: 1 },Snip { offset: 25, length: 1 }),
2038 ParserEvent::Char('a').localize(Snip { offset: 26, length: 1 },Snip { offset: 26, length: 1 }),
2039 ParserEvent::Char('m').localize(Snip { offset: 27, length: 1 },Snip { offset: 27, length: 1 }),
2040 ParserEvent::Char('e').localize(Snip { offset: 28, length: 1 },Snip { offset: 28, length: 1 }),
2041 ParserEvent::Char('s').localize(Snip { offset: 29, length: 1 },Snip { offset: 29, length: 1 }),
2042 ParserEvent::Char('p').localize(Snip { offset: 30, length: 1 },Snip { offset: 30, length: 1 }),
2043 ParserEvent::Char('a').localize(Snip { offset: 31, length: 1 },Snip { offset: 31, length: 1 }),
2044 ParserEvent::Char('c').localize(Snip { offset: 32, length: 1 },Snip { offset: 32, length: 1 }),
2045 ParserEvent::Char('e').localize(Snip { offset: 33, length: 1 },Snip { offset: 33, length: 1 }),
2046 ParserEvent::Char(' ').localize(Snip { offset: 34, length: 1 },Snip { offset: 34, length: 1 }),
2047 ParserEvent::Char('s').localize(Snip { offset: 35, length: 1 },Snip { offset: 35, length: 1 }),
2048 ParserEvent::Char('t').localize(Snip { offset: 36, length: 1 },Snip { offset: 36, length: 1 }),
2049 ParserEvent::Char('d').localize(Snip { offset: 37, length: 1 },Snip { offset: 37, length: 1 }),
2050 ParserEvent::Char(';').localize(Snip { offset: 38, length: 1 },Snip { offset: 38, length: 1 }),
2051 ParserEvent::Char('\n').localize(Snip { offset: 39, length: 1 },Snip { offset: 39, length: 1 }),
2052 ParserEvent::Char('i').localize(Snip { offset: 40, length: 1 },Snip { offset: 40, length: 1 }),
2053 ParserEvent::Char('n').localize(Snip { offset: 41, length: 1 },Snip { offset: 41, length: 1 }),
2054 ParserEvent::Char('t').localize(Snip { offset: 42, length: 1 },Snip { offset: 42, length: 1 }),
2055 ParserEvent::Char(' ').localize(Snip { offset: 43, length: 1 },Snip { offset: 43, length: 1 }),
2056 ParserEvent::Char('m').localize(Snip { offset: 44, length: 1 },Snip { offset: 44, length: 1 }),
2057 ParserEvent::Char('a').localize(Snip { offset: 45, length: 1 },Snip { offset: 45, length: 1 }),
2058 ParserEvent::Char('i').localize(Snip { offset: 46, length: 1 },Snip { offset: 46, length: 1 }),
2059 ParserEvent::Char('n').localize(Snip { offset: 47, length: 1 },Snip { offset: 47, length: 1 }),
2060 ParserEvent::Char('(').localize(Snip { offset: 48, length: 1 },Snip { offset: 48, length: 1 }),
2061 ParserEvent::Char(')').localize(Snip { offset: 49, length: 1 },Snip { offset: 49, length: 1 }),
2062 ParserEvent::Char('{').localize(Snip { offset: 50, length: 1 },Snip { offset: 50, length: 1 }),
2063 ParserEvent::Char('\n').localize(Snip { offset: 51, length: 1 },Snip { offset: 51, length: 1 }),
2064 ParserEvent::Char('c').localize(Snip { offset: 52, length: 1 },Snip { offset: 52, length: 1 }),
2065 ParserEvent::Char('o').localize(Snip { offset: 53, length: 1 },Snip { offset: 53, length: 1 }),
2066 ParserEvent::Char('u').localize(Snip { offset: 54, length: 1 },Snip { offset: 54, length: 1 }),
2067 ParserEvent::Char('t').localize(Snip { offset: 55, length: 1 },Snip { offset: 55, length: 1 }),
2068 ParserEvent::Char('<').localize(Snip { offset: 56, length: 1 },Snip { offset: 56, length: 1 }),
2069 ParserEvent::Char('<').localize(Snip { offset: 57, length: 1 },Snip { offset: 57, length: 1 }),
2070 ParserEvent::Char('”').localize(Snip { offset: 58, length: 1 },Snip { offset: 58, length: 3 }),
2071 ParserEvent::Char('H').localize(Snip { offset: 59, length: 1 },Snip { offset: 61, length: 1 }),
2072 ParserEvent::Char('e').localize(Snip { offset: 60, length: 1 },Snip { offset: 62, length: 1 }),
2073 ParserEvent::Char('l').localize(Snip { offset: 61, length: 1 },Snip { offset: 63, length: 1 }),
2074 ParserEvent::Char('l').localize(Snip { offset: 62, length: 1 },Snip { offset: 64, length: 1 }),
2075 ParserEvent::Char('o').localize(Snip { offset: 63, length: 1 },Snip { offset: 65, length: 1 }),
2076 ParserEvent::Char(' ').localize(Snip { offset: 64, length: 1 },Snip { offset: 66, length: 1 }),
2077 ParserEvent::Char('w').localize(Snip { offset: 65, length: 1 },Snip { offset: 67, length: 1 }),
2078 ParserEvent::Char('o').localize(Snip { offset: 66, length: 1 },Snip { offset: 68, length: 1 }),
2079 ParserEvent::Char('r').localize(Snip { offset: 67, length: 1 },Snip { offset: 69, length: 1 }),
2080 ParserEvent::Char('l').localize(Snip { offset: 68, length: 1 },Snip { offset: 70, length: 1 }),
2081 ParserEvent::Char('d').localize(Snip { offset: 69, length: 1 },Snip { offset: 71, length: 1 }),
2082 ParserEvent::Char('!').localize(Snip { offset: 70, length: 1 },Snip { offset: 72, length: 1 }),
2083 ParserEvent::Char('”').localize(Snip { offset: 71, length: 1 },Snip { offset: 73, length: 3 }),
2084 ParserEvent::Char('<').localize(Snip { offset: 72, length: 1 },Snip { offset: 76, length: 1 }),
2085 ].into_iter();
2086
2087 let eof = vec![
2088 SourceEvent::Char('<').localize(Snip { offset: 73, length: 1 },Snip { offset: 77, length: 1 }),
2089 SourceEvent::Char('e').localize(Snip { offset: 74, length: 1 },Snip { offset: 78, length: 1 }),
2090 SourceEvent::Char('n').localize(Snip { offset: 75, length: 1 },Snip { offset: 79, length: 1 }),
2091 SourceEvent::Char('d').localize(Snip { offset: 76, length: 1 },Snip { offset: 80, length: 1 }),
2092 SourceEvent::Char('l').localize(Snip { offset: 77, length: 1 },Snip { offset: 81, length: 1 }),
2093 SourceEvent::Char(';').localize(Snip { offset: 78, length: 1 },Snip { offset: 82, length: 1 }),
2094 SourceEvent::Char('\n').localize(Snip { offset: 79, length: 1 },Snip { offset: 83, length: 1 }),
2095 SourceEvent::Char('r').localize(Snip { offset: 80, length: 1 },Snip { offset: 84, length: 1 }),
2096 SourceEvent::Char('e').localize(Snip { offset: 81, length: 1 },Snip { offset: 85, length: 1 }),
2097 SourceEvent::Char('t').localize(Snip { offset: 82, length: 1 },Snip { offset: 86, length: 1 }),
2098 SourceEvent::Char('u').localize(Snip { offset: 83, length: 1 },Snip { offset: 87, length: 1 }),
2099 SourceEvent::Char('r').localize(Snip { offset: 84, length: 1 },Snip { offset: 88, length: 1 }),
2100 SourceEvent::Char('n').localize(Snip { offset: 85, length: 1 },Snip { offset: 89, length: 1 }),
2101 SourceEvent::Char(' ').localize(Snip { offset: 86, length: 1 },Snip { offset: 90, length: 1 }),
2102 SourceEvent::Char('0').localize(Snip { offset: 87, length: 1 },Snip { offset: 91, length: 1 }),
2103 SourceEvent::Char(';').localize(Snip { offset: 88, length: 1 },Snip { offset: 92, length: 1 }),
2104 SourceEvent::Char('\n').localize(Snip { offset: 89, length: 1 },Snip { offset: 93, length: 1 }),
2105 SourceEvent::Char('}').localize(Snip { offset: 90, length: 1 },Snip { offset: 94, length: 1 }),
2106 SourceEvent::Char('\n').localize(Snip { offset: 91, length: 1 },Snip { offset: 95, length: 1 }),
2107 SourceEvent::Char('O').localize(Snip { offset: 92, length: 1 },Snip { offset: 96, length: 1 }),
2108 SourceEvent::Char('u').localize(Snip { offset: 93, length: 1 },Snip { offset: 97, length: 1 }),
2109 SourceEvent::Char('t').localize(Snip { offset: 94, length: 1 },Snip { offset: 98, length: 1 }),
2110 SourceEvent::Char('p').localize(Snip { offset: 95, length: 1 },Snip { offset: 99, length: 1 }),
2111 SourceEvent::Char('u').localize(Snip { offset: 96, length: 1 },Snip { offset: 100, length: 1 }),
2112 SourceEvent::Char('t').localize(Snip { offset: 97, length: 1 },Snip { offset: 101, length: 1 }),
2113 SourceEvent::Char(':').localize(Snip { offset: 98, length: 1 },Snip { offset: 102, length: 1 }),
2114 SourceEvent::Char(' ').localize(Snip { offset: 99, length: 1 },Snip { offset: 103, length: 1 }),
2115 SourceEvent::Char('H').localize(Snip { offset: 100, length: 1 },Snip { offset: 104, length: 1 }),
2116 SourceEvent::Char('e').localize(Snip { offset: 101, length: 1 },Snip { offset: 105, length: 1 }),
2117 SourceEvent::Char('l').localize(Snip { offset: 102, length: 1 },Snip { offset: 106, length: 1 }),
2118 SourceEvent::Char('l').localize(Snip { offset: 103, length: 1 },Snip { offset: 107, length: 1 }),
2119 SourceEvent::Char('o').localize(Snip { offset: 104, length: 1 },Snip { offset: 108, length: 1 }),
2120 SourceEvent::Char(' ').localize(Snip { offset: 105, length: 1 },Snip { offset: 109, length: 1 }),
2121 SourceEvent::Char('w').localize(Snip { offset: 106, length: 1 },Snip { offset: 110, length: 1 }),
2122 SourceEvent::Char('o').localize(Snip { offset: 107, length: 1 },Snip { offset: 111, length: 1 }),
2123 SourceEvent::Char('r').localize(Snip { offset: 108, length: 1 },Snip { offset: 112, length: 1 }),
2124 SourceEvent::Char('l').localize(Snip { offset: 109, length: 1 },Snip { offset: 113, length: 1 }),
2125 SourceEvent::Char('d').localize(Snip { offset: 110, length: 1 },Snip { offset: 114, length: 1 }),
2126 SourceEvent::Char('!').localize(Snip { offset: 111, length: 1 },Snip { offset: 115, length: 1 }),
2127 SourceEvent::Char('\n').localize(Snip { offset: 112, length: 1 },Snip { offset: 116, length: 1 }),
2128 ];
2129
2130 while let Some(local_event) = match parser.next_event(&mut src) {
2131 Ok(ope) => ope,
2132 Err(e) => match e {
2133 Error::EofInTag(raw) => {
2134 match raw.len() != eof.len() {
2135 true => panic!("parser and eof_result differs in size"),
2136 false => for (d,e) in raw.into_iter().zip(eof.iter()) {
2137 println!("Parser: {:?}",d);
2138 println!("Result: {:?}",e);
2139 assert_eq!(d,*e);
2140 }
2141 }
2142
2143 None
2144 },
2145 Error::EndBeforeBegin => panic!("{:?}",e),
2146 Error::NoBegin => panic!("{:?}",e),
2147 },
2148 } {
2149 match res_iter.next() {
2160 Some(ev) => {
2161 println!("Parser: {:?}",local_event);
2162 println!("Result: {:?}",ev);
2163 assert_eq!(local_event,ev);
2164 },
2165 None => {
2166 panic!("parser has more events then test result");
2167 },
2168 }
2169 }
2170 }
2171
2172 #[test]
2173 fn auto_detect_01() {
2174 let mut src = "#include<iostream>\nusing namespace std;\nint main(){\ncout<<”Hello world!”<<endl;\nreturn 0;\n}\nOutput: Hello world!\n".into_source();
2175 let mut parser = Builder::auto_detect().create();
2176
2177 let mut res_iter = [
2178 ParserEvent::Char('#').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
2179 ParserEvent::Char('i').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
2180 ParserEvent::Char('n').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
2181 ParserEvent::Char('c').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
2182 ParserEvent::Char('l').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
2183 ParserEvent::Char('u').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
2184 ParserEvent::Char('d').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
2185 ParserEvent::Char('e').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
2186 ParserEvent::Char('<').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
2187 ParserEvent::Char('i').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
2188 ParserEvent::Char('o').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
2189 ParserEvent::Char('s').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
2190 ParserEvent::Char('t').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
2191 ParserEvent::Char('r').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
2192 ParserEvent::Char('e').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
2193 ParserEvent::Char('a').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 1 }),
2194 ParserEvent::Char('m').localize(Snip { offset: 16, length: 1 },Snip { offset: 16, length: 1 }),
2195 ParserEvent::Char('>').localize(Snip { offset: 17, length: 1 },Snip { offset: 17, length: 1 }),
2196 ParserEvent::Char('\n').localize(Snip { offset: 18, length: 1 },Snip { offset: 18, length: 1 }),
2197 ParserEvent::Char('u').localize(Snip { offset: 19, length: 1 },Snip { offset: 19, length: 1 }),
2198 ParserEvent::Char('s').localize(Snip { offset: 20, length: 1 },Snip { offset: 20, length: 1 }),
2199 ParserEvent::Char('i').localize(Snip { offset: 21, length: 1 },Snip { offset: 21, length: 1 }),
2200 ParserEvent::Char('n').localize(Snip { offset: 22, length: 1 },Snip { offset: 22, length: 1 }),
2201 ParserEvent::Char('g').localize(Snip { offset: 23, length: 1 },Snip { offset: 23, length: 1 }),
2202 ParserEvent::Char(' ').localize(Snip { offset: 24, length: 1 },Snip { offset: 24, length: 1 }),
2203 ParserEvent::Char('n').localize(Snip { offset: 25, length: 1 },Snip { offset: 25, length: 1 }),
2204 ParserEvent::Char('a').localize(Snip { offset: 26, length: 1 },Snip { offset: 26, length: 1 }),
2205 ParserEvent::Char('m').localize(Snip { offset: 27, length: 1 },Snip { offset: 27, length: 1 }),
2206 ParserEvent::Char('e').localize(Snip { offset: 28, length: 1 },Snip { offset: 28, length: 1 }),
2207 ParserEvent::Char('s').localize(Snip { offset: 29, length: 1 },Snip { offset: 29, length: 1 }),
2208 ParserEvent::Char('p').localize(Snip { offset: 30, length: 1 },Snip { offset: 30, length: 1 }),
2209 ParserEvent::Char('a').localize(Snip { offset: 31, length: 1 },Snip { offset: 31, length: 1 }),
2210 ParserEvent::Char('c').localize(Snip { offset: 32, length: 1 },Snip { offset: 32, length: 1 }),
2211 ParserEvent::Char('e').localize(Snip { offset: 33, length: 1 },Snip { offset: 33, length: 1 }),
2212 ParserEvent::Char(' ').localize(Snip { offset: 34, length: 1 },Snip { offset: 34, length: 1 }),
2213 ParserEvent::Char('s').localize(Snip { offset: 35, length: 1 },Snip { offset: 35, length: 1 }),
2214 ParserEvent::Char('t').localize(Snip { offset: 36, length: 1 },Snip { offset: 36, length: 1 }),
2215 ParserEvent::Char('d').localize(Snip { offset: 37, length: 1 },Snip { offset: 37, length: 1 }),
2216 ParserEvent::Char(';').localize(Snip { offset: 38, length: 1 },Snip { offset: 38, length: 1 }),
2217 ParserEvent::Char('\n').localize(Snip { offset: 39, length: 1 },Snip { offset: 39, length: 1 }),
2218 ParserEvent::Char('i').localize(Snip { offset: 40, length: 1 },Snip { offset: 40, length: 1 }),
2219 ParserEvent::Char('n').localize(Snip { offset: 41, length: 1 },Snip { offset: 41, length: 1 }),
2220 ParserEvent::Char('t').localize(Snip { offset: 42, length: 1 },Snip { offset: 42, length: 1 }),
2221 ParserEvent::Char(' ').localize(Snip { offset: 43, length: 1 },Snip { offset: 43, length: 1 }),
2222 ParserEvent::Char('m').localize(Snip { offset: 44, length: 1 },Snip { offset: 44, length: 1 }),
2223 ParserEvent::Char('a').localize(Snip { offset: 45, length: 1 },Snip { offset: 45, length: 1 }),
2224 ParserEvent::Char('i').localize(Snip { offset: 46, length: 1 },Snip { offset: 46, length: 1 }),
2225 ParserEvent::Char('n').localize(Snip { offset: 47, length: 1 },Snip { offset: 47, length: 1 }),
2226 ParserEvent::Char('(').localize(Snip { offset: 48, length: 1 },Snip { offset: 48, length: 1 }),
2227 ParserEvent::Char(')').localize(Snip { offset: 49, length: 1 },Snip { offset: 49, length: 1 }),
2228 ParserEvent::Char('{').localize(Snip { offset: 50, length: 1 },Snip { offset: 50, length: 1 }),
2229 ParserEvent::Char('\n').localize(Snip { offset: 51, length: 1 },Snip { offset: 51, length: 1 }),
2230 ParserEvent::Char('c').localize(Snip { offset: 52, length: 1 },Snip { offset: 52, length: 1 }),
2231 ParserEvent::Char('o').localize(Snip { offset: 53, length: 1 },Snip { offset: 53, length: 1 }),
2232 ParserEvent::Char('u').localize(Snip { offset: 54, length: 1 },Snip { offset: 54, length: 1 }),
2233 ParserEvent::Char('t').localize(Snip { offset: 55, length: 1 },Snip { offset: 55, length: 1 }),
2234 ParserEvent::Char('<').localize(Snip { offset: 56, length: 1 },Snip { offset: 56, length: 1 }),
2235 ParserEvent::Char('<').localize(Snip { offset: 57, length: 1 },Snip { offset: 57, length: 1 }),
2236 ParserEvent::Char('”').localize(Snip { offset: 58, length: 1 },Snip { offset: 58, length: 3 }),
2237 ParserEvent::Char('H').localize(Snip { offset: 59, length: 1 },Snip { offset: 61, length: 1 }),
2238 ParserEvent::Char('e').localize(Snip { offset: 60, length: 1 },Snip { offset: 62, length: 1 }),
2239 ParserEvent::Char('l').localize(Snip { offset: 61, length: 1 },Snip { offset: 63, length: 1 }),
2240 ParserEvent::Char('l').localize(Snip { offset: 62, length: 1 },Snip { offset: 64, length: 1 }),
2241 ParserEvent::Char('o').localize(Snip { offset: 63, length: 1 },Snip { offset: 65, length: 1 }),
2242 ParserEvent::Char(' ').localize(Snip { offset: 64, length: 1 },Snip { offset: 66, length: 1 }),
2243 ParserEvent::Char('w').localize(Snip { offset: 65, length: 1 },Snip { offset: 67, length: 1 }),
2244 ParserEvent::Char('o').localize(Snip { offset: 66, length: 1 },Snip { offset: 68, length: 1 }),
2245 ParserEvent::Char('r').localize(Snip { offset: 67, length: 1 },Snip { offset: 69, length: 1 }),
2246 ParserEvent::Char('l').localize(Snip { offset: 68, length: 1 },Snip { offset: 70, length: 1 }),
2247 ParserEvent::Char('d').localize(Snip { offset: 69, length: 1 },Snip { offset: 71, length: 1 }),
2248 ParserEvent::Char('!').localize(Snip { offset: 70, length: 1 },Snip { offset: 72, length: 1 }),
2249 ParserEvent::Char('”').localize(Snip { offset: 71, length: 1 },Snip { offset: 73, length: 3 }),
2250 ParserEvent::Char('<').localize(Snip { offset: 72, length: 1 },Snip { offset: 76, length: 1 }),
2251 ParserEvent::Char('<').localize(Snip { offset: 73, length: 1 },Snip { offset: 77, length: 1 }),
2252 ParserEvent::Char('e').localize(Snip { offset: 74, length: 1 },Snip { offset: 78, length: 1 }),
2253 ParserEvent::Char('n').localize(Snip { offset: 75, length: 1 },Snip { offset: 79, length: 1 }),
2254 ParserEvent::Char('d').localize(Snip { offset: 76, length: 1 },Snip { offset: 80, length: 1 }),
2255 ParserEvent::Char('l').localize(Snip { offset: 77, length: 1 },Snip { offset: 81, length: 1 }),
2256 ParserEvent::Char(';').localize(Snip { offset: 78, length: 1 },Snip { offset: 82, length: 1 }),
2257 ParserEvent::Char('\n').localize(Snip { offset: 79, length: 1 },Snip { offset: 83, length: 1 }),
2258 ParserEvent::Char('r').localize(Snip { offset: 80, length: 1 },Snip { offset: 84, length: 1 }),
2259 ParserEvent::Char('e').localize(Snip { offset: 81, length: 1 },Snip { offset: 85, length: 1 }),
2260 ParserEvent::Char('t').localize(Snip { offset: 82, length: 1 },Snip { offset: 86, length: 1 }),
2261 ParserEvent::Char('u').localize(Snip { offset: 83, length: 1 },Snip { offset: 87, length: 1 }),
2262 ParserEvent::Char('r').localize(Snip { offset: 84, length: 1 },Snip { offset: 88, length: 1 }),
2263 ParserEvent::Char('n').localize(Snip { offset: 85, length: 1 },Snip { offset: 89, length: 1 }),
2264 ParserEvent::Char(' ').localize(Snip { offset: 86, length: 1 },Snip { offset: 90, length: 1 }),
2265 ParserEvent::Char('0').localize(Snip { offset: 87, length: 1 },Snip { offset: 91, length: 1 }),
2266 ParserEvent::Char(';').localize(Snip { offset: 88, length: 1 },Snip { offset: 92, length: 1 }),
2267 ParserEvent::Char('\n').localize(Snip { offset: 89, length: 1 },Snip { offset: 93, length: 1 }),
2268 ParserEvent::Char('}').localize(Snip { offset: 90, length: 1 },Snip { offset: 94, length: 1 }),
2269 ParserEvent::Char('\n').localize(Snip { offset: 91, length: 1 },Snip { offset: 95, length: 1 }),
2270 ParserEvent::Char('O').localize(Snip { offset: 92, length: 1 },Snip { offset: 96, length: 1 }),
2271 ParserEvent::Char('u').localize(Snip { offset: 93, length: 1 },Snip { offset: 97, length: 1 }),
2272 ParserEvent::Char('t').localize(Snip { offset: 94, length: 1 },Snip { offset: 98, length: 1 }),
2273 ParserEvent::Char('p').localize(Snip { offset: 95, length: 1 },Snip { offset: 99, length: 1 }),
2274 ParserEvent::Char('u').localize(Snip { offset: 96, length: 1 },Snip { offset: 100, length: 1 }),
2275 ParserEvent::Char('t').localize(Snip { offset: 97, length: 1 },Snip { offset: 101, length: 1 }),
2276 ParserEvent::Char(':').localize(Snip { offset: 98, length: 1 },Snip { offset: 102, length: 1 }),
2277 ParserEvent::Char(' ').localize(Snip { offset: 99, length: 1 },Snip { offset: 103, length: 1 }),
2278 ParserEvent::Char('H').localize(Snip { offset: 100, length: 1 },Snip { offset: 104, length: 1 }),
2279 ParserEvent::Char('e').localize(Snip { offset: 101, length: 1 },Snip { offset: 105, length: 1 }),
2280 ParserEvent::Char('l').localize(Snip { offset: 102, length: 1 },Snip { offset: 106, length: 1 }),
2281 ParserEvent::Char('l').localize(Snip { offset: 103, length: 1 },Snip { offset: 107, length: 1 }),
2282 ParserEvent::Char('o').localize(Snip { offset: 104, length: 1 },Snip { offset: 108, length: 1 }),
2283 ParserEvent::Char(' ').localize(Snip { offset: 105, length: 1 },Snip { offset: 109, length: 1 }),
2284 ParserEvent::Char('w').localize(Snip { offset: 106, length: 1 },Snip { offset: 110, length: 1 }),
2285 ParserEvent::Char('o').localize(Snip { offset: 107, length: 1 },Snip { offset: 111, length: 1 }),
2286 ParserEvent::Char('r').localize(Snip { offset: 108, length: 1 },Snip { offset: 112, length: 1 }),
2287 ParserEvent::Char('l').localize(Snip { offset: 109, length: 1 },Snip { offset: 113, length: 1 }),
2288 ParserEvent::Char('d').localize(Snip { offset: 110, length: 1 },Snip { offset: 114, length: 1 }),
2289 ParserEvent::Char('!').localize(Snip { offset: 111, length: 1 },Snip { offset: 115, length: 1 }),
2290 ParserEvent::Char('\n').localize(Snip { offset: 112, length: 1 },Snip { offset: 116, length: 1 }),
2291 ].into_iter();
2292
2293 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
2294 match res_iter.next() {
2305 Some(ev) => {
2306 println!("Parser: {:?}",local_event);
2307 println!("Result: {:?}",ev);
2308 assert_eq!(local_event,ev);
2309 },
2310 None => {
2311 panic!("parser has more events then test result");
2312 },
2313 }
2314 }
2315 }
2316
2317 #[test]
2318 fn corrupted_01() {
2319 let mut src = "<!--QuoteBegin-Информ|87079+Sep 3 2024, 15:56--><div class='quotetop'>Цитата(<a href=\"/?showuser=87079\" target=\"_blank\">Информ</a> @ Sep 3 2024, 15:56)</div><div class='quotemain'><!...".into_source();
2320 let mut parser = Builder::auto_detect()
2321 .eof_to_named_tag()
2322 .create();
2323
2324 let mut res_iter = [
2325 ParserEvent::Parsed(Tag {
2326 name: TagName::X(SpecTag::Excl), closing: Closing::Void, attributes: OptVec::None,
2327 begin: ().localize(Snip { offset: 0, length: 1 }, Snip { offset: 0, length: 1 }),
2328 end: ().localize(Snip { offset: 47, length: 1 }, Snip { offset: 53, length: 1 }),
2329 raw: vec![
2330 SourceEvent::Char('<').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 1 }),
2331 SourceEvent::Char('!').localize(Snip { offset: 1, length: 1 },Snip { offset: 1, length: 1 }),
2332 SourceEvent::Char('-').localize(Snip { offset: 2, length: 1 },Snip { offset: 2, length: 1 }),
2333 SourceEvent::Char('-').localize(Snip { offset: 3, length: 1 },Snip { offset: 3, length: 1 }),
2334 SourceEvent::Char('Q').localize(Snip { offset: 4, length: 1 },Snip { offset: 4, length: 1 }),
2335 SourceEvent::Char('u').localize(Snip { offset: 5, length: 1 },Snip { offset: 5, length: 1 }),
2336 SourceEvent::Char('o').localize(Snip { offset: 6, length: 1 },Snip { offset: 6, length: 1 }),
2337 SourceEvent::Char('t').localize(Snip { offset: 7, length: 1 },Snip { offset: 7, length: 1 }),
2338 SourceEvent::Char('e').localize(Snip { offset: 8, length: 1 },Snip { offset: 8, length: 1 }),
2339 SourceEvent::Char('B').localize(Snip { offset: 9, length: 1 },Snip { offset: 9, length: 1 }),
2340 SourceEvent::Char('e').localize(Snip { offset: 10, length: 1 },Snip { offset: 10, length: 1 }),
2341 SourceEvent::Char('g').localize(Snip { offset: 11, length: 1 },Snip { offset: 11, length: 1 }),
2342 SourceEvent::Char('i').localize(Snip { offset: 12, length: 1 },Snip { offset: 12, length: 1 }),
2343 SourceEvent::Char('n').localize(Snip { offset: 13, length: 1 },Snip { offset: 13, length: 1 }),
2344 SourceEvent::Char('-').localize(Snip { offset: 14, length: 1 },Snip { offset: 14, length: 1 }),
2345 SourceEvent::Char('И').localize(Snip { offset: 15, length: 1 },Snip { offset: 15, length: 2 }),
2346 SourceEvent::Char('н').localize(Snip { offset: 16, length: 1 },Snip { offset: 17, length: 2 }),
2347 SourceEvent::Char('ф').localize(Snip { offset: 17, length: 1 },Snip { offset: 19, length: 2 }),
2348 SourceEvent::Char('о').localize(Snip { offset: 18, length: 1 },Snip { offset: 21, length: 2 }),
2349 SourceEvent::Char('р').localize(Snip { offset: 19, length: 1 },Snip { offset: 23, length: 2 }),
2350 SourceEvent::Char('м').localize(Snip { offset: 20, length: 1 },Snip { offset: 25, length: 2 }),
2351 SourceEvent::Char('|').localize(Snip { offset: 21, length: 1 },Snip { offset: 27, length: 1 }),
2352 SourceEvent::Char('8').localize(Snip { offset: 22, length: 1 },Snip { offset: 28, length: 1 }),
2353 SourceEvent::Char('7').localize(Snip { offset: 23, length: 1 },Snip { offset: 29, length: 1 }),
2354 SourceEvent::Char('0').localize(Snip { offset: 24, length: 1 },Snip { offset: 30, length: 1 }),
2355 SourceEvent::Char('7').localize(Snip { offset: 25, length: 1 },Snip { offset: 31, length: 1 }),
2356 SourceEvent::Char('9').localize(Snip { offset: 26, length: 1 },Snip { offset: 32, length: 1 }),
2357 SourceEvent::Char('+').localize(Snip { offset: 27, length: 1 },Snip { offset: 33, length: 1 }),
2358 SourceEvent::Char('S').localize(Snip { offset: 28, length: 1 },Snip { offset: 34, length: 1 }),
2359 SourceEvent::Char('e').localize(Snip { offset: 29, length: 1 },Snip { offset: 35, length: 1 }),
2360 SourceEvent::Char('p').localize(Snip { offset: 30, length: 1 },Snip { offset: 36, length: 1 }),
2361 SourceEvent::Char(' ').localize(Snip { offset: 31, length: 1 },Snip { offset: 37, length: 1 }),
2362 SourceEvent::Char('3').localize(Snip { offset: 32, length: 1 },Snip { offset: 38, length: 1 }),
2363 SourceEvent::Char(' ').localize(Snip { offset: 33, length: 1 },Snip { offset: 39, length: 1 }),
2364 SourceEvent::Char('2').localize(Snip { offset: 34, length: 1 },Snip { offset: 40, length: 1 }),
2365 SourceEvent::Char('0').localize(Snip { offset: 35, length: 1 },Snip { offset: 41, length: 1 }),
2366 SourceEvent::Char('2').localize(Snip { offset: 36, length: 1 },Snip { offset: 42, length: 1 }),
2367 SourceEvent::Char('4').localize(Snip { offset: 37, length: 1 },Snip { offset: 43, length: 1 }),
2368 SourceEvent::Char(',').localize(Snip { offset: 38, length: 1 },Snip { offset: 44, length: 1 }),
2369 SourceEvent::Char(' ').localize(Snip { offset: 39, length: 1 },Snip { offset: 45, length: 1 }),
2370 SourceEvent::Char('1').localize(Snip { offset: 40, length: 1 },Snip { offset: 46, length: 1 }),
2371 SourceEvent::Char('5').localize(Snip { offset: 41, length: 1 },Snip { offset: 47, length: 1 }),
2372 SourceEvent::Char(':').localize(Snip { offset: 42, length: 1 },Snip { offset: 48, length: 1 }),
2373 SourceEvent::Char('5').localize(Snip { offset: 43, length: 1 },Snip { offset: 49, length: 1 }),
2374 SourceEvent::Char('6').localize(Snip { offset: 44, length: 1 },Snip { offset: 50, length: 1 }),
2375 SourceEvent::Char('-').localize(Snip { offset: 45, length: 1 },Snip { offset: 51, length: 1 }),
2376 SourceEvent::Char('-').localize(Snip { offset: 46, length: 1 },Snip { offset: 52, length: 1 }),
2377 SourceEvent::Char('>').localize(Snip { offset: 47, length: 1 },Snip { offset: 53, length: 1 }),
2378 ],
2379 }).localize(Snip { offset: 0, length: 48 },Snip { offset: 0, length: 54 }),
2380 ParserEvent::Parsed(Tag {
2381 name: TagName::Div, closing: Closing::Open, attributes: OptVec::None,
2382 begin: ().localize(Snip { offset: 48, length: 1 }, Snip { offset: 54, length: 1 }),
2383 end: ().localize(Snip { offset: 69, length: 1 }, Snip { offset: 75, length: 1 }),
2384 raw: vec![
2385 SourceEvent::Char('<').localize(Snip { offset: 48, length: 1 },Snip { offset: 54, length: 1 }),
2386 SourceEvent::Char('d').localize(Snip { offset: 49, length: 1 },Snip { offset: 55, length: 1 }),
2387 SourceEvent::Char('i').localize(Snip { offset: 50, length: 1 },Snip { offset: 56, length: 1 }),
2388 SourceEvent::Char('v').localize(Snip { offset: 51, length: 1 },Snip { offset: 57, length: 1 }),
2389 SourceEvent::Char(' ').localize(Snip { offset: 52, length: 1 },Snip { offset: 58, length: 1 }),
2390 SourceEvent::Char('c').localize(Snip { offset: 53, length: 1 },Snip { offset: 59, length: 1 }),
2391 SourceEvent::Char('l').localize(Snip { offset: 54, length: 1 },Snip { offset: 60, length: 1 }),
2392 SourceEvent::Char('a').localize(Snip { offset: 55, length: 1 },Snip { offset: 61, length: 1 }),
2393 SourceEvent::Char('s').localize(Snip { offset: 56, length: 1 },Snip { offset: 62, length: 1 }),
2394 SourceEvent::Char('s').localize(Snip { offset: 57, length: 1 },Snip { offset: 63, length: 1 }),
2395 SourceEvent::Char('=').localize(Snip { offset: 58, length: 1 },Snip { offset: 64, length: 1 }),
2396 SourceEvent::Char('\'').localize(Snip { offset: 59, length: 1 },Snip { offset: 65, length: 1 }),
2397 SourceEvent::Char('q').localize(Snip { offset: 60, length: 1 },Snip { offset: 66, length: 1 }),
2398 SourceEvent::Char('u').localize(Snip { offset: 61, length: 1 },Snip { offset: 67, length: 1 }),
2399 SourceEvent::Char('o').localize(Snip { offset: 62, length: 1 },Snip { offset: 68, length: 1 }),
2400 SourceEvent::Char('t').localize(Snip { offset: 63, length: 1 },Snip { offset: 69, length: 1 }),
2401 SourceEvent::Char('e').localize(Snip { offset: 64, length: 1 },Snip { offset: 70, length: 1 }),
2402 SourceEvent::Char('t').localize(Snip { offset: 65, length: 1 },Snip { offset: 71, length: 1 }),
2403 SourceEvent::Char('o').localize(Snip { offset: 66, length: 1 },Snip { offset: 72, length: 1 }),
2404 SourceEvent::Char('p').localize(Snip { offset: 67, length: 1 },Snip { offset: 73, length: 1 }),
2405 SourceEvent::Char('\'').localize(Snip { offset: 68, length: 1 },Snip { offset: 74, length: 1 }),
2406 SourceEvent::Char('>').localize(Snip { offset: 69, length: 1 },Snip { offset: 75, length: 1 }),
2407 ],
2408 }).localize(Snip { offset: 48, length: 22 },Snip { offset: 54, length: 22 }),
2409 ParserEvent::Char('Ц').localize(Snip { offset: 70, length: 1 },Snip { offset: 76, length: 2 }),
2410 ParserEvent::Char('и').localize(Snip { offset: 71, length: 1 },Snip { offset: 78, length: 2 }),
2411 ParserEvent::Char('т').localize(Snip { offset: 72, length: 1 },Snip { offset: 80, length: 2 }),
2412 ParserEvent::Char('а').localize(Snip { offset: 73, length: 1 },Snip { offset: 82, length: 2 }),
2413 ParserEvent::Char('т').localize(Snip { offset: 74, length: 1 },Snip { offset: 84, length: 2 }),
2414 ParserEvent::Char('а').localize(Snip { offset: 75, length: 1 },Snip { offset: 86, length: 2 }),
2415 ParserEvent::Char('(').localize(Snip { offset: 76, length: 1 },Snip { offset: 88, length: 1 }),
2416 ParserEvent::Parsed(Tag {
2417 name: TagName::A, closing: Closing::Open, attributes: OptVec::None,
2418 begin: ().localize(Snip { offset: 77, length: 1 }, Snip { offset: 89, length: 1 }),
2419 end: ().localize(Snip { offset: 119, length: 1 }, Snip { offset: 131, length: 1 }),
2420 raw: vec![
2421 SourceEvent::Char('<').localize(Snip { offset: 77, length: 1 },Snip { offset: 89, length: 1 }),
2422 SourceEvent::Char('a').localize(Snip { offset: 78, length: 1 },Snip { offset: 90, length: 1 }),
2423 SourceEvent::Char(' ').localize(Snip { offset: 79, length: 1 },Snip { offset: 91, length: 1 }),
2424 SourceEvent::Char('h').localize(Snip { offset: 80, length: 1 },Snip { offset: 92, length: 1 }),
2425 SourceEvent::Char('r').localize(Snip { offset: 81, length: 1 },Snip { offset: 93, length: 1 }),
2426 SourceEvent::Char('e').localize(Snip { offset: 82, length: 1 },Snip { offset: 94, length: 1 }),
2427 SourceEvent::Char('f').localize(Snip { offset: 83, length: 1 },Snip { offset: 95, length: 1 }),
2428 SourceEvent::Char('=').localize(Snip { offset: 84, length: 1 },Snip { offset: 96, length: 1 }),
2429 SourceEvent::Char('"').localize(Snip { offset: 85, length: 1 },Snip { offset: 97, length: 1 }),
2430 SourceEvent::Char('/').localize(Snip { offset: 86, length: 1 },Snip { offset: 98, length: 1 }),
2431 SourceEvent::Char('?').localize(Snip { offset: 87, length: 1 },Snip { offset: 99, length: 1 }),
2432 SourceEvent::Char('s').localize(Snip { offset: 88, length: 1 },Snip { offset: 100, length: 1 }),
2433 SourceEvent::Char('h').localize(Snip { offset: 89, length: 1 },Snip { offset: 101, length: 1 }),
2434 SourceEvent::Char('o').localize(Snip { offset: 90, length: 1 },Snip { offset: 102, length: 1 }),
2435 SourceEvent::Char('w').localize(Snip { offset: 91, length: 1 },Snip { offset: 103, length: 1 }),
2436 SourceEvent::Char('u').localize(Snip { offset: 92, length: 1 },Snip { offset: 104, length: 1 }),
2437 SourceEvent::Char('s').localize(Snip { offset: 93, length: 1 },Snip { offset: 105, length: 1 }),
2438 SourceEvent::Char('e').localize(Snip { offset: 94, length: 1 },Snip { offset: 106, length: 1 }),
2439 SourceEvent::Char('r').localize(Snip { offset: 95, length: 1 },Snip { offset: 107, length: 1 }),
2440 SourceEvent::Char('=').localize(Snip { offset: 96, length: 1 },Snip { offset: 108, length: 1 }),
2441 SourceEvent::Char('8').localize(Snip { offset: 97, length: 1 },Snip { offset: 109, length: 1 }),
2442 SourceEvent::Char('7').localize(Snip { offset: 98, length: 1 },Snip { offset: 110, length: 1 }),
2443 SourceEvent::Char('0').localize(Snip { offset: 99, length: 1 },Snip { offset: 111, length: 1 }),
2444 SourceEvent::Char('7').localize(Snip { offset: 100, length: 1 },Snip { offset: 112, length: 1 }),
2445 SourceEvent::Char('9').localize(Snip { offset: 101, length: 1 },Snip { offset: 113, length: 1 }),
2446 SourceEvent::Char('"').localize(Snip { offset: 102, length: 1 },Snip { offset: 114, length: 1 }),
2447 SourceEvent::Char(' ').localize(Snip { offset: 103, length: 1 },Snip { offset: 115, length: 1 }),
2448 SourceEvent::Char('t').localize(Snip { offset: 104, length: 1 },Snip { offset: 116, length: 1 }),
2449 SourceEvent::Char('a').localize(Snip { offset: 105, length: 1 },Snip { offset: 117, length: 1 }),
2450 SourceEvent::Char('r').localize(Snip { offset: 106, length: 1 },Snip { offset: 118, length: 1 }),
2451 SourceEvent::Char('g').localize(Snip { offset: 107, length: 1 },Snip { offset: 119, length: 1 }),
2452 SourceEvent::Char('e').localize(Snip { offset: 108, length: 1 },Snip { offset: 120, length: 1 }),
2453 SourceEvent::Char('t').localize(Snip { offset: 109, length: 1 },Snip { offset: 121, length: 1 }),
2454 SourceEvent::Char('=').localize(Snip { offset: 110, length: 1 },Snip { offset: 122, length: 1 }),
2455 SourceEvent::Char('"').localize(Snip { offset: 111, length: 1 },Snip { offset: 123, length: 1 }),
2456 SourceEvent::Char('_').localize(Snip { offset: 112, length: 1 },Snip { offset: 124, length: 1 }),
2457 SourceEvent::Char('b').localize(Snip { offset: 113, length: 1 },Snip { offset: 125, length: 1 }),
2458 SourceEvent::Char('l').localize(Snip { offset: 114, length: 1 },Snip { offset: 126, length: 1 }),
2459 SourceEvent::Char('a').localize(Snip { offset: 115, length: 1 },Snip { offset: 127, length: 1 }),
2460 SourceEvent::Char('n').localize(Snip { offset: 116, length: 1 },Snip { offset: 128, length: 1 }),
2461 SourceEvent::Char('k').localize(Snip { offset: 117, length: 1 },Snip { offset: 129, length: 1 }),
2462 SourceEvent::Char('"').localize(Snip { offset: 118, length: 1 },Snip { offset: 130, length: 1 }),
2463 SourceEvent::Char('>').localize(Snip { offset: 119, length: 1 },Snip { offset: 131, length: 1 }),
2464 ],
2465 }).localize(Snip { offset: 77, length: 43 },Snip { offset: 89, length: 43 }),
2466 ParserEvent::Char('И').localize(Snip { offset: 120, length: 1 },Snip { offset: 132, length: 2 }),
2467 ParserEvent::Char('н').localize(Snip { offset: 121, length: 1 },Snip { offset: 134, length: 2 }),
2468 ParserEvent::Char('ф').localize(Snip { offset: 122, length: 1 },Snip { offset: 136, length: 2 }),
2469 ParserEvent::Char('о').localize(Snip { offset: 123, length: 1 },Snip { offset: 138, length: 2 }),
2470 ParserEvent::Char('р').localize(Snip { offset: 124, length: 1 },Snip { offset: 140, length: 2 }),
2471 ParserEvent::Char('м').localize(Snip { offset: 125, length: 1 },Snip { offset: 142, length: 2 }),
2472 ParserEvent::Parsed(Tag {
2473 name: TagName::A, closing: Closing::Close, attributes: OptVec::None,
2474 begin: ().localize(Snip { offset: 126, length: 1 }, Snip { offset: 144, length: 1 }),
2475 end: ().localize(Snip { offset: 129, length: 1 }, Snip { offset: 147, length: 1 }),
2476 raw: vec![
2477 SourceEvent::Char('<').localize(Snip { offset: 126, length: 1 },Snip { offset: 144, length: 1 }),
2478 SourceEvent::Char('/').localize(Snip { offset: 127, length: 1 },Snip { offset: 145, length: 1 }),
2479 SourceEvent::Char('a').localize(Snip { offset: 128, length: 1 },Snip { offset: 146, length: 1 }),
2480 SourceEvent::Char('>').localize(Snip { offset: 129, length: 1 },Snip { offset: 147, length: 1 }),
2481 ],
2482 }).localize(Snip { offset: 126, length: 4 },Snip { offset: 144, length: 4 }),
2483 ParserEvent::Char(' ').localize(Snip { offset: 130, length: 1 },Snip { offset: 148, length: 1 }),
2484 ParserEvent::Char('@').localize(Snip { offset: 131, length: 1 },Snip { offset: 149, length: 1 }),
2485 ParserEvent::Char(' ').localize(Snip { offset: 132, length: 1 },Snip { offset: 150, length: 1 }),
2486 ParserEvent::Char('S').localize(Snip { offset: 133, length: 1 },Snip { offset: 151, length: 1 }),
2487 ParserEvent::Char('e').localize(Snip { offset: 134, length: 1 },Snip { offset: 152, length: 1 }),
2488 ParserEvent::Char('p').localize(Snip { offset: 135, length: 1 },Snip { offset: 153, length: 1 }),
2489 ParserEvent::Char(' ').localize(Snip { offset: 136, length: 1 },Snip { offset: 154, length: 1 }),
2490 ParserEvent::Char('3').localize(Snip { offset: 137, length: 1 },Snip { offset: 155, length: 1 }),
2491 ParserEvent::Char(' ').localize(Snip { offset: 138, length: 1 },Snip { offset: 156, length: 1 }),
2492 ParserEvent::Char('2').localize(Snip { offset: 139, length: 1 },Snip { offset: 157, length: 1 }),
2493 ParserEvent::Char('0').localize(Snip { offset: 140, length: 1 },Snip { offset: 158, length: 1 }),
2494 ParserEvent::Char('2').localize(Snip { offset: 141, length: 1 },Snip { offset: 159, length: 1 }),
2495 ParserEvent::Char('4').localize(Snip { offset: 142, length: 1 },Snip { offset: 160, length: 1 }),
2496 ParserEvent::Char(',').localize(Snip { offset: 143, length: 1 },Snip { offset: 161, length: 1 }),
2497 ParserEvent::Char(' ').localize(Snip { offset: 144, length: 1 },Snip { offset: 162, length: 1 }),
2498 ParserEvent::Char('1').localize(Snip { offset: 145, length: 1 },Snip { offset: 163, length: 1 }),
2499 ParserEvent::Char('5').localize(Snip { offset: 146, length: 1 },Snip { offset: 164, length: 1 }),
2500 ParserEvent::Char(':').localize(Snip { offset: 147, length: 1 },Snip { offset: 165, length: 1 }),
2501 ParserEvent::Char('5').localize(Snip { offset: 148, length: 1 },Snip { offset: 166, length: 1 }),
2502 ParserEvent::Char('6').localize(Snip { offset: 149, length: 1 },Snip { offset: 167, length: 1 }),
2503 ParserEvent::Char(')').localize(Snip { offset: 150, length: 1 },Snip { offset: 168, length: 1 }),
2504 ParserEvent::Parsed(Tag {
2505 name: TagName::Div, closing: Closing::Close, attributes: OptVec::None,
2506 begin: ().localize(Snip { offset: 151, length: 1 }, Snip { offset: 169, length: 1 }),
2507 end: ().localize(Snip { offset: 156, length: 1 }, Snip { offset: 174, length: 1 }),
2508 raw: vec![
2509 SourceEvent::Char('<').localize(Snip { offset: 151, length: 1 },Snip { offset: 169, length: 1 }),
2510 SourceEvent::Char('/').localize(Snip { offset: 152, length: 1 },Snip { offset: 170, length: 1 }),
2511 SourceEvent::Char('d').localize(Snip { offset: 153, length: 1 },Snip { offset: 171, length: 1 }),
2512 SourceEvent::Char('i').localize(Snip { offset: 154, length: 1 },Snip { offset: 172, length: 1 }),
2513 SourceEvent::Char('v').localize(Snip { offset: 155, length: 1 },Snip { offset: 173, length: 1 }),
2514 SourceEvent::Char('>').localize(Snip { offset: 156, length: 1 },Snip { offset: 174, length: 1 }),
2515 ],
2516 }).localize(Snip { offset: 151, length: 6 },Snip { offset: 169, length: 6 }),
2517 ParserEvent::Parsed(Tag {
2518 name: TagName::Div, closing: Closing::Open, attributes: OptVec::None,
2519 begin: ().localize(Snip { offset: 157, length: 1 }, Snip { offset: 175, length: 1 }),
2520 end: ().localize(Snip { offset: 179, length: 1 }, Snip { offset: 197, length: 1 }),
2521 raw: vec![
2522 SourceEvent::Char('<').localize(Snip { offset: 157, length: 1 },Snip { offset: 175, length: 1 }),
2523 SourceEvent::Char('d').localize(Snip { offset: 158, length: 1 },Snip { offset: 176, length: 1 }),
2524 SourceEvent::Char('i').localize(Snip { offset: 159, length: 1 },Snip { offset: 177, length: 1 }),
2525 SourceEvent::Char('v').localize(Snip { offset: 160, length: 1 },Snip { offset: 178, length: 1 }),
2526 SourceEvent::Char(' ').localize(Snip { offset: 161, length: 1 },Snip { offset: 179, length: 1 }),
2527 SourceEvent::Char('c').localize(Snip { offset: 162, length: 1 },Snip { offset: 180, length: 1 }),
2528 SourceEvent::Char('l').localize(Snip { offset: 163, length: 1 },Snip { offset: 181, length: 1 }),
2529 SourceEvent::Char('a').localize(Snip { offset: 164, length: 1 },Snip { offset: 182, length: 1 }),
2530 SourceEvent::Char('s').localize(Snip { offset: 165, length: 1 },Snip { offset: 183, length: 1 }),
2531 SourceEvent::Char('s').localize(Snip { offset: 166, length: 1 },Snip { offset: 184, length: 1 }),
2532 SourceEvent::Char('=').localize(Snip { offset: 167, length: 1 },Snip { offset: 185, length: 1 }),
2533 SourceEvent::Char('\'').localize(Snip { offset: 168, length: 1 },Snip { offset: 186, length: 1 }),
2534 SourceEvent::Char('q').localize(Snip { offset: 169, length: 1 },Snip { offset: 187, length: 1 }),
2535 SourceEvent::Char('u').localize(Snip { offset: 170, length: 1 },Snip { offset: 188, length: 1 }),
2536 SourceEvent::Char('o').localize(Snip { offset: 171, length: 1 },Snip { offset: 189, length: 1 }),
2537 SourceEvent::Char('t').localize(Snip { offset: 172, length: 1 },Snip { offset: 190, length: 1 }),
2538 SourceEvent::Char('e').localize(Snip { offset: 173, length: 1 },Snip { offset: 191, length: 1 }),
2539 SourceEvent::Char('m').localize(Snip { offset: 174, length: 1 },Snip { offset: 192, length: 1 }),
2540 SourceEvent::Char('a').localize(Snip { offset: 175, length: 1 },Snip { offset: 193, length: 1 }),
2541 SourceEvent::Char('i').localize(Snip { offset: 176, length: 1 },Snip { offset: 194, length: 1 }),
2542 SourceEvent::Char('n').localize(Snip { offset: 177, length: 1 },Snip { offset: 195, length: 1 }),
2543 SourceEvent::Char('\'').localize(Snip { offset: 178, length: 1 },Snip { offset: 196, length: 1 }),
2544 SourceEvent::Char('>').localize(Snip { offset: 179, length: 1 },Snip { offset: 197, length: 1 }),
2545 ],
2546 }).localize(Snip { offset: 157, length: 23 },Snip { offset: 175, length: 23 }),
2547 ParserEvent::Parsed(Tag {
2548 name: TagName::X(SpecTag::Excl), closing: Closing::Void, attributes: OptVec::None,
2549 begin: ().localize(Snip { offset: 180, length: 1 }, Snip { offset: 198, length: 1 }),
2550 end: ().localize(Snip { offset: 184, length: 1 }, Snip { offset: 202, length: 1 }),
2551 raw: vec![
2552 SourceEvent::Char('<').localize(Snip { offset: 180, length: 1 },Snip { offset: 198, length: 1 }),
2553 SourceEvent::Char('!').localize(Snip { offset: 181, length: 1 },Snip { offset: 199, length: 1 }),
2554 SourceEvent::Char('.').localize(Snip { offset: 182, length: 1 },Snip { offset: 200, length: 1 }),
2555 SourceEvent::Char('.').localize(Snip { offset: 183, length: 1 },Snip { offset: 201, length: 1 }),
2556 SourceEvent::Char('.').localize(Snip { offset: 184, length: 1 },Snip { offset: 202, length: 1 }),
2557 ],
2558 }).localize(Snip { offset: 180, length: 5 },Snip { offset: 198, length: 5 }),
2559 ].into_iter();
2560
2561 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
2562 match res_iter.next() {
2573 Some(ev) => {
2574 println!("Parser: {:?}",local_event);
2575 println!("Result: {:?}",ev);
2576 assert_eq!(local_event,ev);
2577 },
2578 None => {
2579 panic!("parser has more events then test result");
2580 },
2581 }
2582 }
2583 }
2584
2585 #[test]
2586 fn corrupted_02() {
2587 let mut src = "Вот и до нас прошения прощения на камеру дошли <!--emo&:(--><img src='http://forum.zarulem.ws/style_emoticons/default/sad....".into_source();
2588 let mut parser = Builder::auto_detect()
2589 .eof_to_named_tag()
2590 .create();
2591
2592 let mut res_iter = [
2593 ParserEvent::Char('В').localize(Snip { offset: 0, length: 1 },Snip { offset: 0, length: 2 }),
2594 ParserEvent::Char('о').localize(Snip { offset: 1, length: 1 },Snip { offset: 2, length: 2 }),
2595 ParserEvent::Char('т').localize(Snip { offset: 2, length: 1 },Snip { offset: 4, length: 2 }),
2596 ParserEvent::Char(' ').localize(Snip { offset: 3, length: 1 },Snip { offset: 6, length: 1 }),
2597 ParserEvent::Char('и').localize(Snip { offset: 4, length: 1 },Snip { offset: 7, length: 2 }),
2598 ParserEvent::Char(' ').localize(Snip { offset: 5, length: 1 },Snip { offset: 9, length: 1 }),
2599 ParserEvent::Char('д').localize(Snip { offset: 6, length: 1 },Snip { offset: 10, length: 2 }),
2600 ParserEvent::Char('о').localize(Snip { offset: 7, length: 1 },Snip { offset: 12, length: 2 }),
2601 ParserEvent::Char(' ').localize(Snip { offset: 8, length: 1 },Snip { offset: 14, length: 1 }),
2602 ParserEvent::Char('н').localize(Snip { offset: 9, length: 1 },Snip { offset: 15, length: 2 }),
2603 ParserEvent::Char('а').localize(Snip { offset: 10, length: 1 },Snip { offset: 17, length: 2 }),
2604 ParserEvent::Char('с').localize(Snip { offset: 11, length: 1 },Snip { offset: 19, length: 2 }),
2605 ParserEvent::Char(' ').localize(Snip { offset: 12, length: 1 },Snip { offset: 21, length: 1 }),
2606 ParserEvent::Char('п').localize(Snip { offset: 13, length: 1 },Snip { offset: 22, length: 2 }),
2607 ParserEvent::Char('р').localize(Snip { offset: 14, length: 1 },Snip { offset: 24, length: 2 }),
2608 ParserEvent::Char('о').localize(Snip { offset: 15, length: 1 },Snip { offset: 26, length: 2 }),
2609 ParserEvent::Char('ш').localize(Snip { offset: 16, length: 1 },Snip { offset: 28, length: 2 }),
2610 ParserEvent::Char('е').localize(Snip { offset: 17, length: 1 },Snip { offset: 30, length: 2 }),
2611 ParserEvent::Char('н').localize(Snip { offset: 18, length: 1 },Snip { offset: 32, length: 2 }),
2612 ParserEvent::Char('и').localize(Snip { offset: 19, length: 1 },Snip { offset: 34, length: 2 }),
2613 ParserEvent::Char('я').localize(Snip { offset: 20, length: 1 },Snip { offset: 36, length: 2 }),
2614 ParserEvent::Char(' ').localize(Snip { offset: 21, length: 1 },Snip { offset: 38, length: 1 }),
2615 ParserEvent::Char('п').localize(Snip { offset: 22, length: 1 },Snip { offset: 39, length: 2 }),
2616 ParserEvent::Char('р').localize(Snip { offset: 23, length: 1 },Snip { offset: 41, length: 2 }),
2617 ParserEvent::Char('о').localize(Snip { offset: 24, length: 1 },Snip { offset: 43, length: 2 }),
2618 ParserEvent::Char('щ').localize(Snip { offset: 25, length: 1 },Snip { offset: 45, length: 2 }),
2619 ParserEvent::Char('е').localize(Snip { offset: 26, length: 1 },Snip { offset: 47, length: 2 }),
2620 ParserEvent::Char('н').localize(Snip { offset: 27, length: 1 },Snip { offset: 49, length: 2 }),
2621 ParserEvent::Char('и').localize(Snip { offset: 28, length: 1 },Snip { offset: 51, length: 2 }),
2622 ParserEvent::Char('я').localize(Snip { offset: 29, length: 1 },Snip { offset: 53, length: 2 }),
2623 ParserEvent::Char(' ').localize(Snip { offset: 30, length: 1 },Snip { offset: 55, length: 1 }),
2624 ParserEvent::Char('н').localize(Snip { offset: 31, length: 1 },Snip { offset: 56, length: 2 }),
2625 ParserEvent::Char('а').localize(Snip { offset: 32, length: 1 },Snip { offset: 58, length: 2 }),
2626 ParserEvent::Char(' ').localize(Snip { offset: 33, length: 1 },Snip { offset: 60, length: 1 }),
2627 ParserEvent::Char('к').localize(Snip { offset: 34, length: 1 },Snip { offset: 61, length: 2 }),
2628 ParserEvent::Char('а').localize(Snip { offset: 35, length: 1 },Snip { offset: 63, length: 2 }),
2629 ParserEvent::Char('м').localize(Snip { offset: 36, length: 1 },Snip { offset: 65, length: 2 }),
2630 ParserEvent::Char('е').localize(Snip { offset: 37, length: 1 },Snip { offset: 67, length: 2 }),
2631 ParserEvent::Char('р').localize(Snip { offset: 38, length: 1 },Snip { offset: 69, length: 2 }),
2632 ParserEvent::Char('у').localize(Snip { offset: 39, length: 1 },Snip { offset: 71, length: 2 }),
2633 ParserEvent::Char(' ').localize(Snip { offset: 40, length: 1 },Snip { offset: 73, length: 1 }),
2634 ParserEvent::Char('д').localize(Snip { offset: 41, length: 1 },Snip { offset: 74, length: 2 }),
2635 ParserEvent::Char('о').localize(Snip { offset: 42, length: 1 },Snip { offset: 76, length: 2 }),
2636 ParserEvent::Char('ш').localize(Snip { offset: 43, length: 1 },Snip { offset: 78, length: 2 }),
2637 ParserEvent::Char('л').localize(Snip { offset: 44, length: 1 },Snip { offset: 80, length: 2 }),
2638 ParserEvent::Char('и').localize(Snip { offset: 45, length: 1 },Snip { offset: 82, length: 2 }),
2639 ParserEvent::Char(' ').localize(Snip { offset: 46, length: 1 },Snip { offset: 84, length: 1 }),
2640 ParserEvent::Char(' ').localize(Snip { offset: 47, length: 1 },Snip { offset: 85, length: 1 }),
2641 ParserEvent::Parsed(Tag {
2642 name: TagName::X(SpecTag::Excl), closing: Closing::Void, attributes: OptVec::None,
2643 begin: ().localize(Snip { offset: 48, length: 1 }, Snip { offset: 86, length: 1 }),
2644 end: ().localize(Snip { offset: 60, length: 1 }, Snip { offset: 98, length: 1 }),
2645 raw: vec![
2646 SourceEvent::Char('<').localize(Snip { offset: 48, length: 1 },Snip { offset: 86, length: 1 }),
2647 SourceEvent::Char('!').localize(Snip { offset: 49, length: 1 },Snip { offset: 87, length: 1 }),
2648 SourceEvent::Char('-').localize(Snip { offset: 50, length: 1 },Snip { offset: 88, length: 1 }),
2649 SourceEvent::Char('-').localize(Snip { offset: 51, length: 1 },Snip { offset: 89, length: 1 }),
2650 SourceEvent::Char('e').localize(Snip { offset: 52, length: 1 },Snip { offset: 90, length: 1 }),
2651 SourceEvent::Char('m').localize(Snip { offset: 53, length: 1 },Snip { offset: 91, length: 1 }),
2652 SourceEvent::Char('o').localize(Snip { offset: 54, length: 1 },Snip { offset: 92, length: 1 }),
2653 SourceEvent::Char('&').localize(Snip { offset: 55, length: 1 },Snip { offset: 93, length: 1 }),
2654 SourceEvent::Char(':').localize(Snip { offset: 56, length: 1 },Snip { offset: 94, length: 1 }),
2655 SourceEvent::Char('(').localize(Snip { offset: 57, length: 1 },Snip { offset: 95, length: 1 }),
2656 SourceEvent::Char('-').localize(Snip { offset: 58, length: 1 },Snip { offset: 96, length: 1 }),
2657 SourceEvent::Char('-').localize(Snip { offset: 59, length: 1 },Snip { offset: 97, length: 1 }),
2658 SourceEvent::Char('>').localize(Snip { offset: 60, length: 1 },Snip { offset: 98, length: 1 }),
2659 ],
2660 }).localize(Snip { offset: 48, length: 13 },Snip { offset: 86, length: 13 }),
2661 ParserEvent::Parsed(Tag {
2662 name: TagName::Img, closing: Closing::Void, attributes: OptVec::None,
2663 begin: ().localize(Snip { offset: 61, length: 1 }, Snip { offset: 99, length: 1 }),
2664 end: ().localize(Snip { offset: 125, length: 1 }, Snip { offset: 163, length: 1 }),
2665 raw: vec![
2666 SourceEvent::Char('<').localize(Snip { offset: 61, length: 1 },Snip { offset: 99, length: 1 }),
2667 SourceEvent::Char('i').localize(Snip { offset: 62, length: 1 },Snip { offset: 100, length: 1 }),
2668 SourceEvent::Char('m').localize(Snip { offset: 63, length: 1 },Snip { offset: 101, length: 1 }),
2669 SourceEvent::Char('g').localize(Snip { offset: 64, length: 1 },Snip { offset: 102, length: 1 }),
2670 SourceEvent::Char(' ').localize(Snip { offset: 65, length: 1 },Snip { offset: 103, length: 1 }),
2671 SourceEvent::Char('s').localize(Snip { offset: 66, length: 1 },Snip { offset: 104, length: 1 }),
2672 SourceEvent::Char('r').localize(Snip { offset: 67, length: 1 },Snip { offset: 105, length: 1 }),
2673 SourceEvent::Char('c').localize(Snip { offset: 68, length: 1 },Snip { offset: 106, length: 1 }),
2674 SourceEvent::Char('=').localize(Snip { offset: 69, length: 1 },Snip { offset: 107, length: 1 }),
2675 SourceEvent::Char('\'').localize(Snip { offset: 70, length: 1 },Snip { offset: 108, length: 1 }),
2676 SourceEvent::Char('h').localize(Snip { offset: 71, length: 1 },Snip { offset: 109, length: 1 }),
2677 SourceEvent::Char('t').localize(Snip { offset: 72, length: 1 },Snip { offset: 110, length: 1 }),
2678 SourceEvent::Char('t').localize(Snip { offset: 73, length: 1 },Snip { offset: 111, length: 1 }),
2679 SourceEvent::Char('p').localize(Snip { offset: 74, length: 1 },Snip { offset: 112, length: 1 }),
2680 SourceEvent::Char(':').localize(Snip { offset: 75, length: 1 },Snip { offset: 113, length: 1 }),
2681 SourceEvent::Char('/').localize(Snip { offset: 76, length: 1 },Snip { offset: 114, length: 1 }),
2682 SourceEvent::Char('/').localize(Snip { offset: 77, length: 1 },Snip { offset: 115, length: 1 }),
2683 SourceEvent::Char('f').localize(Snip { offset: 78, length: 1 },Snip { offset: 116, length: 1 }),
2684 SourceEvent::Char('o').localize(Snip { offset: 79, length: 1 },Snip { offset: 117, length: 1 }),
2685 SourceEvent::Char('r').localize(Snip { offset: 80, length: 1 },Snip { offset: 118, length: 1 }),
2686 SourceEvent::Char('u').localize(Snip { offset: 81, length: 1 },Snip { offset: 119, length: 1 }),
2687 SourceEvent::Char('m').localize(Snip { offset: 82, length: 1 },Snip { offset: 120, length: 1 }),
2688 SourceEvent::Char('.').localize(Snip { offset: 83, length: 1 },Snip { offset: 121, length: 1 }),
2689 SourceEvent::Char('z').localize(Snip { offset: 84, length: 1 },Snip { offset: 122, length: 1 }),
2690 SourceEvent::Char('a').localize(Snip { offset: 85, length: 1 },Snip { offset: 123, length: 1 }),
2691 SourceEvent::Char('r').localize(Snip { offset: 86, length: 1 },Snip { offset: 124, length: 1 }),
2692 SourceEvent::Char('u').localize(Snip { offset: 87, length: 1 },Snip { offset: 125, length: 1 }),
2693 SourceEvent::Char('l').localize(Snip { offset: 88, length: 1 },Snip { offset: 126, length: 1 }),
2694 SourceEvent::Char('e').localize(Snip { offset: 89, length: 1 },Snip { offset: 127, length: 1 }),
2695 SourceEvent::Char('m').localize(Snip { offset: 90, length: 1 },Snip { offset: 128, length: 1 }),
2696 SourceEvent::Char('.').localize(Snip { offset: 91, length: 1 },Snip { offset: 129, length: 1 }),
2697 SourceEvent::Char('w').localize(Snip { offset: 92, length: 1 },Snip { offset: 130, length: 1 }),
2698 SourceEvent::Char('s').localize(Snip { offset: 93, length: 1 },Snip { offset: 131, length: 1 }),
2699 SourceEvent::Char('/').localize(Snip { offset: 94, length: 1 },Snip { offset: 132, length: 1 }),
2700 SourceEvent::Char('s').localize(Snip { offset: 95, length: 1 },Snip { offset: 133, length: 1 }),
2701 SourceEvent::Char('t').localize(Snip { offset: 96, length: 1 },Snip { offset: 134, length: 1 }),
2702 SourceEvent::Char('y').localize(Snip { offset: 97, length: 1 },Snip { offset: 135, length: 1 }),
2703 SourceEvent::Char('l').localize(Snip { offset: 98, length: 1 },Snip { offset: 136, length: 1 }),
2704 SourceEvent::Char('e').localize(Snip { offset: 99, length: 1 },Snip { offset: 137, length: 1 }),
2705 SourceEvent::Char('_').localize(Snip { offset: 100, length: 1 },Snip { offset: 138, length: 1 }),
2706 SourceEvent::Char('e').localize(Snip { offset: 101, length: 1 },Snip { offset: 139, length: 1 }),
2707 SourceEvent::Char('m').localize(Snip { offset: 102, length: 1 },Snip { offset: 140, length: 1 }),
2708 SourceEvent::Char('o').localize(Snip { offset: 103, length: 1 },Snip { offset: 141, length: 1 }),
2709 SourceEvent::Char('t').localize(Snip { offset: 104, length: 1 },Snip { offset: 142, length: 1 }),
2710 SourceEvent::Char('i').localize(Snip { offset: 105, length: 1 },Snip { offset: 143, length: 1 }),
2711 SourceEvent::Char('c').localize(Snip { offset: 106, length: 1 },Snip { offset: 144, length: 1 }),
2712 SourceEvent::Char('o').localize(Snip { offset: 107, length: 1 },Snip { offset: 145, length: 1 }),
2713 SourceEvent::Char('n').localize(Snip { offset: 108, length: 1 },Snip { offset: 146, length: 1 }),
2714 SourceEvent::Char('s').localize(Snip { offset: 109, length: 1 },Snip { offset: 147, length: 1 }),
2715 SourceEvent::Char('/').localize(Snip { offset: 110, length: 1 },Snip { offset: 148, length: 1 }),
2716 SourceEvent::Char('d').localize(Snip { offset: 111, length: 1 },Snip { offset: 149, length: 1 }),
2717 SourceEvent::Char('e').localize(Snip { offset: 112, length: 1 },Snip { offset: 150, length: 1 }),
2718 SourceEvent::Char('f').localize(Snip { offset: 113, length: 1 },Snip { offset: 151, length: 1 }),
2719 SourceEvent::Char('a').localize(Snip { offset: 114, length: 1 },Snip { offset: 152, length: 1 }),
2720 SourceEvent::Char('u').localize(Snip { offset: 115, length: 1 },Snip { offset: 153, length: 1 }),
2721 SourceEvent::Char('l').localize(Snip { offset: 116, length: 1 },Snip { offset: 154, length: 1 }),
2722 SourceEvent::Char('t').localize(Snip { offset: 117, length: 1 },Snip { offset: 155, length: 1 }),
2723 SourceEvent::Char('/').localize(Snip { offset: 118, length: 1 },Snip { offset: 156, length: 1 }),
2724 SourceEvent::Char('s').localize(Snip { offset: 119, length: 1 },Snip { offset: 157, length: 1 }),
2725 SourceEvent::Char('a').localize(Snip { offset: 120, length: 1 },Snip { offset: 158, length: 1 }),
2726 SourceEvent::Char('d').localize(Snip { offset: 121, length: 1 },Snip { offset: 159, length: 1 }),
2727 SourceEvent::Char('.').localize(Snip { offset: 122, length: 1 },Snip { offset: 160, length: 1 }),
2728 SourceEvent::Char('.').localize(Snip { offset: 123, length: 1 },Snip { offset: 161, length: 1 }),
2729 SourceEvent::Char('.').localize(Snip { offset: 124, length: 1 },Snip { offset: 162, length: 1 }),
2730 SourceEvent::Char('.').localize(Snip { offset: 125, length: 1 },Snip { offset: 163, length: 1 }),
2731 ],
2732 }).localize(Snip { offset: 61, length: 65 },Snip { offset: 99, length: 65 }),
2733 ].into_iter();
2734
2735 while let Some(local_event) = parser.next_event(&mut src).unwrap() {
2736 match res_iter.next() {
2747 Some(ev) => {
2748 println!("Parser: {:?}",local_event);
2749 println!("Result: {:?}",ev);
2750 assert_eq!(local_event,ev);
2751 },
2752 None => {
2753 panic!("parser has more events then test result");
2754 },
2755 }
2756 }
2757 }
2758
2759
2760 }