support size_of and type_of in clike expressions

This commit is contained in:
Ryan Fleury
2026-06-26 11:28:01 -06:00
parent 9491fdf5c2
commit 60b266a1cc
5 changed files with 40 additions and 36 deletions
+1 -1
View File
@@ -7,6 +7,7 @@ target:
working_directory: "../raddebugger" working_directory: "../raddebugger"
arguments: "--user:C:/devel/raddebugger/build/raddbg_test.user" arguments: "--user:C:/devel/raddebugger/build/raddbg_test.user"
debug_subprocesses: 0 debug_subprocesses: 0
enabled: 1
} }
target: target:
{ {
@@ -66,5 +67,4 @@ target:
{ {
executable: "build/ryan_scratch.exe" executable: "build/ryan_scratch.exe"
working_directory: build working_directory: build
enabled: 1
} }
+34 -32
View File
@@ -90,38 +90,40 @@ E2_LangKindTable:
@table(name parse_kind precedence pre sep pos chain) @table(name parse_kind precedence pre sep pos chain)
E2_ExprKindParseInfoTable_CLike: E2_ExprKindParseInfoTable_CLike:
{ {
{Index Binary 1 "" "[" "]" "" } {Index Binary 1 "" "[" "]" "" }
{Call Call 1 "" "(" ")" ","} {Call Call 1 "" "(" ")" ","}
{DerefAsm UnaryPrefix 1 "[" "" "]" "" } {DerefAsm UnaryPrefix 1 "[" "" "]" "" }
{SizeOf UnaryPrefix 1 "sizeof " "" "" "" } {SizeOf UnaryPrefix 1 "sizeof " "" "" "" }
{TypeOf UnaryPrefix 1 "typeof " "" "" "" } {TypeOf UnaryPrefix 1 "typeof " "" "" "" }
{CCast UnaryPrefix 1 "" "" "" "" } {SizeOf UnaryPrefix 1 "size_of " "" "" "" }
{Deref UnaryPrefix 2 "*" "" "" "" } {TypeOf UnaryPrefix 1 "type_of " "" "" "" }
{Address UnaryPrefix 2 "&" "" "" "" } {CCast UnaryPrefix 1 "" "" "" "" }
{Pos UnaryPrefix 2 "+" "" "" "" } {Deref UnaryPrefix 2 "*" "" "" "" }
{Neg UnaryPrefix 2 "-" "" "" "" } {Address UnaryPrefix 2 "&" "" "" "" }
{LogNot UnaryPrefix 2 "!" "" "" "" } {Pos UnaryPrefix 2 "+" "" "" "" }
{BitNot UnaryPrefix 2 "~" "" "" "" } {Neg UnaryPrefix 2 "-" "" "" "" }
{Ptr UnaryPostfix 1 "" "" "*" "" } {LogNot UnaryPrefix 2 "!" "" "" "" }
{Mul Binary 3 "" "*" "" "" } {BitNot UnaryPrefix 2 "~" "" "" "" }
{Div Binary 3 "" "/" "" "" } {Ptr UnaryPostfix 1 "" "" "*" "" }
{Mod Binary 3 "" "%" "" "" } {Mul Binary 3 "" "*" "" "" }
{Add Binary 4 "" "+" "" "" } {Div Binary 3 "" "/" "" "" }
{Sub Binary 4 "" "-" "" "" } {Mod Binary 3 "" "%" "" "" }
{LShift Binary 5 "" "<<" "" "" } {Add Binary 4 "" "+" "" "" }
{RShift Binary 5 "" ">>" "" "" } {Sub Binary 4 "" "-" "" "" }
{Less Binary 6 "" "<" "" "" } {LShift Binary 5 "" "<<" "" "" }
{LtEq Binary 6 "" "<=" "" "" } {RShift Binary 5 "" ">>" "" "" }
{Grtr Binary 6 "" ">" "" "" } {Less Binary 6 "" "<" "" "" }
{GrEq Binary 6 "" ">=" "" "" } {LtEq Binary 6 "" "<=" "" "" }
{EqEq Binary 7 "" "==" "" "" } {Grtr Binary 6 "" ">" "" "" }
{NtEq Binary 7 "" "!=" "" "" } {GrEq Binary 6 "" ">=" "" "" }
{BitAnd Binary 8 "" "&" "" "" } {EqEq Binary 7 "" "==" "" "" }
{BitXor Binary 9 "" "^" "" "" } {NtEq Binary 7 "" "!=" "" "" }
{BitOr Binary 10 "" "|" "" "" } {BitAnd Binary 8 "" "&" "" "" }
{LogAnd Binary 11 "" "&&" "" "" } {BitXor Binary 9 "" "^" "" "" }
{LogOr Binary 12 "" "||" "" "" } {BitOr Binary 10 "" "|" "" "" }
{Cond Ternary 14 "" "?" "" ":"} {LogAnd Binary 11 "" "&&" "" "" }
{LogOr Binary 12 "" "||" "" "" }
{Cond Ternary 14 "" "?" "" ":"}
} }
@data(E2_ExprKindParseInfo) e2_expr_kind_parse_info_table__clike: @data(E2_ExprKindParseInfo) e2_expr_kind_parse_info_table__clike:
+3 -1
View File
@@ -9,13 +9,15 @@ E2_LangInfo e2_lang_kind_info_table[1] =
{ArrayCount(e2_expr_kind_parse_info_table__clike), (e2_expr_kind_parse_info_table__clike)}, {ArrayCount(e2_expr_kind_parse_info_table__clike), (e2_expr_kind_parse_info_table__clike)},
}; };
E2_ExprKindParseInfo e2_expr_kind_parse_info_table__clike[32] = E2_ExprKindParseInfo e2_expr_kind_parse_info_table__clike[34] =
{ {
{E2_ExprKind_Index, E2_ExprParseKind_Binary, 1, str8_lit_comp(""), str8_lit_comp("["), str8_lit_comp("]"), str8_lit_comp("")}, {E2_ExprKind_Index, E2_ExprParseKind_Binary, 1, str8_lit_comp(""), str8_lit_comp("["), str8_lit_comp("]"), str8_lit_comp("")},
{E2_ExprKind_Call, E2_ExprParseKind_Call, 1, str8_lit_comp(""), str8_lit_comp("("), str8_lit_comp(")"), str8_lit_comp(",")}, {E2_ExprKind_Call, E2_ExprParseKind_Call, 1, str8_lit_comp(""), str8_lit_comp("("), str8_lit_comp(")"), str8_lit_comp(",")},
{E2_ExprKind_DerefAsm, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("["), str8_lit_comp(""), str8_lit_comp("]"), str8_lit_comp("")}, {E2_ExprKind_DerefAsm, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("["), str8_lit_comp(""), str8_lit_comp("]"), str8_lit_comp("")},
{E2_ExprKind_SizeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("sizeof "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")}, {E2_ExprKind_SizeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("sizeof "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_TypeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("typeof "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")}, {E2_ExprKind_TypeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("typeof "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_SizeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("size_of "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_TypeOf, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp("type_of "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_CCast, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")}, {E2_ExprKind_CCast, E2_ExprParseKind_UnaryPrefix, 1, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_Deref, E2_ExprParseKind_UnaryPrefix, 2, str8_lit_comp("*"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")}, {E2_ExprKind_Deref, E2_ExprParseKind_UnaryPrefix, 2, str8_lit_comp("*"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_ExprKind_Address, E2_ExprParseKind_UnaryPrefix, 2, str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")}, {E2_ExprKind_Address, E2_ExprParseKind_UnaryPrefix, 2, str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
+1 -1
View File
@@ -157,7 +157,7 @@ E2_ExprKindParseInfo *expr_kind_parse_infos;
C_LINKAGE_BEGIN C_LINKAGE_BEGIN
extern E2_LangInfo e2_lang_kind_info_table[1]; extern E2_LangInfo e2_lang_kind_info_table[1];
extern E2_ExprKindParseInfo e2_expr_kind_parse_info_table__clike[32]; extern E2_ExprKindParseInfo e2_expr_kind_parse_info_table__clike[34];
extern U8 e2_type_kind_basic_byte_size_table[61]; extern U8 e2_type_kind_basic_byte_size_table[61];
extern String8 e2_type_kind_basic_string_table[61]; extern String8 e2_type_kind_basic_string_table[61];
+1 -1
View File
@@ -4117,7 +4117,7 @@ rd_view_ui(Rng2F32 rect)
cells_are_editable && cells_are_editable &&
row->eval.expr == &e_expr_nil) row->eval.expr == &e_expr_nil)
{ {
ghost_text = str8_lit("Expression"); ghost_text = str8_lit("Add a expression to watch...");
is_non_code = (!cell_selected || !ewv->text_editing); is_non_code = (!cell_selected || !ewv->text_editing);
cell_params.flags &= ~(RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder); cell_params.flags &= ~(RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder);
} }