[][src]Struct rcc::Parser

pub struct Parser<I: Iterator<Item = CompileResult<Locatable<Token>>>> { /* fields omitted */ }

Methods

impl<I: Iterator<Item = CompileResult<Locatable<Token>>>> Parser<I>[src]

pub fn compound_statement(&mut self) -> Result<Stmt, Locatable<SyntaxError>>[src]

pub fn statement(&mut self) -> Result<Stmt, Locatable<SyntaxError>>[src]

statement : labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement ;

labeled_statement: identifier ':' statement | CASE constant_expr ':' statement | DEFAULT ':' statement

Result: whether there was an error in the program source Option: empty semicolons still count as a statement (so case labels can work)

impl<I> Parser<I> where
    I: Iterator<Item = CompileResult<Locatable<Token>>>, 
[src]

pub fn new(first: Locatable<Token>, tokens: I, debug: bool) -> Self[src]

Create a new parser over the tokens.

The first token is required for internal invariants; I would rather ensure I has at least one token, but I don't know a good way to do that without requiring users to use std::iter::once.

impl<I: Iterator<Item = CompileResult<Locatable<Token>>>> Parser<I>[src]

pub fn collect_results(
    &mut self
) -> (Vec<Locatable<Declaration>>, Vec<CompileError>)
[src]

pub fn warnings(&mut self) -> VecDeque<CompileWarning>[src]

Return all warnings seen so far.

These warnings are consumed and will not be returned if you call warnings() again.

Trait Implementations

impl<I: Debug + Iterator<Item = CompileResult<Locatable<Token>>>> Debug for Parser<I>[src]

impl<I: Iterator<Item = CompileResult<Locatable<Token>>>> Iterator for Parser<I>[src]

type Item = CompileResult<Locatable<Declaration>>

The type of the elements being iterated over.

fn next(&mut self) -> Option<Self::Item>[src]

translation_unit : external_declaration | translation_unit external_declaration ;

external_declaration : function_definition | declaration ;

function_definition : declarator compound_statement | declaration_specifiers declarator compound_statement ;

Auto Trait Implementations

impl<I> !RefUnwindSafe for Parser<I>

impl<I> !Send for Parser<I>

impl<I> !Sync for Parser<I>

impl<I> Unpin for Parser<I> where
    I: Unpin

impl<I> !UnwindSafe for Parser<I>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,