Class: Ibex::Runtime::Event
- Inherits:
-
Object
- Object
- Ibex::Runtime::Event
- Defined in:
- lib/json5/generated_parser.rb
Overview
One immutable versioned parser observation.
Constant Summary collapse
- SCHEMA_VERSION =
1- IDENTIFIER =
"runtime-event"- TYPES =
%i[ start shift reduce error recover discard accept reject cst_built cst_fallback cst_reuse ].freeze
Instance Attribute Summary collapse
- #data ⇒ Object readonly
- #sequence ⇒ Object readonly
- #type ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(type:, sequence:, data:) ⇒ Event
constructor
A new instance of Event.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, sequence:, data:) ⇒ Event
Returns a new instance of Event.
4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 |
# File 'lib/json5/generated_parser.rb', line 4364 def initialize(type:, sequence:, data:) raise ArgumentError, "unknown runtime event type #{type.inspect}" unless TYPES.include?(type) raise ArgumentError, "runtime event sequence must be positive" unless sequence.positive? @type = type @sequence = sequence @data = EventSanitizer.data(data) @document = { "ibex_runtime_event" => IDENTIFIER, "schema_version" => SCHEMA_VERSION, "sequence" => @sequence, "event" => @type.to_s.freeze, "data" => @data }.freeze #: Hash[String, json_value] freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
4361 4362 4363 |
# File 'lib/json5/generated_parser.rb', line 4361 def data @data end |
#sequence ⇒ Object (readonly)
4360 4361 4362 |
# File 'lib/json5/generated_parser.rb', line 4360 def sequence @sequence end |
#type ⇒ Object (readonly)
4359 4360 4361 |
# File 'lib/json5/generated_parser.rb', line 4359 def type @type end |
Instance Method Details
#to_h ⇒ Object
4382 4383 4384 |
# File 'lib/json5/generated_parser.rb', line 4382 def to_h @document end |