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
use crate::{log, Context, Error};
mod constant_construct;
pub mod constructs;
mod tokens;
pub use constant_construct::ConstantConstruct;
pub use tokens::Token;
pub type ParseResult<T, I> = nom::IResult<T, I, Error>;
pub fn parse(ctx: &mut Context, input: &str) -> Result<(), Error> {
log!("parsing file: {:?}", ctx.path());
let entry_block = ctx.entry_point.block_mut().unwrap();
let (_, instructions) = constructs::many_expr(input)?;
entry_block.add_instructions(instructions);
Ok(())
}