pub struct Parser { /* private fields */ }Implementations§
Source§impl Parser
impl Parser
pub fn new(raw_tokens: Vec<Token>) -> Parser
Sourcepub fn with_source(self, source: &str, filename: &str) -> Parser
pub fn with_source(self, source: &str, filename: &str) -> Parser
§Fase 28.d — Fluent attach of source text + filename for
rustc-style source-context blocks on emitted ParseErrors.
Returns self so it chains with .parse_with_recovery():
ⓘ
let result = Parser::new(tokens)
.with_source(src, "foo.axon")
.parse_with_recovery();No-op of any other behaviour — pure metadata attach.
pub fn parse(&mut self) -> Result<Program, ParseError>
Sourcepub fn parse_with_recovery(&mut self) -> ParseResult
pub fn parse_with_recovery(&mut self) -> ParseResult
Recovery-mode parse. Collects every parse error in source
order; the existing parse() API remains fail-fast (D9).
§Recovery contract (D2)
On ParseError:
- Push the error onto
errors. - If the cursor is already on a top-level declaration keyword (and brace-depth ≤ 0), do not consume — the caller should retry the declaration parse from here. Otherwise advance one token to make progress, then walk to the next sync point.
- Resume the outer loop.
Sync points: top-level declaration keyword at brace-depth ≤ 0,
or EOF. Negative depths are treated identically to ≤ 0 — the
walker keeps walking through over-balanced } rather than
pretending a closing brace is itself a sync point (which would
emit a ghost “Unexpected token at top level” error in the
outer loop).
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
impl UnwindSafe for Parser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.