diff --git a/src/abstract_tree/index.rs b/src/abstract_tree/index.rs index 772bfcc..59b6ab3 100644 --- a/src/abstract_tree/index.rs +++ b/src/abstract_tree/index.rs @@ -35,8 +35,6 @@ impl AbstractTree for Index { fn run(&self, source: &str, context: &mut Map) -> Result { 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; diff --git a/tree-sitter-dust/grammar.js b/tree-sitter-dust/grammar.js index 0b08d0a..bd38561 100644 --- a/tree-sitter-dust/grammar.js +++ b/tree-sitter-dust/grammar.js @@ -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,