1
0

Modify index syntax; Clean up

This commit is contained in:
Jeff 2023-11-13 15:41:55 -05:00
parent e9e4e92f68
commit c86f61e1cd
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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,