summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/parse.c b/parse.c
index 2f5cd2e..e8b7376 100644
--- a/parse.c
+++ b/parse.c
@@ -649,6 +649,8 @@ static bool parse_args(Parser *p, Array *args) {
return true;
}
+static void fprint_expr(FILE *out, Expression *e);
+
static bool parse_expr(Parser *p, Expression *e, Token *end) {
Tokenizer *t = p->tokr;
e->flags = 0;
@@ -813,14 +815,15 @@ static bool parse_expr(Parser *p, Expression *e, Token *end) {
if (token->kind == TOKEN_KW) {
switch (token->kw) {
case KW_LPAREN:
- if (square_level == 0 && paren_level == 0 && token != t->tokens.data
+ if (square_level == 0 && paren_level == 0 && brace_level == 0
+ && token != t->tokens.data
&& token[-1].kind != TOKEN_DIRECT /* don't include directives */)
opening_bracket = token; /* maybe this left parenthesis opens the function call */
paren_level++;
break;
case KW_LSQUARE:
- if (square_level == 0 && paren_level == 0)
- opening_bracket = token; /* ^^ (array access) */
+ if (square_level == 0 && paren_level == 0 && brace_level == 0)
+ opening_bracket = token; /* (array access) */
square_level++;
break;
case KW_RPAREN:
@@ -829,6 +832,12 @@ static bool parse_expr(Parser *p, Expression *e, Token *end) {
case KW_RSQUARE:
square_level--;
break;
+ case KW_LBRACE:
+ brace_level++;
+ break;
+ case KW_RBRACE:
+ brace_level--;
+ break;
default: break;
}