diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 06567384..e086efdb 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -1654,7 +1654,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS U64 num = 1; for(U64 reg_idx = 1; reg_idx < reg_count; reg_idx += 1, num += 1) { - String8 root_expr_string = reg_strings[reg_idx]; + String8 root_expr_string = push_str8f(scratch.arena, "reg:%S", reg_strings[reg_idx]); FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); if(matches.count == matches.needle_part_count) { @@ -1666,7 +1666,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS } for(U64 alias_idx = 1; alias_idx < alias_count; alias_idx += 1, num += 1) { - String8 root_expr_string = alias_strings[alias_idx]; + String8 root_expr_string = push_str8f(scratch.arena, "reg:%S", alias_strings[alias_idx]); FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); if(matches.count == matches.needle_part_count) { diff --git a/src/eval/eval.mdesk b/src/eval/eval.mdesk index 8747a105..b46d0a53 100644 --- a/src/eval/eval.mdesk +++ b/src/eval/eval.mdesk @@ -120,6 +120,7 @@ E_ExprKindTable: { LeafF32 Null 0 "F32" "" "" "" } { LeafIdent Null 0 "leaf_ident" "" "" "" } { LeafID Null 0 "leaf_id" "" "" "" } + { LeafFilePath Null 0 "leaf_filepath" "" "" "" } { TypeIdent Null 0 "type_ident" "" "" "" } { Ptr Null 0 "ptr" "" "" "" } diff --git a/src/eval/eval_parse.c b/src/eval/eval_parse.c index 5d20440e..b141273f 100644 --- a/src/eval/eval_parse.c +++ b/src/eval/eval_parse.c @@ -1149,6 +1149,21 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to E_Token token = e_token_at_it(it, tokens); String8 token_string = str8_substr(text, token.range); + //- rjf: gather resolution qualifier + String8 resolution_qualifier = {0}; + if(token.kind == E_TokenKind_Identifier) + { + E_Token next_token = e_token_at_it(it+1, tokens); + String8 next_token_string = str8_substr(text, next_token.range); + if(next_token.kind == E_TokenKind_Symbol && str8_match(next_token_string, str8_lit(":"), 0)) + { + it += 2; + resolution_qualifier = token_string; + token = e_token_at_it(it, tokens); + token_string = str8_substr(text, token.range); + } + } + //- rjf: descent to nested expression if(token.kind == E_TokenKind_Symbol && str8_match(token_string, str8_lit("("), 0)) { @@ -1283,7 +1298,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try members - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("member"), 0))) { U64 data_member_num = e_num_from_string(e_parse_ctx->member_map, token_string); if(data_member_num != 0) @@ -1294,7 +1309,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try locals - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("local"), 0))) { E_Module *module = e_parse_ctx->primary_module; RDI_Parsed *rdi = module->rdi; @@ -1358,7 +1373,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try registers - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("reg"), 0))) { U64 reg_num = e_num_from_string(e_parse_ctx->regs_map, token_string); if(reg_num != 0) @@ -1372,7 +1387,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try register aliases - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("reg"), 0))) { U64 alias_num = e_num_from_string(e_parse_ctx->reg_alias_map, token_string); if(alias_num != 0) @@ -1386,7 +1401,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try global variables - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("global"), 0))) { for(U64 module_idx = 0; module_idx < e_parse_ctx->modules_count; module_idx += 1) { @@ -1430,7 +1445,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try thread variables - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("thread_variable"), 0))) { for(U64 module_idx = 0; module_idx < e_parse_ctx->modules_count; module_idx += 1) { @@ -1470,7 +1485,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try procedures - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("procedure"), 0))) { for(U64 module_idx = 0; module_idx < e_parse_ctx->modules_count; module_idx += 1) { @@ -1512,7 +1527,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } //- rjf: try types - if(mapped_identifier == 0) + if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("type"), 0))) { type_key = e_leaf_type_from_name(token_string); if(!e_type_key_match(e_type_key_zero(), type_key)) @@ -1718,14 +1733,25 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to } }break; - // rjf: string => leaf string literal + // rjf: string => leaf string literal, or file path case E_TokenKind_StringLiteral: { - String8 string_value_escaped = str8_chop(str8_skip(token_string, 1), 1); - String8 string_value_raw = e_raw_from_escaped_string(arena, string_value_escaped); - atom = e_push_expr(arena, E_ExprKind_LeafStringLiteral, token_string.str); - atom->string = string_value_raw; - it += 1; + if(str8_match(resolution_qualifier, str8_lit("file"), 0)) + { + String8 string_value_escaped = str8_chop(str8_skip(token_string, 1), 1); + String8 string_value_raw = e_raw_from_escaped_string(arena, string_value_escaped); + atom = e_push_expr(arena, E_ExprKind_LeafFilePath, token_string.str); + atom->string = string_value_raw; + it += 1; + } + else + { + String8 string_value_escaped = str8_chop(str8_skip(token_string, 1), 1); + String8 string_value_raw = e_raw_from_escaped_string(arena, string_value_escaped); + atom = e_push_expr(arena, E_ExprKind_LeafStringLiteral, token_string.str); + atom->string = string_value_raw; + it += 1; + } }break; } diff --git a/src/eval/generated/eval.meta.c b/src/eval/generated/eval.meta.c index c2198519..75cf1e5b 100644 --- a/src/eval/generated/eval.meta.c +++ b/src/eval/generated/eval.meta.c @@ -14,7 +14,7 @@ str8_lit_comp("CharLiteral"), str8_lit_comp("Symbol"), }; -String8 e_expr_kind_strings[43] = +String8 e_expr_kind_strings[44] = { str8_lit_comp("Nil"), str8_lit_comp("Ref"), @@ -54,6 +54,7 @@ str8_lit_comp("LeafF64"), str8_lit_comp("LeafF32"), str8_lit_comp("LeafIdent"), str8_lit_comp("LeafID"), +str8_lit_comp("LeafFilePath"), str8_lit_comp("TypeIdent"), str8_lit_comp("Ptr"), str8_lit_comp("Array"), @@ -76,7 +77,7 @@ str8_lit_comp("Insufficient evaluation machine stack space."), str8_lit_comp("Malformed bytecode."), }; -E_OpInfo e_expr_kind_op_info_table[43] = +E_OpInfo e_expr_kind_op_info_table[44] = { { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Nil") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Ref") }, @@ -116,6 +117,7 @@ E_OpInfo e_expr_kind_op_info_table[43] = { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("LeafF32") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("LeafIdent") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("LeafID") }, +{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("LeafFilePath") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("TypeIdent") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Ptr") }, { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Array") }, diff --git a/src/eval/generated/eval.meta.h b/src/eval/generated/eval.meta.h index 26ea67fc..48dfcb2d 100644 --- a/src/eval/generated/eval.meta.h +++ b/src/eval/generated/eval.meta.h @@ -128,6 +128,7 @@ E_ExprKind_LeafF64, E_ExprKind_LeafF32, E_ExprKind_LeafIdent, E_ExprKind_LeafID, +E_ExprKind_LeafFilePath, E_ExprKind_TypeIdent, E_ExprKind_Ptr, E_ExprKind_Array, @@ -154,9 +155,9 @@ E_InterpretationCode_COUNT, C_LINKAGE_BEGIN extern String8 e_token_kind_strings[6]; -extern String8 e_expr_kind_strings[43]; +extern String8 e_expr_kind_strings[44]; extern String8 e_interpretation_code_display_strings[11]; -extern E_OpInfo e_expr_kind_op_info_table[43]; +extern E_OpInfo e_expr_kind_op_info_table[44]; extern U8 e_kind_basic_byte_size_table[55]; extern String8 e_kind_basic_string_table[55];