Skip to content

Commit

Permalink
inline: parse multiline attributes
Browse files Browse the repository at this point in the history
reimplement after broken by "take str per line instead of full inline
iter" commit

also resolves #18
  • Loading branch information
hellux committed Mar 25, 2023
1 parent 546676d commit 22e5b01
Show file tree
Hide file tree
Showing 5 changed files with 325 additions and 113 deletions.
16 changes: 16 additions & 0 deletions src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,18 @@ impl<'a, 's> Parser<'a, 's> {
}
}

pub fn restart(&mut self) {
self.state = State::Start;
}

pub fn set_input(&mut self, input: &'s str) {
debug_assert_eq!(self.chars.next(), None);
self.input = input;
self.chars = input.chars();
self.pos = 0;
self.pos_prev = 0;
}

pub fn step(&mut self) -> StepResult {
self.chars.next().map_or(StepResult::More, |c| {
use State::*;
Expand Down Expand Up @@ -309,6 +321,10 @@ impl<'a, 's> Parser<'a, 's> {
}
})
}

pub fn len(&self) -> usize {
self.input.len() - self.chars.as_str().len()
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down
Loading

0 comments on commit 22e5b01

Please sign in to comment.