JSAbrahams / mamba

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

Match expressions can't have nested matches #88

Closed JSAbrahams closed 2 years ago

JSAbrahams commented 5 years ago

Description of Bug

If we nest matches, the dedent after the nested is consumed, meaning that the expression of the next match arm comes immediately after (without a dedent in between), meaning that is is interpreted as a call (left is match, right is expression of next arm).

One fix to this was always following dedents by a newline. However, this resulted in the issue where the parser had no way of detecting, for instance, an else in an if statement after a block, as this was hiding behind a newline, as opposed to immediately following a dedent. Therefore, it might be time to reconsider the grammar and how if statements operate.

How to Reproduce

  1. Create match statement
  2. Create nested match
  3. Follow nested match by another arm

Expected behavior

The nested match should be its own expression.

Additional context

...

JSAbrahams commented 5 years ago

Release 0.1.0 is taking too long, so I will leave it as a "known bug" and move this to a later release.

JSAbrahams commented 2 years ago

This appears to already have been solved.