Struct fluid_parser::parser::Parser

source ·
pub struct Parser<'a> {
    pub i: usize,
    pub tokens: Vec<Token<'a>>,
    /* private fields */
}

Fields§

§i: usize§tokens: Vec<Token<'a>>

Implementations§

source§

impl<'a> Parser<'a>

source

pub fn new(lexer: Lexer<'a>) -> Self

Examples found in repository?
examples/example1.rs (line 52)
50
51
52
53
54
55
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
More examples
Hide additional examples
examples/example3.rs (line 36)
34
35
36
37
38
39
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
examples/example4.rs (line 31)
29
30
31
32
33
34
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
examples/example2.rs (line 11)
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    let args: Vec<String> = std::env::args().collect();
    if args.len() < 2 {
        panic!("Expected a file input!");
    }
    let s = std::fs::read_to_string(&args[1]).expect("Failed to read file!");
    let l = Lexer::new(&s);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
source

pub fn parse(&mut self) -> Ast

Examples found in repository?
examples/example1.rs (line 53)
50
51
52
53
54
55
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
More examples
Hide additional examples
examples/example3.rs (line 37)
34
35
36
37
38
39
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
examples/example4.rs (line 32)
29
30
31
32
33
34
fn main() {
    let l = Lexer::new(TEST);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}
examples/example2.rs (line 12)
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    let args: Vec<String> = std::env::args().collect();
    if args.len() < 2 {
        panic!("Expected a file input!");
    }
    let s = std::fs::read_to_string(&args[1]).expect("Failed to read file!");
    let l = Lexer::new(&s);
    let mut p = Parser::new(l);
    let a = p.parse();
    println!("{:#?}", a);
}

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Parser<'a>

§

impl<'a> Send for Parser<'a>

§

impl<'a> Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> UnwindSafe for Parser<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.