pub struct Input { /* private fields */ }
Expand description
Input for the parser – a sequence of tokens.
As of now, parser doesn’t have access to the text of the tokens, and makes
decisions based solely on their classification. Unlike LexerToken
, the
Tokens
doesn’t include whitespace and comments. Main input to the parser.
Struct of arrays internally, but this shouldn’t really matter.
Implementations§
source§impl Input
impl Input
pub
impl used by callers to create Tokens
.
pub fn push(&mut self, kind: SyntaxKind)
pub fn push_ident(&mut self, contextual_kind: SyntaxKind)
sourcepub fn was_joint(&mut self)
pub fn was_joint(&mut self)
Sets jointness for the last token we’ve pushed.
This is a separate API rather than an argument to the push
to make it
convenient both for textual and mbe tokens. With text, you know whether
the previous token was joint, with mbe, you know whether the current
one is joint. This API allows for styles of usage:
// In text:
tokens.was_joint(prev_joint);
tokens.push(curr);
// In MBE:
token.push(curr);
tokens.push(curr_joint)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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