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"
arguments: "--user:C:/devel/raddebugger/build/raddbg_test.user"
debug_subprocesses: 0
enabled: 1
}
target:
{
@@ -66,5 +67,4 @@ target:
{
executable: "build/ryan_scratch.exe"
working_directory: build
enabled: 1
}
+34 -32
View File
@@ -90,38 +90,40 @@ E2_LangKindTable:
@table(name parse_kind precedence pre sep pos chain)
E2_ExprKindParseInfoTable_CLike:
{
{Index Binary 1 "" "[" "]" "" }
{Call Call 1 "" "(" ")" ","}
{DerefAsm UnaryPrefix 1 "[" "" "]" "" }
{SizeOf UnaryPrefix 1 "sizeof " "" "" "" }
{TypeOf UnaryPrefix 1 "typeof " "" "" "" }
{CCast UnaryPrefix 1 "" "" "" "" }
{Deref UnaryPrefix 2 "*" "" "" "" }
{Address UnaryPrefix 2 "&" "" "" "" }
{Pos UnaryPrefix 2 "+" "" "" "" }
{Neg UnaryPrefix 2 "-" "" "" "" }
{LogNot UnaryPrefix 2 "!" "" "" "" }
{BitNot UnaryPrefix 2 "~" "" "" "" }
{Ptr UnaryPostfix 1 "" "" "*" "" }
{Mul Binary 3 "" "*" "" "" }
{Div Binary 3 "" "/" "" "" }
{Mod Binary 3 "" "%" "" "" }
{Add Binary 4 "" "+" "" "" }
{Sub Binary 4 "" "-" "" "" }
{LShift Binary 5 "" "<<" "" "" }
{RShift Binary 5 "" ">>" "" "" }
{Less Binary 6 "" "<" "" "" }
{LtEq Binary 6 "" "<=" "" "" }
{Grtr Binary 6 "" ">" "" "" }
{GrEq Binary 6 "" ">=" "" "" }
{EqEq Binary 7 "" "==" "" "" }
{NtEq Binary 7 "" "!=" "" "" }
{BitAnd Binary 8 "" "&" "" "" }
{BitXor Binary 9 "" "^" "" "" }
{BitOr Binary 10 "" "|" "" "" }
{LogAnd Binary 11 "" "&&" "" "" }
{LogOr Binary 12 "" "||" "" "" }
{Cond Ternary 14 "" "?" "" ":"}
{Index Binary 1 "" "[" "]" "" }
{Call Call 1 "" "(" ")" ","}
{DerefAsm UnaryPrefix 1 "[" "" "]" "" }
{SizeOf UnaryPrefix 1 "sizeof " "" "" "" }
{TypeOf UnaryPrefix 1 "typeof " "" "" "" }
{SizeOf UnaryPrefix 1 "size_of " "" "" "" }
{TypeOf UnaryPrefix 1 "type_of " "" "" "" }
{CCast UnaryPrefix 1 "" "" "" "" }
{Deref UnaryPrefix 2 "*" "" "" "" }
{Address UnaryPrefix 2 "&" "" "" "" }
{Pos UnaryPrefix 2 "+" "" "" "" }
{Neg UnaryPrefix 2 "-" "" "" "" }
{LogNot UnaryPrefix 2 "!" "" "" "" }
{BitNot UnaryPrefix 2 "~" "" "" "" }
{Ptr UnaryPostfix 1 "" "" "*" "" }
{Mul Binary 3 "" "*" "" "" }
{Div Binary 3 "" "/" "" "" }
{Mod Binary 3 "" "%" "" "" }
{Add Binary 4 "" "+" "" "" }
{Sub Binary 4 "" "-" "" "" }
{LShift Binary 5 "" "<<" "" "" }
{RShift Binary 5 "" ">>" "" "" }
{Less Binary 6 "" "<" "" "" }
{LtEq Binary 6 "" "<=" "" "" }
{Grtr Binary 6 "" ">" "" "" }
{GrEq Binary 6 "" ">=" "" "" }
{EqEq Binary 7 "" "==" "" "" }
{NtEq Binary 7 "" "!=" "" "" }
{BitAnd Binary 8 "" "&" "" "" }
{BitXor Binary 9 "" "^" "" "" }
{BitOr Binary 10 "" "|" "" "" }
{LogAnd Binary 11 "" "&&" "" "" }
{LogOr Binary 12 "" "||" "" "" }
{Cond Ternary 14 "" "?" "" ":"}
}
@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)},
};
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_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_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_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_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("")},
+1 -1
View File
@@ -157,7 +157,7 @@ E2_ExprKindParseInfo *expr_kind_parse_infos;
C_LINKAGE_BEGIN
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 String8 e2_type_kind_basic_string_table[61];
+1 -1
View File
@@ -4117,7 +4117,7 @@ rd_view_ui(Rng2F32 rect)
cells_are_editable &&
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);
cell_params.flags &= ~(RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder);
}