JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
88 stars 4 forks source link

Parse list indices #251

Closed JSAbrahams closed 2 years ago

JSAbrahams commented 2 years ago

Current Issue

Mentioned in #172

Mamba cannot parse list indices.

High-level description of the feature

Parse it somewhat similar to operation, if expression followed by [ parse as list index. What is within that operator is a range, which has a :

With the following structure:

range :=  [ [ '-' int] [ ( ':' ) | ':' [ '-' ] int ) ] [ [ - ] int ]
JSAbrahams commented 2 years ago

Note quite as describes above, but close (we generatlize to expressions ofc since we also want to accepgt e.g. function calls). The most up-to-date grammar can be found inspec/grammar.md