From 3c7d249ae4c4c76e7f8bac4cc4313b877610c60b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 10 Jan 2021 20:48:32 +0100 Subject: =?UTF-8?q?Rename=20token=20modes=20=E2=9C=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parse/parser.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/parse/parser.rs') diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 974bf521..0d3761df 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -16,7 +16,7 @@ pub struct Parser<'s> { peeked: Option>, /// The start position of the peeked token. next_start: Pos, - /// The end position of the last (non-whitespace if in header) token. + /// The end position of the last (non-whitespace if in code mode) token. last_end: Pos, /// The stack of modes we were in. modes: Vec, @@ -29,7 +29,7 @@ pub struct Parser<'s> { impl<'s> Parser<'s> { /// Create a new parser for the source string. pub fn new(src: &'s str) -> Self { - let mut tokens = Tokens::new(src, TokenMode::Body); + let mut tokens = Tokens::new(src, TokenMode::Markup); let next = tokens.next(); Self { tokens, @@ -151,7 +151,7 @@ impl<'s> Parser<'s> { } /// Execute `f` and return the result alongside the span of everything `f` - /// ate. Excludes leading and trailing whitespace in header mode. + /// ate. Excludes leading and trailing whitespace in code mode. pub fn span(&mut self, f: F) -> Spanned where F: FnOnce(&mut Self) -> T, @@ -243,7 +243,7 @@ impl<'s> Parser<'s> { /// The position at which the last token ended. /// - /// Refers to the end of the last _non-whitespace_ token in header mode. + /// Refers to the end of the last _non-whitespace_ token in code mode. pub fn last_end(&self) -> Pos { self.last_end } @@ -266,8 +266,8 @@ impl<'s> Parser<'s> { self.next = self.tokens.next(); match self.tokens.mode() { - TokenMode::Body => {} - TokenMode::Header => { + TokenMode::Markup => {} + TokenMode::Code => { while matches!( self.next, Some(Token::Space(_)) | -- cgit v1.2.3