@@ -29,39 +29,39 @@ def is_type(value, ruby_type_constant):
2929
3030# Map of type constants to their names for display
3131TYPE_NAMES = {
32- 'RUBY_T_NONE' : 'None ' ,
33- 'RUBY_T_OBJECT' : 'Object ' ,
34- 'RUBY_T_CLASS' : 'Class ' ,
35- 'RUBY_T_MODULE' : 'Module ' ,
36- 'RUBY_T_FLOAT' : 'Float ' ,
37- 'RUBY_T_STRING' : 'String ' ,
38- 'RUBY_T_REGEXP' : 'Regexp ' ,
39- 'RUBY_T_ARRAY' : 'Array ' ,
40- 'RUBY_T_HASH' : 'Hash ' ,
41- 'RUBY_T_STRUCT' : 'Struct ' ,
42- 'RUBY_T_BIGNUM' : 'Bignum ' ,
43- 'RUBY_T_FILE' : 'File ' ,
44- 'RUBY_T_DATA' : 'Data ' ,
45- 'RUBY_T_MATCH' : 'Match ' ,
46- 'RUBY_T_COMPLEX' : 'Complex ' ,
47- 'RUBY_T_RATIONAL' : 'Rational ' ,
48- 'RUBY_T_NIL' : 'Nil ' ,
49- 'RUBY_T_TRUE' : 'True ' ,
50- 'RUBY_T_FALSE' : 'False ' ,
51- 'RUBY_T_SYMBOL' : 'Symbol ' ,
52- 'RUBY_T_FIXNUM' : 'Fixnum ' ,
53- 'RUBY_T_UNDEF' : 'Undef ' ,
54- 'RUBY_T_IMEMO' : 'IMemo ' ,
55- 'RUBY_T_NODE' : 'Node ' ,
56- 'RUBY_T_ICLASS' : 'IClass ' ,
57- 'RUBY_T_ZOMBIE' : 'Zombie ' ,
32+ 'RUBY_T_NONE' : 'T_NONE ' ,
33+ 'RUBY_T_OBJECT' : 'T_OBJECT ' ,
34+ 'RUBY_T_CLASS' : 'T_CLASS ' ,
35+ 'RUBY_T_MODULE' : 'T_MODULE ' ,
36+ 'RUBY_T_FLOAT' : 'T_FLOAT ' ,
37+ 'RUBY_T_STRING' : 'T_STRING ' ,
38+ 'RUBY_T_REGEXP' : 'T_REGEXP ' ,
39+ 'RUBY_T_ARRAY' : 'T_ARRAY ' ,
40+ 'RUBY_T_HASH' : 'T_HASH ' ,
41+ 'RUBY_T_STRUCT' : 'T_STRUCT ' ,
42+ 'RUBY_T_BIGNUM' : 'T_BIGNUM ' ,
43+ 'RUBY_T_FILE' : 'T_FILE ' ,
44+ 'RUBY_T_DATA' : 'T_DATA ' ,
45+ 'RUBY_T_MATCH' : 'T_MATCH ' ,
46+ 'RUBY_T_COMPLEX' : 'T_COMPLEX ' ,
47+ 'RUBY_T_RATIONAL' : 'T_RATIONAL ' ,
48+ 'RUBY_T_NIL' : 'T_NIL ' ,
49+ 'RUBY_T_TRUE' : 'T_TRUE ' ,
50+ 'RUBY_T_FALSE' : 'T_FALSE ' ,
51+ 'RUBY_T_SYMBOL' : 'T_SYMBOL ' ,
52+ 'RUBY_T_FIXNUM' : 'T_FIXNUM ' ,
53+ 'RUBY_T_UNDEF' : 'T_UNDEF ' ,
54+ 'RUBY_T_IMEMO' : 'T_IMEMO ' ,
55+ 'RUBY_T_NODE' : 'T_NODE ' ,
56+ 'RUBY_T_ICLASS' : 'T_ICLASS ' ,
57+ 'RUBY_T_ZOMBIE' : 'T_ZOMBIE ' ,
5858}
5959
6060def type_name (value ):
6161 """Get the human-readable type name for a VALUE.
6262
6363 Returns:
64- String like 'String ', 'Array ', 'Hash ', etc., or 'Unknown'
64+ String like 'T_STRING ', 'T_ARRAY ', 'T_HASH ', etc., or 'Unknown(0x...) '
6565 """
6666 type_flag = type_of (value )
6767
@@ -85,16 +85,14 @@ def __init__(self, value):
8585
8686 def __str__ (self ):
8787 type_str = type_name (self .value )
88- return f"<{ type_str } : 0x{ int (self .value ):x} >"
88+ return f"<{ type_str } @ 0x{ int (self .value ):x} >"
8989
9090 def print_to (self , terminal ):
9191 """Print formatted basic object representation."""
9292 type_str = type_name (self .value )
9393 addr = int (self .value )
94- # Note: Using : instead of @ for basic objects
95- import format as fmt
96- terminal .print (fmt .metadata , '<' , fmt .reset , fmt .type , type_str , fmt .reset , end = '' )
97- terminal .print (fmt .metadata , f':0x{ addr :x} >' , fmt .reset , end = '' )
94+ # Use print_type_tag for consistency with other types
95+ terminal .print_type_tag (type_str , addr )
9896
9997 def print_recursive (self , printer , depth ):
10098 """Print this basic object (no recursion)."""
0 commit comments