pub struct GraphParser<'a> {
pub tokens: &'a [Token],
pub at: usize,
}Expand description
A self-contained recursive-descent parser for the nodes = {...} and
branches = {...} bodies, operating directly on a token slice.
Fields§
§tokens: &'a [Token]The full token stream being parsed.
at: usizeCurrent cursor position into tokens.
Implementations§
Source§impl<'a> GraphParser<'a>
impl<'a> GraphParser<'a>
Sourcepub fn node_graph(&mut self) -> Result<(NodeGraph, usize), SpecError>
pub fn node_graph(&mut self) -> Result<(NodeGraph, usize), SpecError>
{ name = { field* }; ... } — the whole nodes = {...} body.
Returns the parsed graph together with the token position just past
its closing } — spec.rs’s Parser (a separate struct walking
the same token slice, Task 3) needs that position to resume parsing
the rest of the spec {...} body afterward, since it can’t see
GraphParser’s internal cursor otherwise.
Auto Trait Implementations§
impl<'a> Freeze for GraphParser<'a>
impl<'a> RefUnwindSafe for GraphParser<'a>
impl<'a> Send for GraphParser<'a>
impl<'a> Sync for GraphParser<'a>
impl<'a> Unpin for GraphParser<'a>
impl<'a> UnsafeUnpin for GraphParser<'a>
impl<'a> UnwindSafe for GraphParser<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more