fixed parser

This commit is contained in:
Wintermute 2025-06-26 21:27:07 +02:00
parent 0d417bbbe5
commit 7883b42d13
9 changed files with 667 additions and 65 deletions

View file

@ -2,14 +2,20 @@ use crate::ir::{Atom, OwnedAtom};
pub(crate) mod parser;
#[derive(PartialEq, Debug)]
struct Module {
objs: Vec<(String, Region)>,
pub(crate) struct Module {
pub(crate) objs: Vec<(String, Region)>,
pub(crate) opts: Options,
}
/// Module options (endianess etc.)
/// To be defined :(
#[derive(PartialEq, Debug)]
pub(crate) struct Options(pub(crate) Vec<String>);
/// A region of memory.
/// Either a structured field list or an atomic type.
#[derive(PartialEq, Debug)]
enum Region {
pub(crate) enum Region {
Fields(Vec<(Range, FieldRegion)>),
Atom { ty: Type },
}
@ -17,7 +23,7 @@ enum Region {
/// Content of a field.
/// Can be a region or a constant.
#[derive(PartialEq, Debug)]
enum FieldRegion {
pub(crate) enum FieldRegion {
Subfield { name: String, content: Region },
Const { name: String, value: OwnedAtom },
}