Add stepping to ranges & enable reverse ranges

Follows the following syntax: <start>..<next-value>..<end>
This commit is contained in:
Jakub Žádník
2021-09-11 14:13:04 +03:00
parent 2d3a56f0d3
commit 4749776984
8 changed files with 207 additions and 102 deletions

View File

@ -85,15 +85,19 @@ pub fn flatten_expression(
}
output
}
Expr::Range(from, to, op) => {
Expr::Range(from, next, to, op) => {
let mut output = vec![];
if let Some(f) = from {
output.extend(flatten_expression(working_set, f));
}
if let Some(s) = next {
output.extend(vec![(op.next_op_span, FlatShape::Operator)]);
output.extend(flatten_expression(working_set, s));
}
output.extend(vec![(op.span, FlatShape::Operator)]);
if let Some(t) = to {
output.extend(flatten_expression(working_set, t));
}
output.extend(vec![(op.span, FlatShape::Operator)]);
output
}
Expr::Bool(_) => {