aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-04-26 19:43:17 +0100
committerGinger Bill <bill@gingerbill.org>2017-04-26 19:43:17 +0100
commit5b8be2593821c7b30adf010bc90dfa8ab2930a72 (patch)
tree8d251da1cf54b6771f9b849ec9dc7862d8eb333f /src/parser.c
parent29efdc5fc15b760e773b767ab81e0e825b3b85f7 (diff)
`fmt.String_Buffer`, Fix issue #44, Tweak overloading rules
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/parser.c b/src/parser.c
index 962a04afd..a0a215789 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -33,6 +33,7 @@ typedef struct AstFile {
// NOTE(bill): Used to prevent type literals in control clauses
isize expr_level;
bool allow_range;
+ bool ignore_operand;
AstNodeArray decls;
bool is_global_scope;
@@ -1849,10 +1850,7 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
}
}
- Token begin = f->curr_token;
- syntax_error(begin, "Expected an operand");
- fix_advance_to_next_stmt(f);
- return ast_bad_expr(f, begin, f->curr_token);
+ return NULL;
}
bool is_literal_type(AstNode *node) {
@@ -1937,6 +1935,12 @@ AstNode *parse_macro_call_expr(AstFile *f, AstNode *operand) {
AstNode *parse_atom_expr(AstFile *f, bool lhs) {
AstNode *operand = parse_operand(f, lhs);
+ if (operand == NULL) {
+ Token begin = f->curr_token;
+ syntax_error(begin, "Expected an operand");
+ fix_advance_to_next_stmt(f);
+ operand = ast_bad_expr(f, begin, f->curr_token);
+ }
bool loop = true;
while (loop) {