Class: Ibex::Runtime::CST::SerializedTree
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::SerializedTree
- Defined in:
- lib/ibex/runtime/cst/serialized_tree.rb
Overview
Validated CST serialization document and its reconstructed Red root.
Instance Attribute Summary collapse
-
#grammar_digest ⇒ Object
readonly
: String.
-
#green_root ⇒ Object
readonly
: GreenNode.
-
#kinds ⇒ Object
readonly
: Kind.
-
#memo ⇒ Object
readonly
: ParseMemo?.
-
#production_count ⇒ Object
readonly
: Integer.
-
#state_count ⇒ Object
readonly
: Integer.
-
#table_format ⇒ Object
readonly
: Integer.
-
#trivia_policy ⇒ Object
readonly
: Symbol.
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 ⇒ Object
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 ⇒ Object (readonly)
: String
9 10 11 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 9 def grammar_digest @grammar_digest end |
#green_root ⇒ Object (readonly)
: GreenNode
15 16 17 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 15 def green_root @green_root end |
#kinds ⇒ Object (readonly)
: Kind
14 15 16 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 14 def kinds @kinds end |
#memo ⇒ Object (readonly)
: ParseMemo?
16 17 18 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 16 def memo @memo end |
#production_count ⇒ Object (readonly)
: Integer
12 13 14 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 12 def production_count @production_count end |
#state_count ⇒ Object (readonly)
: Integer
11 12 13 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 11 def state_count @state_count end |
#table_format ⇒ Object (readonly)
: Integer
10 11 12 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 10 def table_format @table_format end |
#trivia_policy ⇒ Object (readonly)
: Symbol
13 14 15 |
# File 'lib/ibex/runtime/cst/serialized_tree.rb', line 13 def trivia_policy @trivia_policy end |
Instance Method Details
#syntax_root ⇒ Object
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 |