summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-11-30 18:02:53 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-11-30 18:02:53 -0500
commit469ed2a877aeadc5286e08fcaee77ce31268495c (patch)
treec8f777a196f5cca614bba41b073f75b7fbd52a88 /parse.c
parent8f996b4ac75c7c62f04f09fffa81a686c1f74ab6 (diff)
fixed bug
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 68e1652..cc198cc 100644
--- a/parse.c
+++ b/parse.c
@@ -290,7 +290,9 @@ typedef enum {
EXPR_CAN_END_WITH_COMMA = 0x01, /* a comma could end the expression */
EXPR_CAN_END_WITH_LBRACE = 0x02,
EXPR_CAN_END_WITH_COLON = 0x04,
- EXPR_CAN_END_WITH_DOTDOT = 0x08
+ EXPR_CAN_END_WITH_DOTDOT = 0x08,
+ EXPR_CAN_END_WITH_EQ = 0x10,
+ /* note that parse_type uses -1 for this */
} ExprEndFlags;
/* is_vbs can be NULL */
static Token *expr_find_end(Parser *p, ExprEndFlags flags, bool *is_vbs) {
@@ -351,6 +353,10 @@ static Token *expr_find_end(Parser *p, ExprEndFlags flags, bool *is_vbs) {
if (brace_level == 0 && square_level == 0 && paren_level == 0 && (flags & EXPR_CAN_END_WITH_DOTDOT))
return token;
break;
+ case KW_EQ:
+ if (brace_level == 0 && square_level == 0 && paren_level == 0 && (flags & EXPR_CAN_END_WITH_EQ))
+ return token;
+ break;
case KW_COLON:
if ((flags & EXPR_CAN_END_WITH_COLON)
&& brace_level == 0 && square_level == 0 && paren_level == 0)
@@ -599,7 +605,8 @@ static bool parse_type(Parser *p, Type *type) {
break;
default:
/* TYPE_EXPR */
- if (parse_expr(p, type->expr = parser_new_expr(p), expr_find_end(p, 0, NULL))) {
+ if (parse_expr(p, type->expr = parser_new_expr(p),
+ expr_find_end(p, -1 /* end as soon as possible */, NULL))) {
type->kind = TYPE_EXPR;
} else {
tokr_err(t, "Unrecognized type.");