Class: Ibex::Runtime::CST::SerializedTree
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::SerializedTree
- Defined in:
- lib/ibex/runtime/cst/serialized_tree.rb,
sig/ibex/runtime/cst/serialized_tree.rbs
Overview
Validated CST serialization document and its reconstructed Red root.
Instance Attribute Summary collapse
- #grammar_digest ⇒ String readonly
- #green_root ⇒ GreenNode readonly
- #kinds ⇒ Kind readonly
- #memo ⇒ ParseMemo? readonly
- #production_count ⇒ Integer readonly
- #state_count ⇒ Integer readonly
- #table_format ⇒ Integer readonly
- #trivia_policy ⇒ Symbol readonly
Instance Method Summary collapse
-
#initialize(grammar_digest:, table_format:, state_count:, production_count:, trivia_policy:, kinds:, green_root:, memo: nil) ⇒ SerializedTree
constructor
A new instance of SerializedTree.
- #syntax_root ⇒ SyntaxNode
Constructor Details
#initialize(grammar_digest:, table_format:, state_count:, production_count:, trivia_policy:, kinds:, green_root:, memo: nil) ⇒ SerializedTree
Returns a new instance of SerializedTree.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 21 def initialize(grammar_digest:, table_format:, state_count:, production_count:, trivia_policy:, kinds:, green_root:, memo: nil) @grammar_digest = grammar_digest.dup.freeze @table_format = table_format @state_count = state_count @production_count = production_count @trivia_policy = trivia_policy @kinds = kinds @green_root = green_root @memo = memo freeze end |
Instance Attribute Details
#grammar_digest ⇒ String (readonly)
9 10 11 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 9 def grammar_digest @grammar_digest end |
#green_root ⇒ GreenNode (readonly)
15 16 17 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 15 def green_root @green_root end |
#kinds ⇒ Kind (readonly)
14 15 16 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 14 def kinds @kinds end |
#memo ⇒ ParseMemo? (readonly)
16 17 18 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 16 def memo @memo end |
#production_count ⇒ Integer (readonly)
12 13 14 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 12 def production_count @production_count end |
#state_count ⇒ Integer (readonly)
11 12 13 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 11 def state_count @state_count end |
#table_format ⇒ Integer (readonly)
10 11 12 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 10 def table_format @table_format end |
#trivia_policy ⇒ Symbol (readonly)
13 14 15 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 13 def trivia_policy @trivia_policy end |
Instance Method Details
#syntax_root ⇒ SyntaxNode
35 36 37 38 39 40 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 35 def syntax_root source = SourceText.new(@green_root.to_source) SyntaxNode.new( green: @green_root, kinds: @kinds, trivia_policy: @trivia_policy, source_text: source ) end |