pub struct Output {
event: Vec<u32>,
error: Vec<String>,
}Expand description
Output of the parser – a DFS traversal of a concrete syntax tree.
Use the Output::iter method to iterate over traversal steps and consume
a syntax tree.
In a sense, this is just a sequence of SyntaxKind-colored parenthesis
interspersed into the original crate::Input. The output is fundamentally
coordinated with the input and n_input_tokens refers to the number of
times crate::Input::push was called.
Fields§
§event: Vec<u32>32-bit encoding of events. If LSB is zero, then that’s an index into the error vector. Otherwise, it’s one of the thee other variants, with data encoded as
|16 bit kind|8 bit n_input_tokens|4 bit tag|4 bit leftover|error: Vec<String>Implementations§
Source§impl Output
impl Output
const EVENT_MASK: u32 = 1u32
const TAG_MASK: u32 = 240u32
const N_INPUT_TOKEN_MASK: u32 = 65_280u32
const KIND_MASK: u32 = 4_294_901_760u32
const ERROR_SHIFT: u32 = 1u32
const TAG_SHIFT: u32 = 4u32
const N_INPUT_TOKEN_SHIFT: u32 = 8u32
const KIND_SHIFT: u32 = 16u32
const TOKEN_EVENT: u8 = 0u8
const ENTER_EVENT: u8 = 1u8
const EXIT_EVENT: u8 = 2u8
const SPLIT_EVENT: u8 = 3u8
pub fn iter(&self) -> impl Iterator<Item = Step<'_>>
pub(crate) fn token(&mut self, kind: SyntaxKind, n_tokens: u8)
pub(crate) fn float_split_hack(&mut self, ends_in_dot: bool)
pub(crate) fn enter_node(&mut self, kind: SyntaxKind)
pub(crate) fn leave_node(&mut self)
pub(crate) fn error(&mut self, error: String)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Output
impl RefUnwindSafe for Output
impl Send for Output
impl Sync for Output
impl Unpin for Output
impl UnwindSafe for Output
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