mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-25 05:04:58 -07:00
correctly apply root view rules; apply inherited view rule tags first, since we apply all view rules in order, and we want explicitly-stored tags (nearest to the expression) to be strongest
This commit is contained in:
@@ -447,6 +447,18 @@ internal void
|
||||
ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key, E_Expr *expr)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
// rjf: push inherited tags first (we want these to be found first, since tags are applied
|
||||
// in order, and explicit ones should always be strongest)
|
||||
for(EV_Block *b = block; b != &ev_nil_block; b = b->parent)
|
||||
{
|
||||
for(E_Expr *src_tag = b->expr->first_tag; src_tag != &e_expr_nil; src_tag = src_tag->next)
|
||||
{
|
||||
e_expr_push_tag(expr, e_expr_copy(arena, src_tag));
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: push explicitly-attached tags (via key) next
|
||||
String8 tag_expr = push_str8_copy(arena, ev_view_rule_from_key(view, key));
|
||||
E_TokenArray tag_expr_tokens = e_token_array_from_text(scratch.arena, tag_expr);
|
||||
E_Parse tag_expr_parse = e_parse_expr_from_text_tokens(arena, tag_expr, &tag_expr_tokens);
|
||||
@@ -455,13 +467,7 @@ ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key
|
||||
next = tag->next;
|
||||
e_expr_push_tag(expr, tag);
|
||||
}
|
||||
for(EV_Block *b = block; b != &ev_nil_block; b = b->parent)
|
||||
{
|
||||
for(E_Expr *src_tag = b->expr->first_tag; src_tag != &e_expr_nil; src_tag = src_tag->next)
|
||||
{
|
||||
e_expr_push_tag(expr, e_expr_copy(arena, src_tag));
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -478,10 +484,11 @@ ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 s
|
||||
|
||||
//- rjf: produce root expression
|
||||
EV_Key root_key = ev_key_root();
|
||||
EV_Key root_row_key = ev_key_make(ev_hash_from_key(root_key), 1);
|
||||
E_TokenArray root_tokens = e_token_array_from_text(scratch.arena, string);
|
||||
E_Parse root_parse = e_parse_expr_from_text_tokens(arena, string, &root_tokens);
|
||||
E_Expr *root_expr = root_parse.expr;
|
||||
ev_keyed_expr_push_tags(arena, view, &ev_nil_block, root_key, root_expr);
|
||||
ev_keyed_expr_push_tags(arena, view, &ev_nil_block, root_row_key, root_expr);
|
||||
|
||||
//- rjf: generate root block
|
||||
tree.root = push_array(arena, EV_Block, 1);
|
||||
|
||||
Reference in New Issue
Block a user