Class: Idl::BuiltinVariableAst
Instance Method Summary collapse
-
#initialize(input, interval) ⇒ BuiltinVariableAst
constructor
A new instance of BuiltinVariableAst.
- #name ⇒ Object
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
- #type_check(symtab) ⇒ Object
- #value(symtab) ⇒ Object
Constructor Details
#initialize(input, interval) ⇒ BuiltinVariableAst
Returns a new instance of BuiltinVariableAst.
3246 3247 3248 |
# File 'lib/idl/ast.rb', line 3246 def initialize(input, interval) super(input, interval, EMPTY_ARRAY) end |
Instance Method Details
#name ⇒ Object
3244 |
# File 'lib/idl/ast.rb', line 3244 def name = text_value |
#to_idl ⇒ Object
3273 |
# File 'lib/idl/ast.rb', line 3273 def to_idl = name |
#type(symtab) ⇒ Object
3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 |
# File 'lib/idl/ast.rb', line 3254 def type(symtab) case name when "$encoding" sz = symtab.get("__instruction_encoding_size") internal_error "Forgot to set __instruction_encoding_size" if sz.nil? Type.new(:bits, width: sz.value, qualifiers: [:const]) when "$pc" if symtab.mxlen == 32 Bits32Type else Bits64Type end end end |
#type_check(symtab) ⇒ Object
3250 3251 3252 |
# File 'lib/idl/ast.rb', line 3250 def type_check(symtab) type_error "Not a builtin variable" unless ["$pc", "$encoding"].include?(name) end |
#value(symtab) ⇒ Object
3269 3270 3271 |
# File 'lib/idl/ast.rb', line 3269 def value(symtab) value_error "Cannot know the value of pc or encoding" end |