Class: Ibex::Runtime::ParseSessionState
- Inherits:
-
Object
- Object
- Ibex::Runtime::ParseSessionState
- Defined in:
- lib/ibex/runtime/parse_session_state.rb
Overview
Mutable stack storage for one parser invocation.
The parser keeps local aliases to these arrays in its hot paths. The object owns their lifetime and replacement so recovery and push-session reset cannot accidentally leave one stack behind.
Instance Attribute Summary collapse
-
#location_stack ⇒ Object
readonly
: Array?.
-
#state_stack ⇒ Object
readonly
: Array.
-
#value_stack ⇒ Object
readonly
: Array.
Instance Method Summary collapse
-
#initialize ⇒ ParseSessionState
constructor
A new instance of ParseSessionState.
- #replace!(state_stack, value_stack, location_stack) ⇒ Object
- #replace_location_stack!(location_stack) ⇒ Object
- #replace_value_stack!(value_stack) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ ParseSessionState
Returns a new instance of ParseSessionState.
17 18 19 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 17 def initialize reset! end |
Instance Attribute Details
#location_stack ⇒ Object (readonly)
: Array?
14 15 16 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 14 def location_stack @location_stack end |
#state_stack ⇒ Object (readonly)
: Array
12 13 14 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 12 def state_stack @state_stack end |
#value_stack ⇒ Object (readonly)
: Array
13 14 15 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 13 def value_stack @value_stack end |
Instance Method Details
#replace!(state_stack, value_stack, location_stack) ⇒ Object
29 30 31 32 33 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 29 def replace!(state_stack, value_stack, location_stack) @state_stack = state_stack @value_stack = value_stack @location_stack = location_stack end |
#replace_location_stack!(location_stack) ⇒ Object
41 42 43 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 41 def replace_location_stack!(location_stack) @location_stack = location_stack end |
#replace_value_stack!(value_stack) ⇒ Object
36 37 38 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 36 def replace_value_stack!(value_stack) @value_stack = value_stack end |
#reset! ⇒ Object
22 23 24 25 26 |
# File 'lib/ibex/runtime/parse_session_state.rb', line 22 def reset! @state_stack = [] @value_stack = [] @location_stack = nil end |