aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/character_escape.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
commit5ee6edf222658e73ee97871972b6fbeef444451b (patch)
treec9233c7a8584a2d027ef1b7443e3e5b59918ca2b /src/construct/character_escape.rs
parent91dc4b1f461fa76df7163f68b2a6db361a71beea (diff)
downloadmarkdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.gz
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.bz2
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.zip
Refactor to not pass codes around
Diffstat (limited to 'src/construct/character_escape.rs')
-rw-r--r--src/construct/character_escape.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs
index f317854..9e9b713 100644
--- a/src/construct/character_escape.rs
+++ b/src/construct/character_escape.rs
@@ -42,12 +42,12 @@ use crate::tokenizer::{Code, State, Tokenizer};
/// > | a\*b
/// ^
/// ```
-pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+pub fn start(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
Code::Char('\\') if tokenizer.parse_state.constructs.character_escape => {
tokenizer.enter(Token::CharacterEscape);
tokenizer.enter(Token::CharacterEscapeMarker);
- tokenizer.consume(code);
+ tokenizer.consume();
tokenizer.exit(Token::CharacterEscapeMarker);
State::Fn(Box::new(inside))
}
@@ -61,11 +61,11 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
/// > | a\*b
/// ^
/// ```
-fn inside(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+fn inside(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
Code::Char(char) if char.is_ascii_punctuation() => {
tokenizer.enter(Token::CharacterEscapeValue);
- tokenizer.consume(code);
+ tokenizer.consume();
tokenizer.exit(Token::CharacterEscapeValue);
tokenizer.exit(Token::CharacterEscape);
State::Ok