aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_non_lazy_continuation.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/construct/partial_non_lazy_continuation.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/construct/partial_non_lazy_continuation.rs b/src/construct/partial_non_lazy_continuation.rs
new file mode 100644
index 0000000..7964de3
--- /dev/null
+++ b/src/construct/partial_non_lazy_continuation.rs
@@ -0,0 +1,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]))
+ }
+}