Class: Ibex::TableSimulation::Step
- Inherits:
-
Object
- Object
- Ibex::TableSimulation::Step
- Defined in:
- lib/ibex/table_simulation/step.rb,
sig/ibex/table_simulation/step.rbs
Overview
One immutable parser-table action.
Instance Attribute Summary collapse
- #action ⇒ String readonly
- #action_source ⇒ String readonly
- #lhs ⇒ String? readonly
- #production_id ⇒ Integer? readonly
- #rhs_length ⇒ Integer? readonly
- #sequence ⇒ Integer readonly
- #stack_depth_after ⇒ Integer readonly
- #stack_depth_before ⇒ Integer readonly
- #state ⇒ Integer readonly
- #target_state ⇒ Integer? readonly
- #token ⇒ String readonly
- #token_id ⇒ Integer readonly
Instance Method Summary collapse
-
#initialize(sequence:, state:, token_id:, token:, action:, action_source:, production_id:, lhs:, rhs_length:, target_state:, stack_depth_before:, stack_depth_after:) ⇒ Step
constructor
A new instance of Step.
- #to_h ⇒ Hash[String, untyped]
Constructor Details
#initialize(sequence:, state:, token_id:, token:, action:, action_source:, production_id:, lhs:, rhs_length:, target_state:, stack_depth_before:, stack_depth_after:) ⇒ Step
Returns a new instance of Step.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ibex/table_simulation/step.rb', line 24 def initialize(sequence:, state:, token_id:, token:, action:, action_source:, production_id:, lhs:, rhs_length:, target_state:, stack_depth_before:, stack_depth_after:) @sequence = sequence @state = state @token_id = token_id @token = token.dup.freeze @action = action.dup.freeze @action_source = action_source.dup.freeze @production_id = production_id @lhs = lhs&.dup&.freeze @rhs_length = rhs_length @target_state = target_state @stack_depth_before = stack_depth_before @stack_depth_after = stack_depth_after freeze end |
Instance Attribute Details
#action ⇒ String (readonly)
12 13 14 |
# File 'lib/ibex/table_simulation/step.rb', line 12 def action @action end |
#action_source ⇒ String (readonly)
13 14 15 |
# File 'lib/ibex/table_simulation/step.rb', line 13 def action_source @action_source end |
#lhs ⇒ String? (readonly)
15 16 17 |
# File 'lib/ibex/table_simulation/step.rb', line 15 def lhs @lhs end |
#production_id ⇒ Integer? (readonly)
14 15 16 |
# File 'lib/ibex/table_simulation/step.rb', line 14 def production_id @production_id end |
#rhs_length ⇒ Integer? (readonly)
16 17 18 |
# File 'lib/ibex/table_simulation/step.rb', line 16 def rhs_length @rhs_length end |
#sequence ⇒ Integer (readonly)
8 9 10 |
# File 'lib/ibex/table_simulation/step.rb', line 8 def sequence @sequence end |
#stack_depth_after ⇒ Integer (readonly)
19 20 21 |
# File 'lib/ibex/table_simulation/step.rb', line 19 def stack_depth_after @stack_depth_after end |
#stack_depth_before ⇒ Integer (readonly)
18 19 20 |
# File 'lib/ibex/table_simulation/step.rb', line 18 def stack_depth_before @stack_depth_before end |
#state ⇒ Integer (readonly)
9 10 11 |
# File 'lib/ibex/table_simulation/step.rb', line 9 def state @state end |
#target_state ⇒ Integer? (readonly)
17 18 19 |
# File 'lib/ibex/table_simulation/step.rb', line 17 def target_state @target_state end |
#token ⇒ String (readonly)
11 12 13 |
# File 'lib/ibex/table_simulation/step.rb', line 11 def token @token end |
#token_id ⇒ Integer (readonly)
10 11 12 |
# File 'lib/ibex/table_simulation/step.rb', line 10 def token_id @token_id end |
Instance Method Details
#to_h ⇒ Hash[String, untyped]
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ibex/table_simulation/step.rb', line 42 def to_h { "sequence" => @sequence, "state" => @state, "token_id" => @token_id, "token" => @token, "action" => @action, "action_source" => @action_source, "production_id" => @production_id, "lhs" => @lhs, "rhs_length" => @rhs_length, "target_state" => @target_state, "stack_depth_before" => @stack_depth_before, "stack_depth_after" => @stack_depth_after }.freeze end |