fixed parser
This commit is contained in:
parent
0d417bbbe5
commit
7883b42d13
9 changed files with 667 additions and 65 deletions
|
@ -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 },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue