aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/code_indented.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/construct/code_indented.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs
index 8966249..74a0938 100644
--- a/src/construct/code_indented.rs
+++ b/src/construct/code_indented.rs
@@ -128,17 +128,20 @@ fn after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
/// cd
/// ```
fn further_start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
- // To do: `nok` if lazy line.
- match code {
- Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
- tokenizer.enter(Token::LineEnding);
- tokenizer.consume(code);
- tokenizer.exit(Token::LineEnding);
- (State::Fn(Box::new(further_start)), None)
+ if tokenizer.lazy {
+ (State::Nok, None)
+ } else {
+ match code {
+ Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
+ tokenizer.enter(Token::LineEnding);
+ tokenizer.consume(code);
+ tokenizer.exit(Token::LineEnding);
+ (State::Fn(Box::new(further_start)), None)
+ }
+ _ => tokenizer.attempt(space_or_tab_min_max(TAB_SIZE, TAB_SIZE), |ok| {
+ Box::new(if ok { further_end } else { further_begin })
+ })(tokenizer, code),
}
- _ => tokenizer.attempt(space_or_tab_min_max(TAB_SIZE, TAB_SIZE), |ok| {
- Box::new(if ok { further_end } else { further_begin })
- })(tokenizer, code),
}
}