1mod tree;
2pub use tree::{Tree, EndOfFile};
3
4mod stream;
5pub use stream::{Location, Loc, Token, Stream, Characters};
6
7mod parser;
8pub use parser::{Context, Parse};
9
10pub mod lexer;
11pub mod word;
12pub mod bracket;
13pub mod expr;
14pub mod stmt;
15
16pub mod parsers {
18 use super::*;
19 use bracket::{Round, Brace};
20
21 pub const LEXER: lexer::Parser = lexer::Parser;
22
23 pub type Word = word::Parser;
24
25 pub fn word() -> Word {
27 let mut ret = Word::default();
28 ret.add_keywords::<expr::Operator>();
29 ret.add_keywords::<expr::Keyword>();
30 ret.add_keywords::<stmt::Keyword>();
31 ret.add_keywords::<stmt::AssignOp>();
32 ret
33 }
34
35 pub type Brackets<I, F> = bracket::Brackets<I, F>;
36
37 pub fn round(input: impl Stream) -> impl Stream {
45 STMT.parse_stream(EXPR.parse_stream(Brackets::new('(', ')', |contents| {
46 let contents = EXPR.parse_stream(contents.into_iter()).read_all();
47 Round::new(contents)
48 }, input)))
49 }
50
51 pub fn brace(input: impl Stream) -> impl Stream {
58 round(Brackets::new('{', '}', |contents| {
59 let contents = round(contents.into_iter()).read_all();
60 Brace::new(contents)
61 }, input))
62 }
63
64 pub const EXPR: expr::Parser = expr::Parser;
65 pub const STMT: stmt::Parser = stmt::Parser;
66}
67
68mod valid;
69pub use valid::{Invalid, AST};
70
71pub mod ast;
72
73mod buffer;
74pub use buffer::{Buffer};
75
76#[cfg(test)]
79mod tests {}