diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-09 21:53:22 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-28 10:36:08 +0200 |
commit | 5aa3b82fbe62882da8007b0a4548b979c845aa97 (patch) | |
tree | 9788640728ea7894a7ff53c561ed10bff3a611c1 /src/naive_parser.rs | |
parent | 2c73901944e2d22747a2a4ebcc11881b3f8c2ad3 (diff) |
refactor: move machine impl details to machine module
This commit separates the public API (the "Tokenizer")
from the internal implementation (the "Machine")
to make the code more readable.
Diffstat (limited to 'src/naive_parser.rs')
-rw-r--r-- | src/naive_parser.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/naive_parser.rs b/src/naive_parser.rs index 5bf002b..c5e9568 100644 --- a/src/naive_parser.rs +++ b/src/naive_parser.rs @@ -35,7 +35,7 @@ impl<R: Reader + Position<O>, O: Offset> NaiveParser<R, O, DefaultEmitter<O>> { // TODO: add example for NaiveParser::new pub fn new<'a>(reader: impl IntoReader<'a, Reader = R>) -> Self { let mut tokenizer = Tokenizer::new(reader, DefaultEmitter::default()); - tokenizer.naively_switch_state = true; + tokenizer.enable_naive_state_switching(); NaiveParser { tokenizer } } } @@ -45,7 +45,7 @@ impl<R: Reader + Position<usize>> NaiveParser<R, usize, DefaultEmitter<usize>> { // TODO: add example for NaiveParser::new_with_spans pub fn new_with_spans<'a>(reader: impl IntoReader<'a, Reader = R>) -> Self { let mut tokenizer = Tokenizer::new(reader, DefaultEmitter::default()); - tokenizer.naively_switch_state = true; + tokenizer.enable_naive_state_switching(); NaiveParser { tokenizer } } } @@ -55,7 +55,7 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> NaiveParser<R, O, E> { // TODO: add example for NaiveParser::new_with_emitter pub fn new_with_emitter<'a>(reader: impl IntoReader<'a, Reader = R>, emitter: E) -> Self { let mut tokenizer = Tokenizer::new(reader, emitter); - tokenizer.naively_switch_state = true; + tokenizer.enable_naive_state_switching(); NaiveParser { tokenizer } } |