Class: Ibex::IR::Action
- Inherits:
-
Object
- Object
- Ibex::IR::Action
- Defined in:
- lib/ibex/ir/grammar_ir.rb,
sig/ibex/ir/grammar_ir.rbs
Overview
Opaque Ruby semantic action metadata.
Instance Attribute Summary collapse
- #code ⇒ String readonly
- #composition ⇒ action_composition? readonly
- #context_length ⇒ Integer readonly
- #location ⇒ location readonly
- #named_refs ⇒ Array[named_ref] readonly
Instance Method Summary collapse
-
#initialize(code:, location:, named_refs: [], context_length: 0, composition: nil) ⇒ Action
constructor
A new instance of Action.
- #to_h ⇒ Hash[Symbol, Object?]
Constructor Details
#initialize(code:, location:, named_refs: [], context_length: 0, composition: nil) ⇒ Action
Returns a new instance of Action.
81 82 83 84 85 86 87 88 |
# File 'lib/ibex/ir/grammar_ir.rb', line 81 def initialize(code:, location:, named_refs: [], context_length: 0, composition: nil) @code = code.freeze @location = IR.deep_freeze(location) @named_refs = IR.deep_freeze(named_refs) @context_length = context_length @composition = IR.deep_freeze(composition) freeze end |
Instance Attribute Details
#code ⇒ String (readonly)
73 74 75 |
# File 'lib/ibex/ir/grammar_ir.rb', line 73 def code @code end |
#composition ⇒ action_composition? (readonly)
77 78 79 |
# File 'lib/ibex/ir/grammar_ir.rb', line 77 def composition @composition end |
#context_length ⇒ Integer (readonly)
76 77 78 |
# File 'lib/ibex/ir/grammar_ir.rb', line 76 def context_length @context_length end |
#location ⇒ location (readonly)
74 75 76 |
# File 'lib/ibex/ir/grammar_ir.rb', line 74 def location @location end |
#named_refs ⇒ Array[named_ref] (readonly)
75 76 77 |
# File 'lib/ibex/ir/grammar_ir.rb', line 75 def named_refs @named_refs end |
Instance Method Details
#to_h ⇒ Hash[Symbol, Object?]
91 92 93 94 95 96 |
# File 'lib/ibex/ir/grammar_ir.rb', line 91 def to_h value = { code: @code, loc: @location, named_refs: @named_refs, context_length: @context_length } #: Hash[Symbol, Object?] value[:composition] = @composition value end |