class RubyLexer::State
Attributes
n[RW]
names[RW]
Public Class Methods
new(o, names)
click to toggle source
TODO: take a shared hash of strings for inspect/to_s
# File lib/ruby_lexer.rb, line 872 def initialize o, names raise ArgumentError, "bad state: %p" % [o] unless Integer === o # TODO: remove self.n = o self.names = names end
Public Instance Methods
==(o)
click to toggle source
# File lib/ruby_lexer.rb, line 879 def == o self.equal?(o) || (o.class == self.class && o.n == self.n) end
=~(v)
click to toggle source
# File lib/ruby_lexer.rb, line 883 def =~ v (self.n & v.n) != 0 end
inspect()
click to toggle source
# File lib/ruby_lexer.rb, line 893 def inspect return "EXPR_NONE" if n.zero? # HACK? names.map { |v, k| k if self =~ v }. compact. join("|"). gsub(/(?:EXPR_|STR_(?:FUNC_)?)/, "") end
Also aliased as: to_s
|(v)
click to toggle source
# File lib/ruby_lexer.rb, line 887 def | v raise ArgumentError, "Incompatible State: %p vs %p" % [self, v] unless self.names == v.names self.class.new(self.n | v.n, self.names) end