Add Oblique token
This commit is contained in:
parent
a71a9f4224
commit
8ee0ad7977
3 changed files with 70 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ use crate::types::Config;
|
|||
use super::{Parseable as _, Token, LexMap};
|
||||
use token::{
|
||||
anchor::Anchor, linebreak::LineBreak, paragraph::Paragraph, header::Header,
|
||||
preformat::PreFormat, literal::Literal, code::Code,
|
||||
preformat::PreFormat, literal::Literal, code::Code, oblique::Oblique,
|
||||
};
|
||||
use lexeme::Lexeme;
|
||||
|
||||
|
|
@ -78,6 +78,10 @@ fn lex(text: &str, map: LexMap, config: &Config) -> Vec<Token> {
|
|||
state.context.inline = InlineContext::Code;
|
||||
tokens.push(Token::Code(Code::new(true)));
|
||||
continue;
|
||||
} else if Oblique::probe(lexeme) {
|
||||
state.context.inline = InlineContext::Oblique;
|
||||
tokens.push(Token::Oblique(Oblique::new(true)));
|
||||
continue;
|
||||
} else if Anchor::probe(lexeme) {
|
||||
state.context.inline = InlineContext::Anchor;
|
||||
state.buffers.anchor.clear();
|
||||
|
|
@ -97,6 +101,13 @@ fn lex(text: &str, map: LexMap, config: &Config) -> Vec<Token> {
|
|||
continue;
|
||||
}
|
||||
},
|
||||
InlineContext::Oblique => {
|
||||
if Oblique::probe(lexeme) {
|
||||
state.context.inline = InlineContext::None;
|
||||
tokens.push(Token::Oblique(Oblique::new(false)));
|
||||
continue;
|
||||
}
|
||||
},
|
||||
InlineContext::Anchor => {
|
||||
let buffer = &mut state.buffers.anchor;
|
||||
let candidate = &mut buffer.candidate;
|
||||
|
|
@ -192,6 +203,7 @@ enum BlockContext {
|
|||
enum InlineContext {
|
||||
Anchor,
|
||||
Code,
|
||||
Oblique,
|
||||
None,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue