blob: 7964de376b0d3306d598541836c3fe34dc6c6eda (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
//! To do.
use crate::token::Token;
use crate::tokenizer::{Code, State, StateFnResult, Tokenizer};
/// To do.
pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
match code {
Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
tokenizer.enter(Token::LineEnding);
tokenizer.consume(code);
tokenizer.exit(Token::LineEnding);
(State::Fn(Box::new(non_lazy_after)), None)
}
_ => (State::Nok, None),
}
}
/// To do.
fn non_lazy_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
if tokenizer.lazy {
(State::Nok, None)
} else {
(State::Ok, Some(vec![code]))
}
}
|