Fixed expression
This commit is contained in:
@@ -29,7 +29,7 @@ pub enum BinaryOp {
|
|||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub enum Expression {
|
pub enum Expression {
|
||||||
Literal(Literal),
|
Literal(Literal),
|
||||||
Path(ExprPath), // Updated from Path to support paths containing turbofish segments
|
Path(ExprPath),
|
||||||
Fix {
|
Fix {
|
||||||
initial: Box<Expression>,
|
initial: Box<Expression>,
|
||||||
prefixes: Vec<Prefix>,
|
prefixes: Vec<Prefix>,
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Expression {
|
|||||||
.parse(inner)
|
.parse(inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. The single unit 'term' replaces the old flat 'expr' layout
|
|
||||||
Rule::term => {
|
Rule::term => {
|
||||||
let mut prefix_pairs = Vec::new();
|
let mut prefix_pairs = Vec::new();
|
||||||
let mut primary_pair = None;
|
let mut primary_pair = None;
|
||||||
@@ -119,6 +118,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Expression {
|
|||||||
Rule::primary => pair.into_inner().next().unwrap().try_into(),
|
Rule::primary => pair.into_inner().next().unwrap().try_into(),
|
||||||
Rule::static_path => ast_expr!(Expression::Path(pair.try_into())),
|
Rule::static_path => ast_expr!(Expression::Path(pair.try_into())),
|
||||||
Rule::literal => ast_expr!(Expression::Literal(pair.try_into())),
|
Rule::literal => ast_expr!(Expression::Literal(pair.try_into())),
|
||||||
|
Rule::expr_path => ast_expr!(Expression::Path(pair.try_into())),
|
||||||
|
|
||||||
_ => AstError::bug_unimplemented(pair),
|
_ => AstError::bug_unimplemented(pair),
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -225,7 +225,7 @@ impl GetRust for ExprPath {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(ExprPathSegment::get_rust)
|
.map(ExprPathSegment::get_rust)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ")
|
.join("::")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user