Class: Rley::Notation::SequenceNode
- Defined in:
- lib/rley/notation/sequence_node.rb
Overview
A syntax node for a sequence of AST nodes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#constraints ⇒ Object
Returns the value of attribute constraints.
- #subnodes ⇒ Array<ASTNode> readonly
Attributes inherited from ASTNode
#annotation, #position, #repetition
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
-
#initialize(aPosition, sequence, theRepetition = nil) ⇒ SequenceNode
constructor
A new instance of SequenceNode.
- #size ⇒ Object
Methods inherited from ASTNode
Constructor Details
#initialize(aPosition, sequence, theRepetition = nil) ⇒ SequenceNode
Returns a new instance of SequenceNode.
17 18 19 20 21 22 |
# File 'lib/rley/notation/sequence_node.rb', line 17 def initialize(aPosition, sequence, theRepetition = nil) super(aPosition) @subnodes = sequence self.repetition = theRepetition if theRepetition @constraints = [] end |
Instance Attribute Details
#constraints ⇒ Object
Returns the value of attribute constraints.
12 13 14 |
# File 'lib/rley/notation/sequence_node.rb', line 12 def constraints @constraints end |
#subnodes ⇒ Array<ASTNode> (readonly)
10 11 12 |
# File 'lib/rley/notation/sequence_node.rb', line 10 def subnodes @subnodes end |
Instance Method Details
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
30 31 32 |
# File 'lib/rley/notation/sequence_node.rb', line 30 def accept(visitor) visitor.visit_sequence_node(self) end |
#size ⇒ Object
24 25 26 |
# File 'lib/rley/notation/sequence_node.rb', line 24 def size subnodes.size end |