aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-26 21:39:49 +0100
committergingerBill <bill@gingerbill.org>2021-04-26 21:39:49 +0100
commit7e0c78eae72791e0da5cd9c279677c505eb8ead7 (patch)
treee3d0d5dcc4dfaf8e93ee6a177e3f0b3e43cba6ca /src/parser.cpp
parent6d1eb473cf43c02e5dc7c928d5588f88b8755354 (diff)
Fix logic for `\n` ignoring
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 237199739..aff7c6bc7 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1971,12 +1971,21 @@ Ast *parse_operand(AstFile *f, bool lhs) {
break;
case Token_OpenParen: {
+ bool allow_newline;
Token open, close;
// NOTE(bill): Skip the Paren Expression
open = expect_token(f, Token_OpenParen);
+ allow_newline = f->allow_newline;
+ if (f->expr_level < 0) {
+ f->allow_newline = false;
+ }
+
f->expr_level++;
operand = parse_expr(f, false);
f->expr_level--;
+
+ f->allow_newline = allow_newline;
+
close = expect_token(f, Token_CloseParen);
return ast_paren_expr(f, operand, open, close);
}