Class: RubyLexer::State
Defined Under Namespace
Modules: Values
Constant Summary collapse
- NAMES =
{ EXPR_NONE => "EXPR_NONE", EXPR_BEG => "EXPR_BEG", EXPR_END => "EXPR_END", EXPR_ENDARG => "EXPR_ENDARG", EXPR_ENDFN => "EXPR_ENDFN", EXPR_ARG => "EXPR_ARG", EXPR_CMDARG => "EXPR_CMDARG", EXPR_MID => "EXPR_MID", EXPR_FNAME => "EXPR_FNAME", EXPR_DOT => "EXPR_DOT", EXPR_CLASS => "EXPR_CLASS", EXPR_LABEL => "EXPR_LABEL", EXPR_LABELED => "EXPR_LABELED", EXPR_FITEM => "EXPR_FITEM", }
Constants included from Values
Values::EXPR_ARG, Values::EXPR_ARG_ANY, Values::EXPR_BEG, Values::EXPR_BEG_ANY, Values::EXPR_CLASS, Values::EXPR_CMDARG, Values::EXPR_DOT, Values::EXPR_END, Values::EXPR_ENDARG, Values::EXPR_ENDFN, Values::EXPR_END_ANY, Values::EXPR_FITEM, Values::EXPR_FNAME, Values::EXPR_LAB, Values::EXPR_LABEL, Values::EXPR_LABELED, Values::EXPR_MID, Values::EXPR_NONE, Values::EXPR_NUM, Values::EXPR_PAD, Values::EXPR_PAR
Instance Attribute Summary collapse
-
#n ⇒ Object
Returns the value of attribute n.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #=~(v) ⇒ Object
-
#initialize(o) ⇒ State
constructor
A new instance of State.
- #inspect ⇒ Object
- #|(v) ⇒ Object
Constructor Details
#initialize(o) ⇒ State
Returns a new instance of State.
40 41 42 43 44 |
# File 'lib/ruby_lexer.rb', line 40 def initialize o raise ArgumentError, "bad state: %p" % [o] unless Integer === o # TODO: remove self.n = o end |
Instance Attribute Details
#n ⇒ Object
Returns the value of attribute n.
38 39 40 |
# File 'lib/ruby_lexer.rb', line 38 def n @n end |
Instance Method Details
#==(o) ⇒ Object
46 47 48 |
# File 'lib/ruby_lexer.rb', line 46 def == o o.class == self.class && o.n == self.n end |
#=~(v) ⇒ Object
50 51 52 |
# File 'lib/ruby_lexer.rb', line 50 def =~ v (self.n & v.n) != 0 end |
#inspect ⇒ Object
58 59 60 61 |
# File 'lib/ruby_lexer.rb', line 58 def inspect return "EXPR_NONE" if n.zero? NAMES.map { |v,k| k if self =~ v }.compact.join "|" end |
#|(v) ⇒ Object
54 55 56 |
# File 'lib/ruby_lexer.rb', line 54 def | v self.class.new(self.n | v.n) end |