Module: Ibex::IR

Defined in:
lib/ibex/ir.rb,
lib/ibex/ir/lexer_ir.rb,
lib/ibex/ir/serialize.rb,
lib/ibex/ir/validator.rb,
lib/ibex/ir/grammar_ir.rb,
lib/ibex/ir/automaton_ir.rb,
lib/ibex/ir/validator/base.rb,
lib/ibex/ir/parser_contract.rb,
lib/ibex/ir/validator/lexer.rb,
lib/ibex/ir/validator/grammar.rb,
lib/ibex/ir/validator/automaton.rb

Defined Under Namespace

Modules: Serialize, Validator Classes: Action, Automaton, AutomatonItem, AutomatonState, Grammar, GrammarSymbol, Lexer, LexerRule, ParserContract, Production, UserCodeChunk

Constant Summary collapse

LEXER_SCHEMA_VERSION =
1
SUPPORTED_LEXER_SCHEMA_VERSIONS =

: Array

[LEXER_SCHEMA_VERSION].freeze
SCHEMA_VERSION =

Grammar IR has one active wire format. A future incompatible format change may advance this number, but the runtime never treats old formats as an alternate compatibility surface.

1
SUPPORTED_SCHEMA_VERSIONS =

: Array

[SCHEMA_VERSION].freeze

Class Method Summary collapse

Class Method Details

.deep_freeze(value) ⇒ Object

Public IR constructors own their containers; callers keep ownership of the values they pass in while the IR remains deeply immutable.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ibex/ir/grammar_ir.rb', line 16

def deep_freeze(value)
  case value
  when String
    value.dup.freeze
  when Array
    value.map { |item| deep_freeze(item) }.freeze
  when Hash
    value.to_h { |key, item| [deep_freeze(key), deep_freeze(item)] }.freeze
  else
    value.freeze
  end
end