inline: mv symbol from span to event field
This commit is contained in:
		
					parent
					
						
							
								9676d9e5d6
							
						
					
				
			
			
				commit
				
					
						6abe9e44c7
					
				
			
		
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -14,7 +14,7 @@ use ControlFlow::*;
 | 
			
		|||
#[derive(Debug, Clone, PartialEq, Eq)]
 | 
			
		||||
pub enum Atom<'s> {
 | 
			
		||||
    FootnoteReference { label: &'s str },
 | 
			
		||||
    Symbol,
 | 
			
		||||
    Symbol(&'s str),
 | 
			
		||||
    Softbreak,
 | 
			
		||||
    Hardbreak,
 | 
			
		||||
    Escape,
 | 
			
		||||
| 
						 | 
				
			
			@ -604,10 +604,11 @@ impl<'s> Parser<'s> {
 | 
			
		|||
                .sum();
 | 
			
		||||
            if end && valid {
 | 
			
		||||
                self.input.lexer = lex::Lexer::new(ahead.as_str());
 | 
			
		||||
                self.input.span = self.input.span.after(len);
 | 
			
		||||
                self.push(EventKind::Atom(Symbol));
 | 
			
		||||
                self.input.span = self.input.span.after(1);
 | 
			
		||||
                return Some(Continue);
 | 
			
		||||
                let span_symbol = self.input.span.after(len);
 | 
			
		||||
                self.input.span = Span::new(self.input.span.start(), span_symbol.end() + 1);
 | 
			
		||||
                return self.push(EventKind::Atom(Atom::Symbol(
 | 
			
		||||
                    span_symbol.of(self.input.src),
 | 
			
		||||
                )));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        None
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -837,7 +837,7 @@ impl<'s> Parser<'s> {
 | 
			
		|||
                }
 | 
			
		||||
                inline::EventKind::Atom(a) => match a {
 | 
			
		||||
                    inline::Atom::FootnoteReference { label } => Event::FootnoteReference(label),
 | 
			
		||||
                    inline::Atom::Symbol => Event::Symbol(inline.span.of(self.src).into()),
 | 
			
		||||
                    inline::Atom::Symbol(sym) => Event::Symbol(sym.into()),
 | 
			
		||||
                    inline::Atom::Quote { ty, left } => match (ty, left) {
 | 
			
		||||
                        (inline::QuoteType::Single, true) => Event::LeftSingleQuote,
 | 
			
		||||
                        (inline::QuoteType::Single, false) => Event::RightSingleQuote,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue