Skip to content

Commit

Permalink
Support implicit multiplication for group RHS
Browse files Browse the repository at this point in the history
Now, `4(10 kg)(20 kg)` is equivalent to `4 * (10 kg) * (10 kg)`.
  • Loading branch information
kdkasad committed Oct 5, 2022
1 parent 227631a commit 7a84f0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ impl Parser {
let mut implicit = false;
let op: Operation = match *tok {
Token::Operator(op) => op,
Token::Ident(_) => {
Token::Ident(_) | Token::GroupBegin => {
implicit = true;
Operation::Multiply
}
Token::GroupEnd => break,
Token::Number(_) | Token::GroupBegin => {
Token::Number(_) => {
return Err(ParseError::ExpectedToken("operator", tok.into()))
}
Token::Illegal(c) => return Err(ParseError::IllegalToken(c)),
Expand Down

0 comments on commit 7a84f0d

Please sign in to comment.