JSAbrahams / mamba

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

`id : type` is now an expression #87

Closed JSAbrahams closed 5 years ago

JSAbrahams commented 5 years ago

Relevant issues

...

Summary

This allows us to use id : types in matches for instance. Therefore, id : type is now an expression. However, another bug was uncovered. 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.

Added Tests

...

Additional Context

...

codecov[bot] commented 5 years ago

Codecov Report

Merging #87 into master will decrease coverage by <.01%. The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
- Coverage   83.44%   83.44%   -0.01%     
==========================================
  Files          63       63              
  Lines        4108     4113       +5     
==========================================
+ Hits         3428     3432       +4     
- Misses        680      681       +1
Impacted Files Coverage Δ
src/parser/control_flow_expr.rs 88.13% <100%> (-0.58%) :arrow_down:
src/parser/_type.rs 87.67% <87.5%> (-0.01%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 20d28bf...3fb9736. Read the comment docs.