aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/odin/ast/ast.odin2
-rw-r--r--core/odin/parser/parser.odin10
-rw-r--r--src/parser.cpp2
3 files changed, 8 insertions, 6 deletions
diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin
index be541befa..7891fb12d 100644
--- a/core/odin/ast/ast.odin
+++ b/core/odin/ast/ast.odin
@@ -538,7 +538,7 @@ Foreign_Import_Decl :: struct {
import_tok: tokenizer.Token,
name: ^Ident,
collection_name: string,
- fullpaths: []string,
+ fullpaths: []^Expr,
comment: ^Comment_Group,
}
diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin
index e32fbdced..813585ba4 100644
--- a/core/odin/parser/parser.odin
+++ b/core/odin/parser/parser.odin
@@ -1190,12 +1190,12 @@ parse_foreign_decl :: proc(p: ^Parser) -> ^ast.Decl {
error(p, name.pos, "illegal foreign import name: '_'")
}
- fullpaths: [dynamic]string
+ fullpaths: [dynamic]^ast.Expr
if allow_token(p, .Open_Brace) {
for p.curr_tok.kind != .Close_Brace &&
p.curr_tok.kind != .EOF {
- path := expect_token(p, .String)
- append(&fullpaths, path.text)
+ path := parse_expr(p, false)
+ append(&fullpaths, path)
allow_token(p, .Comma) or_break
}
@@ -1203,7 +1203,9 @@ parse_foreign_decl :: proc(p: ^Parser) -> ^ast.Decl {
} else {
path := expect_token(p, .String)
reserve(&fullpaths, 1)
- append(&fullpaths, path.text)
+ bl := ast.new(ast.Basic_Lit, path.pos, end_pos(path))
+ bl.tok = tok
+ append(&fullpaths, bl)
}
if len(fullpaths) == 0 {
diff --git a/src/parser.cpp b/src/parser.cpp
index 7e72f3c21..c004a8f65 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -4894,7 +4894,7 @@ gb_internal Ast *parse_foreign_decl(AstFile *f) {
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
- Ast *path = parse_expr(f, true);
+ Ast *path = parse_expr(f, false);
array_add(&filepaths, path);
if (!allow_field_separator(f)) {