[−][src]Struct ttk91::symbolic::parser::Parser
Type for parsing symbolic TTK91 programs.
Fields
state: State<T>
Implementations
impl<'a> Parser<'a, SymbolTable>
[src]
pub fn from_str(input: &'a str) -> Self
[src]
Runs the provided input string through a tokenizer and creates a parser from the resulting tokens stream.
impl<'a, T> Parser<'a, T>
[src]
pub fn with_symbol_table<T2>(self, symbol_table: T2) -> Parser<'a, T2>
[src]
Replaces the parser's symbol table with the provided one.
pub fn set_logger(&mut self, logger: &Logger)
[src]
impl<'t> Parser<'t, SymbolTable>
[src]
pub fn parse_instruction(input: &'t str) -> Result<Instruction>
[src]
Parses a single instruction from the input stream.
impl<'t, T> Parser<'t, T> where
T: BorrowMut<SymbolTable>,
[src]
T: BorrowMut<SymbolTable>,
pub fn parse_line(&mut self) -> Result<'t, (Option<SymbolId>, Instruction)>
[src]
Parse a single line of assembly. This includes a possible label and an instruction.
pub fn parse(&mut self) -> Result<'t, Program>
[src]
Tries to parse a program written in symbolic TTK91 assembly. Fails on the first encountered error and returns it.
pub fn parse_verbose(
&mut self
) -> Result<Program, (Option<Program>, Vec<ParseError<'t>>)>
[src]
&mut self
) -> Result<Program, (Option<Program>, Vec<ParseError<'t>>)>
Like Parser::parse, tries to parse a program written in symbolic TTK91 assembly. Unlike Parser::parse, this function tries it's best to recover from any syntax errors in order to provide suggestions on how to fix these errors and continue parsing further.
pub fn take_opcode(&mut self) -> Result<'t, OpCode>
[src]
Takes an OpCode from the input stream.
pub fn take_instruction(&mut self) -> Result<'t, Instruction>
[src]
Tries to parse an instruction, which can be either pseudo or concrete.
Trait Implementations
impl<'a, T> Parser<Token<'a>> for Parser<'a, T>
[src]
type Stream = BufferedStream<SpannedIter<'a, Token<'a>>>
The token stream type on which the parser operates.
fn stream(&self) -> &Self::Stream
[src]
fn stream_mut(&mut self) -> &mut Self::Stream
[src]
fn boundary_right(&mut self) -> usize
[src]
fn boundary_left(&mut self) -> usize
[src]
fn apply<P, O, C>(&mut self, op: P) -> Result<O, ParseError<C, T>> where
Self: Sized,
P: Operation<Self, O, C, T>,
[src]
Self: Sized,
P: Operation<Self, O, C, T>,
fn take_token<X>(&mut self, token: T) -> Result<T, ParseError<X, T>> where
T: Display + PartialEq,
Self: Sized,
[src]
T: Display + PartialEq,
Self: Sized,
fn assert_token<X>(&mut self, token: T) -> Result<(), ParseError<X, T>> where
T: Display + PartialEq,
Self: Sized,
[src]
T: Display + PartialEq,
Self: Sized,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Parser<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for Parser<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Parser<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Parser<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> UnwindSafe for Parser<'a, T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,