Working example and README

This commit is contained in:
Chris Fallin
2021-09-04 20:25:10 -07:00
parent d7efd9f219
commit 4a2cd78827
5 changed files with 52 additions and 10 deletions

View File

@@ -368,13 +368,13 @@ mod test {
(Load (a Reg) (dest Reg))))
(type u32 (primitive u32))
";
let defs = Parser::new("(none)", text)
let defs = Parser::new(Lexer::from_str(text, "(none)"))
.parse_defs()
.expect("should parse");
assert_eq!(
defs,
Defs {
filename: "(none)".to_string(),
filenames: vec!["(none)".to_string()],
defs: vec![
Def::Type(Type {
name: Ident("Inst".to_string()),
@@ -412,8 +412,9 @@ mod test {
}
]),
pos: Pos {
file: 0,
offset: 42,
line: 4,
line: 3,
col: 18,
},
}),
@@ -422,8 +423,9 @@ mod test {
is_extern: false,
ty: TypeValue::Primitive(Ident("u32".to_string())),
pos: Pos {
file: 0,
offset: 167,
line: 7,
line: 6,
col: 18,
},
}),