Static path expr

This commit is contained in:
2026-05-04 16:49:41 +02:00
parent eba3599520
commit c4bdc20276
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ pub struct ForStmt {
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
pub enum Expression { pub enum Expression {
Identifier(String), Path(StaticPath),
IntLiteral(i64), IntLiteral(i64),
FloatLiteral(f64), FloatLiteral(f64),
BoolLiteral(bool), BoolLiteral(bool),
+1 -1
View File
@@ -262,7 +262,7 @@ impl From<pest::iterators::Pair<'_, Rule>> for Expression {
} }
} }
Rule::primary => Expression::from(pair.into_inner().next().unwrap()), 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 => { Rule::integer => {
let value = pair.as_str().parse::<i64>().unwrap(); let value = pair.as_str().parse::<i64>().unwrap();
Expression::IntLiteral(value) Expression::IntLiteral(value)
+1 -1
View File
@@ -83,7 +83,7 @@ impl GetRust for TypeExpr {
impl GetRust for Expression { impl GetRust for Expression {
fn get_rust(&self) -> String { fn get_rust(&self) -> String {
match self { match self {
Expression::Identifier(name) => name.clone(), Expression::Path(path) => path.get_rust(),
Expression::IntLiteral(n) => n.to_string(), Expression::IntLiteral(n) => n.to_string(),
Expression::FloatLiteral(n) => n.to_string(), Expression::FloatLiteral(n) => n.to_string(),
Expression::BoolLiteral(b) => b.to_string(), Expression::BoolLiteral(b) => b.to_string(),
+1 -1
View File
@@ -1,3 +1,3 @@
i32 test() { i32 test() {
std::fs::write();
} }