From d8bf48e692111d32b7a4ed82d9fdc4f3f0440b1d Mon Sep 17 00:00:00 2001 From: JT Date: Sat, 3 Jul 2021 07:30:03 +1200 Subject: [PATCH] minor change --- src/main.rs | 8 ++++---- src/parser.rs | 17 ++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 480bd5b16f..4c39ef36e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,10 +7,10 @@ fn main() -> std::io::Result<()> { let sig = Signature::build("foo").named("--jazz", SyntaxShape::Int, "jazz!!", Some('j')); working_set.add_decl((b"foo").to_vec(), sig); - //let file = std::fs::read(&path)?; - //let (output, err) = working_set.parse_file(&path, &file); - let (output, err) = working_set.parse_source(path.as_bytes()); - println!("{:#?}", output); + let file = std::fs::read(&path)?; + let (output, err) = working_set.parse_file(&path, &file); + //let (output, err) = working_set.parse_source(path.as_bytes()); + println!("{}", output.len()); println!("error: {:?}", err); Ok(()) diff --git a/src/parser.rs b/src/parser.rs index ce62381d61..07b010f446 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -98,7 +98,7 @@ impl Call { pub enum Expr { Int(i64), Var(VarId), - Call(Call), + Call(Box), Operator(Operator), BinaryOp(Box, Box, Box), //lhs, op, rhs Subexpression(Box), @@ -418,7 +418,7 @@ impl ParserWorkingSet { // FIXME: type unknown ( Expression { - expr: Expr::Call(call), + expr: Expr::Call(Box::new(call)), ty: Type::Unknown, span: span(spans), }, @@ -997,13 +997,16 @@ mod tests { assert!(err.is_none()); assert!(block.len() == 1); - assert!(matches!( - block[0], + + match &block[0] { Statement::Expression(Expression { - expr: Expr::Call(Call { decl_id: 0, .. }), + expr: Expr::Call(call), .. - }) - )); + }) => { + assert_eq!(call.decl_id, 0); + } + _ => panic!("not a call"), + } } #[test]