[][src]Struct ttk91::symbolic::parser::Parser

pub struct Parser<'a, T = SymbolTable> {
    pub state: State<T>,
    // some fields omitted
}

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]

Sets the Logger used by the Parser to the provided one.

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]

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]

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.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Parser<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for Parser<'a, T> where
    T: Send

impl<'a, T> Sync for Parser<'a, T> where
    T: Sync

impl<'a, T> Unpin for Parser<'a, T> where
    T: Unpin

impl<'a, T> UnwindSafe for Parser<'a, T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.