Class: Bison::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/bison/sequence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSequence

Returns a new instance of Sequence.



6
7
8
# File 'lib/bison/sequence.rb', line 6

def initialize
  @elements = []
end

Instance Attribute Details

#elementsObject (readonly)

Returns the value of attribute elements.



4
5
6
# File 'lib/bison/sequence.rb', line 4

def elements
  @elements
end

#indexObject

Returns the value of attribute index.



3
4
5
# File 'lib/bison/sequence.rb', line 3

def index
  @index
end

#ruleObject

Returns the value of attribute rule.



3
4
5
# File 'lib/bison/sequence.rb', line 3

def rule
  @rule
end

Instance Method Details

#<<(element) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/bison/sequence.rb', line 10

def <<(element)
  if Bison::Action === element
    element.predecessors = elements.clone
  end
  element.sequence = self
  elements << element
  self
end