From 4c3c4314a6e59a70b21fec252a184aa497e57e3d Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Sun, 12 Dec 2021 21:06:52 -0600 Subject: [PATCH] temporary changes --- include/astnodes.h | 2 +- src/parser.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/astnodes.h b/include/astnodes.h index db33aef1..ac9499a4 100644 --- a/include/astnodes.h +++ b/include/astnodes.h @@ -955,7 +955,7 @@ struct AstDistinctType { // Top level nodes struct AstBinding { AstTyped_base; AstNode* node; }; struct AstAlias { AstTyped_base; AstTyped* alias; }; -struct AstInclude { AstNode_base; char* name; }; +struct AstInclude { AstNode_base; AstNode* name_node; char* name; }; struct AstMemRes { AstTyped_base; u64 addr; diff --git a/src/parser.c b/src/parser.c index 81cfee8f..f4f8b1b6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2954,13 +2954,16 @@ static void parse_top_level_statement(OnyxParser* parser) { if (parse_possible_directive(parser, "load")) { AstInclude* include = make_node(AstInclude, Ast_Kind_Load_File); include->token = dir_token; + include->name_node = parse_expression(parser, 0); + /* nocheckin OnyxToken* str_token = expect_token(parser, Token_Type_Literal_String); if (str_token != NULL) { token_toggle_end(str_token); include->name = bh_strdup(parser->allocator, str_token->text); token_toggle_end(str_token); } + */ ENTITY_SUBMIT(include); return; @@ -2968,13 +2971,16 @@ static void parse_top_level_statement(OnyxParser* parser) { else if (parse_possible_directive(parser, "load_path")) { AstInclude* include = make_node(AstInclude, Ast_Kind_Load_Path); include->token = dir_token; + include->name_node = parse_expression(parser, 0); + /* nocheckin OnyxToken* str_token = expect_token(parser, Token_Type_Literal_String); if (str_token != NULL) { token_toggle_end(str_token); include->name = bh_strdup(parser->allocator, str_token->text); token_toggle_end(str_token); } + */ ENTITY_SUBMIT(include); return; @@ -2982,13 +2988,16 @@ static void parse_top_level_statement(OnyxParser* parser) { else if (parse_possible_directive(parser, "library_path")) { AstInclude* include = make_node(AstInclude, Ast_Kind_Library_Path); include->token = dir_token; - + include->name_node = parse_expression(parser, 0); + + /* nocheckin OnyxToken* str_token = expect_token(parser, Token_Type_Literal_String); if (str_token != NULL) { token_toggle_end(str_token); include->name = bh_strdup(parser->allocator, str_token->text); token_toggle_end(str_token); } + */ ENTITY_SUBMIT(include); return; -- 2.25.1