aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-11-02 15:21:23 +0000
committergingerBill <gingerBill@users.noreply.github.com>2025-11-02 15:21:23 +0000
commit2d5b431b859754666b8342f042fa98413cb4fa29 (patch)
tree39de2618cc96f6f674fb949acd789e43c5aff631 /core
parentee36f6fe33d41a37ea7d9cdc32d67d05c78d54e6 (diff)
parent22a82f7c88881ef5692f2d8c012c69c86691dd04 (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
Diffstat (limited to 'core')
-rw-r--r--core/odin/parser/parser.odin17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin
index 7ebe275ed..9ce484a10 100644
--- a/core/odin/parser/parser.odin
+++ b/core/odin/parser/parser.odin
@@ -3210,6 +3210,17 @@ parse_call_expr :: proc(p: ^Parser, operand: ^ast.Expr) -> ^ast.Expr {
return ce
}
+empty_selector_expr :: proc(tok: tokenizer.Token, operand: ^ast.Expr) -> ^ast.Selector_Expr {
+ field := ast.new(ast.Ident, tok.pos, end_pos(tok))
+ field.name = ""
+
+ sel := ast.new(ast.Selector_Expr, operand.pos, field)
+ sel.expr = operand
+ sel.op = tok
+ sel.field = field
+
+ return sel
+}
parse_atom_expr :: proc(p: ^Parser, value: ^ast.Expr, lhs: bool) -> (operand: ^ast.Expr) {
operand = value
@@ -3343,8 +3354,7 @@ parse_atom_expr :: proc(p: ^Parser, value: ^ast.Expr, lhs: bool) -> (operand: ^a
case:
error(p, p.curr_tok.pos, "expected a selector")
- advance_token(p)
- operand = ast.new(ast.Bad_Expr, operand.pos, end_pos(tok))
+ operand = empty_selector_expr(tok, operand)
}
case .Arrow_Right:
@@ -3361,8 +3371,7 @@ parse_atom_expr :: proc(p: ^Parser, value: ^ast.Expr, lhs: bool) -> (operand: ^a
operand = sel
case:
error(p, p.curr_tok.pos, "expected a selector")
- advance_token(p)
- operand = ast.new(ast.Bad_Expr, operand.pos, end_pos(tok))
+ operand = empty_selector_expr(tok, operand)
}
case .Pointer: