diff --git a/parser/src/ast.rs b/parser/src/ast.rs index 0dc7f6a..e98f654 100644 --- a/parser/src/ast.rs +++ b/parser/src/ast.rs @@ -118,7 +118,7 @@ pub struct ForStmt { #[derive(Debug, Clone, Serialize)] pub enum Expression { - Identifier(String), + Path(StaticPath), IntLiteral(i64), FloatLiteral(f64), BoolLiteral(bool), diff --git a/parser/src/lib.rs b/parser/src/lib.rs index cc0eb69..2969baa 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -262,7 +262,7 @@ impl From> for Expression { } } Rule::primary => Expression::from(pair.into_inner().next().unwrap()), - Rule::identifier => Expression::Identifier(pair.as_str().to_string()), + Rule::static_path => Expression::Path(StaticPath::from(pair)), Rule::integer => { let value = pair.as_str().parse::().unwrap(); Expression::IntLiteral(value) diff --git a/src/codegen.rs b/src/codegen.rs index f04413d..3396d17 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -83,7 +83,7 @@ impl GetRust for TypeExpr { impl GetRust for Expression { fn get_rust(&self) -> String { match self { - Expression::Identifier(name) => name.clone(), + Expression::Path(path) => path.get_rust(), Expression::IntLiteral(n) => n.to_string(), Expression::FloatLiteral(n) => n.to_string(), Expression::BoolLiteral(b) => b.to_string(), diff --git a/test/src/main.mist b/test/src/main.mist index 5ff9964..3ed2575 100644 --- a/test/src/main.mist +++ b/test/src/main.mist @@ -1,3 +1,3 @@ i32 test() { - + std::fs::write(); }