Class: CompoundExpression

Inherits:
Expression show all
Defined in:
lib/glark/match/compound.rb

Overview

Associates a collection of expressions.

Direct Known Subclasses

AndExpression, OrExpression

Instance Attribute Summary collapse

Attributes inherited from Expression

#matches

Instance Method Summary collapse

Methods inherited from Expression

#add_match, #end_position, #process, #to_s

Constructor Details

#initialize(*ops) ⇒ CompoundExpression

Returns a new instance of CompoundExpression.



15
16
17
18
# File 'lib/glark/match/compound.rb', line 15

def initialize(*ops)
  @ops = ops
  super()
end

Instance Attribute Details

#opsObject (readonly)

Returns the value of attribute ops.



13
14
15
# File 'lib/glark/match/compound.rb', line 13

def ops
  @ops
end

Instance Method Details

#==(other) ⇒ Object



31
32
33
# File 'lib/glark/match/compound.rb', line 31

def == other
  self.class == other.class && @ops == other.ops
end

#reset_file(file) ⇒ Object



20
21
22
23
24
25
# File 'lib/glark/match/compound.rb', line 20

def reset_file file
  @ops.each do |op|
    op.reset_file file
  end
  super
end

#start_positionObject



27
28
29
# File 'lib/glark/match/compound.rb', line 27

def start_position
  @last_start
end