1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Parser module, containing the AST and type-checking hooked in.
pub mod ast;
pub mod scope;

mod lib;

pub use lib::*;

lalrpop_mod!(
    /// Backend of the parser, automatically generated by the LALRPOP crate from
    /// grammar files.
    /// 
    /// # Examples
    /// 
    /// Basic parsing to get an AST:
    /// 
    /// ```rust
    /// use zypo_rs::parser;
    /// 
    /// fn main() {
    ///     let input = "fun hi() {}";
    ///     let expected_ast = vec![
    ///         parser::ast::Function {
    ///             ident: "hi".to_string(),
    ///             body: vec![],
    ///             params: vec![],
    ///             docs: None,
    ///             return_type: parser::ast::VarType::Void
    ///         }
    ///     ];
    /// 
    ///     let parsed_input = parser::grammar::GrammarParser::new()
    ///         .parse(input)
    ///         .unwrap();
    /// 
    ///     assert_eq!(parsed_input, expected_ast);
    /// }
    /// ```
    pub grammar,
    "/parser/grammar.rs"
);