class RedParse::MultiShift
Attributes
map[R]
modifiers[R]
Public Class Methods
new(base,modifiers)
click to toggle source
# File lib/redparse/compile.rb, line 972 def initialize(base,modifiers) @base,@modifiers=base,modifiers @map= (0...2**(modifiers.size/2)).map{|i| base.dup} @map.each_with_index{|state,i| #for each branch to the multishift (0...modifiers.size).step(2){|j| #for each predicate in the multishift if (i&(1<<j)).non_zero? #if the predicate tests true in this branch state.append modifiers[j+1] #add the predicates modifier to the state end } state.sort_substates! } end
Public Instance Methods
==(other)
click to toggle source
# File lib/redparse/compile.rb, line 1011 def == other huh end
Also aliased as: eql?
act(x)
click to toggle source
# File lib/redparse/compile.rb, line 986 def act(x) result=0 (0...@modifiers.size).step(2){|i| result|=(1<<(i/2)) if @modifiers[i]===x } @map[result] end
actions()
click to toggle source
# File lib/redparse/compile.rb, line 1000 def actions @map.dup end
hash()
click to toggle source
# File lib/redparse/compile.rb, line 1008 def hash huh end
substates()
click to toggle source
# File lib/redparse/compile.rb, line 996 def substates @map.dup end
transition_to_loop?(input)
click to toggle source
# File lib/redparse/compile.rb, line 1004 def transition_to_loop? input #not used huh end