Class: Ibex::Runtime::CST::TypedNode
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::TypedNode
- Defined in:
- lib/json5/generated_parser.rb
Overview
Grammar-generated typed view over one Red syntax node.
Instance Attribute Summary collapse
- #node ⇒ Object readonly
Instance Method Summary collapse
- #child_at_slot(index) ⇒ Object
- #deconstruct ⇒ Object
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(node) ⇒ TypedNode
constructor
A new instance of TypedNode.
- #kind ⇒ Object
- #kind_name ⇒ Object
- #node_at_slot(index) ⇒ Object
- #to_source ⇒ Object
- #token_at_slot(index) ⇒ Object
Constructor Details
#initialize(node) ⇒ TypedNode
Returns a new instance of TypedNode.
1623 1624 1625 1626 |
# File 'lib/json5/generated_parser.rb', line 1623 def initialize(node) @node = node freeze end |
Instance Attribute Details
#node ⇒ Object (readonly)
1620 1621 1622 |
# File 'lib/json5/generated_parser.rb', line 1620 def node @node end |
Instance Method Details
#child_at_slot(index) ⇒ Object
1635 |
# File 'lib/json5/generated_parser.rb', line 1635 def child_at_slot(index) = @node.child_at(index) |
#deconstruct ⇒ Object
1654 |
# File 'lib/json5/generated_parser.rb', line 1654 def deconstruct = @node.deconstruct |
#deconstruct_keys(keys) ⇒ Object
1657 |
# File 'lib/json5/generated_parser.rb', line 1657 def deconstruct_keys(keys) = @node.deconstruct_keys(keys) |
#kind ⇒ Object
1629 |
# File 'lib/json5/generated_parser.rb', line 1629 def kind = @node.kind |
#kind_name ⇒ Object
1632 |
# File 'lib/json5/generated_parser.rb', line 1632 def kind_name = @node.kind_name |
#node_at_slot(index) ⇒ Object
1638 1639 1640 1641 1642 1643 |
# File 'lib/json5/generated_parser.rb', line 1638 def node_at_slot(index) child = child_at_slot(index) return child if child.is_a?(SyntaxNode) raise TypeError, "CST slot #{index} is not a syntax node" end |
#to_source ⇒ Object
1660 |
# File 'lib/json5/generated_parser.rb', line 1660 def to_source = @node.to_source |
#token_at_slot(index) ⇒ Object
1646 1647 1648 1649 1650 1651 |
# File 'lib/json5/generated_parser.rb', line 1646 def token_at_slot(index) child = child_at_slot(index) return child if child.is_a?(SyntaxToken) raise TypeError, "CST slot #{index} is not a syntax token" end |