Module: Ibex::Runtime::JSONLTracer::Hooks
- Defined in:
- lib/ibex/runtime/jsonl_tracer.rb
Overview
Hook layer installed on an individual parser's singleton class.
Instance Method Summary collapse
- #on_error_recover(token_id, value, value_stack) ⇒ Object
- #on_reduce(production_id, values, result) ⇒ Object
- #on_shift(token_id, value, state) ⇒ Object
Instance Method Details
#on_error_recover(token_id, value, value_stack) ⇒ Object
37 38 39 40 41 |
# File 'lib/ibex/runtime/jsonl_tracer.rb', line 37 def on_error_recover(token_id, value, value_stack) write_trace(event: "error_recover", token_id: token_id, token: token_to_str(token_id), value: safe_inspect(value), value_stack: value_stack.map { |item| safe_inspect(item) }) super end |
#on_reduce(production_id, values, result) ⇒ Object
30 31 32 33 34 |
# File 'lib/ibex/runtime/jsonl_tracer.rb', line 30 def on_reduce(production_id, values, result) write_trace(event: "reduce", production_id: production_id, values: values.map { |value| safe_inspect(value) }, result: safe_inspect(result)) super end |
#on_shift(token_id, value, state) ⇒ Object
23 24 25 26 27 |
# File 'lib/ibex/runtime/jsonl_tracer.rb', line 23 def on_shift(token_id, value, state) write_trace(event: "shift", token_id: token_id, token: token_to_str(token_id), value: safe_inspect(value), state: state) super end |