revert to single expression from parse, but keep chains as implicit extension to expressions; use chained expressions to look up shorthands for hex, dec, bin, array counts, etc.

This commit is contained in:
Ryan Fleury
2025-04-15 13:07:59 -07:00
parent 1679aa6f64
commit 85f715f2ba
8 changed files with 103 additions and 53 deletions
+5 -5
View File
@@ -1942,7 +1942,7 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
type_kind == E_TypeKind_Enum))
{
got_commit_data = 1;
E_Expr *src_expr = e_parse_expr_from_text(scratch.arena, string).exprs.last;
E_Expr *src_expr = e_parse_expr_from_text(scratch.arena, string).expr;
E_Expr *src_expr__casted = e_expr_ref_cast(scratch.arena, type_key, src_expr);
E_Eval src_eval = e_eval_from_expr(scratch.arena, src_expr__casted);
commit_data = push_str8_copy(scratch.arena, str8_struct(&src_eval.value));
@@ -2096,7 +2096,7 @@ rd_query_from_eval_string(Arena *arena, String8 string)
String8 result = {0};
{
Temp scratch = scratch_begin(&arena, 1);
E_Expr *expr = e_parse_expr_from_text(scratch.arena, string).exprs.last;
E_Expr *expr = e_parse_expr_from_text(scratch.arena, string).expr;
if(expr->kind == E_ExprKind_LeafIdentifier &&
str8_match(expr->qualifier, str8_lit("query"), 0))
{
@@ -12045,7 +12045,7 @@ rd_frame(void)
//- rjf: add macro for 'call_stack' -> 'query:current_thread.callstack'
{
E_Expr *expr = e_parse_expr_from_text(scratch.arena, str8_lit("query:current_thread.call_stack")).exprs.first;
E_Expr *expr = e_parse_expr_from_text(scratch.arena, str8_lit("query:current_thread.call_stack")).expr;
e_string2expr_map_insert(scratch.arena, ctx->macro_map, str8_lit("call_stack"), expr);
}
@@ -12247,7 +12247,7 @@ rd_frame(void)
E_Parse parse = e_parse_expr_from_text(scratch.arena, expr);
if(parse.msgs.max_kind == E_MsgKind_Null)
{
for(E_Expr *expr = parse.exprs.first; expr != &e_expr_nil; expr = expr->next)
for(E_Expr *expr = parse.expr; expr != &e_expr_nil; expr = expr->next)
{
e_push_leaf_ident_exprs_from_expr__in_place(scratch.arena, ctx->macro_map, expr);
}
@@ -15707,7 +15707,7 @@ Z(getting_started)
ExprWalkTask *next;
E_Expr *expr;
};
E_Expr *expr = e_parse_expr_from_text(scratch.arena, src_bp_cnd).exprs.last;
E_Expr *expr = e_parse_expr_from_text(scratch.arena, src_bp_cnd).expr;
ExprWalkTask start_task = {0, expr};
ExprWalkTask *first_task = &start_task;
for(ExprWalkTask *t = first_task; t != 0; t = t->next)
+7 -7
View File
@@ -136,7 +136,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(watches)
if(cfg_idx < cfgs->count)
{
String8 expr_string = rd_cfg_child_from_string(cfgs->v[cfg_idx], str8_lit("expression"))->first->string;
exprs_out[idx] = e_parse_expr_from_text(arena, expr_string).exprs.first;
exprs_out[idx] = e_parse_expr_from_text(arena, expr_string).expr;
exprs_strings_out[idx] = push_str8_copy(arena, expr_string);
}
}
@@ -218,7 +218,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(locals)
for(U64 idx = 0; idx < read_range_count; idx += 1)
{
String8 expr_string = accel->v[read_range.min + idx];
exprs_out[idx] = e_parse_expr_from_text(arena, expr_string).exprs.last;
exprs_out[idx] = e_parse_expr_from_text(arena, expr_string).expr;
exprs_strings_out[idx] = push_str8_copy(arena, expr_string);
}
}
@@ -270,7 +270,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(registers)
String8 register_name = accel->v[read_range.min + idx];
String8 register_expr = push_str8f(arena, "reg:%S", register_name);
exprs_strings_out[idx] = register_name;
exprs_out[idx] = e_parse_expr_from_text(arena, register_expr).exprs.last;
exprs_out[idx] = e_parse_expr_from_text(arena, register_expr).expr;
}
}
@@ -400,7 +400,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
if(wrap_child_w_meta_expr)
{
Temp scratch = scratch_begin(&arena, 1);
E_Expr *expr = e_parse_expr_from_text(scratch.arena, child->first->string).exprs.first;
E_Expr *expr = e_parse_expr_from_text(scratch.arena, child->first->string).expr;
B32 expr_is_simple = 0;
if(expr->kind == E_ExprKind_LeafU64 ||
expr->kind == E_ExprKind_LeafF64 ||
@@ -428,8 +428,8 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
if(!md_node_is_nil(range))
{
Temp scratch = scratch_begin(&arena, 1);
E_Expr *min_bound = e_parse_expr_from_text(scratch.arena, range->first->string).exprs.first;
E_Expr *max_bound = e_parse_expr_from_text(scratch.arena, range->first->next->string).exprs.first;
E_Expr *min_bound = e_parse_expr_from_text(scratch.arena, range->first->string).expr;
E_Expr *max_bound = e_parse_expr_from_text(scratch.arena, range->first->next->string).expr;
E_Expr *args[] =
{
min_bound,
@@ -689,7 +689,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(cfgs)
{
Rng1U64 read_range = intersect_1u64(cmds_idx_range, idx_range);
U64 read_count = dim_1u64(read_range);
E_Expr *commands = e_parse_expr_from_text(arena, str8_lit("query:commands")).exprs.last;
E_Expr *commands = e_parse_expr_from_text(arena, str8_lit("query:commands")).expr;
E_IRTreeAndType commands_irtree = e_irtree_and_type_from_expr(arena, commands);
for(U64 idx = 0; idx < read_count; idx += 1, dst_idx += 1)
{
+1 -1
View File
@@ -1445,7 +1445,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
E_Expr *root_expr = row->eval.expr;
if(wrap_string.size != 0)
{
E_Expr *wrap_expr = e_parse_expr_from_text(scratch.arena, wrap_string).exprs.last;
E_Expr *wrap_expr = e_parse_expr_from_text(scratch.arena, wrap_string).expr;
root_expr = wrap_expr;
typedef struct Task Task;
struct Task