Browse Source

Fix compound op with identifier first

github-actions
Garrit Franke 2 years ago
parent
commit
c1ead8ddc9
  1. 1
      TODO
  2. 5
      examples/playground.sb
  3. 2
      src/parser/mod.rs
  4. 1
      src/parser/tests.rs

1
TODO

@ -1,5 +1,4 @@
# Bugs
- Fix `parser::tests::test_parse_compound_ops_with_identifier_first` test
# Features

5
examples/playground.sb

@ -1,12 +1,11 @@
main :: () {
fn main() {
let num = 10
return fib(num)
}
fib :: (n) {
fn fib(n) {
if 1 >= n {
return n
}
return fib(n-1) + fib(n-2)
}

2
src/parser/mod.rs

@ -292,7 +292,7 @@ impl Parser {
}
}
_ => match BinOp::try_from(self.peek().ok_or("Could not peek token")?.kind) {
Ok(_) => self.parse_bin_op(None)?,
Ok(_) => self.parse_bin_op(Some(Expression::Variable(token.raw)))?,
Err(_) => Expression::Variable(val),
},
};

1
src/parser/tests.rs

@ -211,7 +211,6 @@ fn test_parse_compound_ops_with_identifier() {
}
#[test]
#[ignore]
fn test_parse_compound_ops_with_identifier_first() {
let raw = "
fn main(n) {

Loading…
Cancel
Save