Modify index syntax; Clean up
This commit is contained in:
parent
e9e4e92f68
commit
c86f61e1cd
@ -35,8 +35,6 @@ impl AbstractTree for Index {
|
||||
fn run(&self, source: &str, context: &mut Map) -> Result<Value> {
|
||||
let value = self.collection.run(source, context)?;
|
||||
|
||||
println!("{self:?}");
|
||||
|
||||
match value {
|
||||
Value::List(list) => {
|
||||
let index = self.index.run(source, context)?.as_integer()? as usize;
|
||||
|
@ -114,13 +114,19 @@ module.exports = grammar({
|
||||
index: $ => prec.left(seq(
|
||||
$.expression,
|
||||
':',
|
||||
$.expression,
|
||||
$._index_expression,
|
||||
optional(seq(
|
||||
'..',
|
||||
$.expression,
|
||||
$._index_expression,
|
||||
)),
|
||||
)),
|
||||
|
||||
_index_expression: $ => prec(1,choice(
|
||||
$.integer,
|
||||
$.identifier,
|
||||
$.function_call,
|
||||
)),
|
||||
|
||||
math: $ => prec.left(seq(
|
||||
$.expression,
|
||||
$.math_operator,
|
||||
|
Loading…
Reference in New Issue
Block a user