class RedParse::MultiReduce

Attributes

default[R]
list[R]

Public Class Methods

new(list,default) click to toggle source
# File lib/redparse/compile.rb, line 922
def initialize(list,default)
  @list,@default=list,default
  #default can be any valid action (except another MultiReduce)
end

Public Instance Methods

==(other) click to toggle source
# File lib/redparse/compile.rb, line 965
def == other
  @list==other.list and @default==other.default
end
Also aliased as: eql?
act(x) click to toggle source
# File lib/redparse/compile.rb, line 929
def act(x)
  (0...@list.size).step(2){|i|
    return @list[i+1] if @list[i]===x
  }
  return default
end
actions() click to toggle source
# File lib/redparse/compile.rb, line 944
def actions
  result=[]
  (1...@list.size).step(2){|i|
    result << @list[i]
  }
  if @default.respond_to? :actions
    result.concat @default.actions 
  elsif @default
    result<<@default
  end
  result
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/redparse/compile.rb, line 961
def hash
  @list.hash^~@default.hash
end
substates() click to toggle source
# File lib/redparse/compile.rb, line 936
def substates
  if @default.respond_to? :substates
    @default.substates
  else
    []
  end
end
transition_to_loop?(input) click to toggle source
# File lib/redparse/compile.rb, line 957
def transition_to_loop? input #not used
  @default.transition_to_loop? input
end