mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
allow implicit namespacification of identifier mapping path in eval parser, based on namespace of the procedure (if any) that the instruction pointer is currently within
This commit is contained in:
@@ -789,6 +789,35 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
|||||||
TG_Key type_key = zero_struct;
|
TG_Key type_key = zero_struct;
|
||||||
String8 local_lookup_string = token_string;
|
String8 local_lookup_string = token_string;
|
||||||
|
|
||||||
|
//- rjf: form namespaceify fallback
|
||||||
|
String8 namespaceified_token_string = token_string;
|
||||||
|
if(ctx->rdbg->procedures != 0 && ctx->rdbg->scopes != 0 && ctx->rdbg->scope_vmap != 0)
|
||||||
|
{
|
||||||
|
U64 scope_idx = raddbg_vmap_idx_from_voff(ctx->rdbg->scope_vmap, ctx->rdbg->scope_vmap_count, ctx->ip_voff);
|
||||||
|
RADDBG_Scope *scope = &ctx->rdbg->scopes[scope_idx];
|
||||||
|
U64 proc_idx = scope->proc_idx;
|
||||||
|
RADDBG_Procedure *procedure = &ctx->rdbg->procedures[proc_idx];
|
||||||
|
U64 name_size = 0;
|
||||||
|
U8 *name_ptr = raddbg_string_from_idx(ctx->rdbg, procedure->name_string_idx, &name_size);
|
||||||
|
String8 name = str8(name_ptr, name_size);
|
||||||
|
U64 past_scope_resolution_pos = 0;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
U64 past_next_dbl_colon_pos = str8_find_needle(name, past_scope_resolution_pos, str8_lit("::"), 0)+2;
|
||||||
|
U64 past_next_dot_pos = str8_find_needle(name, past_scope_resolution_pos, str8_lit("."), 0)+1;
|
||||||
|
U64 past_next_scope_resolution_pos = Min(past_next_dbl_colon_pos, past_next_dot_pos);
|
||||||
|
if(past_next_scope_resolution_pos < name.size)
|
||||||
|
{
|
||||||
|
past_scope_resolution_pos = past_next_scope_resolution_pos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namespaceified_token_string = push_str8f(scratch.arena, "%S%S", str8_prefix(name, past_scope_resolution_pos), token_string);
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: try members
|
//- rjf: try members
|
||||||
if(mapped_identifier == 0)
|
if(mapped_identifier == 0)
|
||||||
{
|
{
|
||||||
@@ -888,6 +917,12 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
|||||||
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
||||||
U32 matches_count = 0;
|
U32 matches_count = 0;
|
||||||
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
if(matches_count == 0)
|
||||||
|
{
|
||||||
|
node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, namespaceified_token_string.str, namespaceified_token_string.size);
|
||||||
|
matches_count = 0;
|
||||||
|
matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
}
|
||||||
if(matches_count != 0)
|
if(matches_count != 0)
|
||||||
{
|
{
|
||||||
U32 match_idx = matches[0];
|
U32 match_idx = matches[0];
|
||||||
@@ -918,6 +953,12 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
|||||||
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
||||||
U32 matches_count = 0;
|
U32 matches_count = 0;
|
||||||
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
if(matches_count == 0)
|
||||||
|
{
|
||||||
|
node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, namespaceified_token_string.str, namespaceified_token_string.size);
|
||||||
|
matches_count = 0;
|
||||||
|
matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
}
|
||||||
if(matches_count != 0)
|
if(matches_count != 0)
|
||||||
{
|
{
|
||||||
U32 match_idx = matches[0];
|
U32 match_idx = matches[0];
|
||||||
@@ -948,6 +989,12 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
|||||||
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
RADDBG_NameMapNode *node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, token_string.str, token_string.size);
|
||||||
U32 matches_count = 0;
|
U32 matches_count = 0;
|
||||||
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
U32 *matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
if(matches_count == 0)
|
||||||
|
{
|
||||||
|
node = raddbg_name_map_lookup(ctx->rdbg, &parsed_name_map, namespaceified_token_string.str, namespaceified_token_string.size);
|
||||||
|
matches_count = 0;
|
||||||
|
matches = raddbg_matches_from_map_node(ctx->rdbg, node, &matches_count);
|
||||||
|
}
|
||||||
if(matches_count != 0)
|
if(matches_count != 0)
|
||||||
{
|
{
|
||||||
U32 match_idx = matches[0];
|
U32 match_idx = matches[0];
|
||||||
|
|||||||
@@ -1,7 +1,20 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace SomeWeirdNamespace
|
||||||
|
{
|
||||||
|
int X = 0;
|
||||||
|
int Y = 0;
|
||||||
|
void Foo(void)
|
||||||
|
{
|
||||||
|
X = 123;
|
||||||
|
Y = 456;
|
||||||
|
int x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::fstream temp;
|
std::fstream temp;
|
||||||
|
SomeWeirdNamespace::Foo();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user