From c5761bc3b1804b929ab917044fb7c67a5f1b053e Mon Sep 17 00:00:00 2001 From: bakk Date: Mon, 31 May 2021 14:00:24 +0200 Subject: [PATCH] Fixed custom groups not multiplying implicitly --- kalk/src/parser.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kalk/src/parser.rs b/kalk/src/parser.rs index a3ce17d..28c5917 100644 --- a/kalk/src/parser.rs +++ b/kalk/src/parser.rs @@ -409,13 +409,19 @@ fn parse_factor(context: &mut Context) -> Result { || match_token(context, TokenKind::Identifier) || match_token(context, TokenKind::Literal) || match_token(context, TokenKind::OpenParenthesis) + || match_token(context, TokenKind::OpenCeil) + || match_token(context, TokenKind::OpenFloor) + || match_token(context, TokenKind::OpenBracket) { // If the token is an identifier, literal, or open parenthesis, // assume it's multiplication. Eg. 3y or (3x + 2)(2 + 3) let op = match peek(context).kind { - TokenKind::Identifier | TokenKind::Literal | TokenKind::OpenParenthesis => { - TokenKind::Star - } + TokenKind::Identifier + | TokenKind::Literal + | TokenKind::OpenParenthesis + | TokenKind::OpenCeil + | TokenKind::OpenFloor + | TokenKind::OpenBracket => TokenKind::Star, _ => advance(context).kind, };