Class: RubyLexer::State
Defined Under Namespace
Modules: Values
Constant Summary
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_LIT, Values::EXPR_MID, Values::EXPR_NONE, Values::EXPR_NUM, Values::EXPR_PAD, Values::EXPR_PAR, Values::STR_DQUOTE, Values::STR_DSYM, Values::STR_DWORD, Values::STR_FUNC_BORING, Values::STR_FUNC_DEDENT, Values::STR_FUNC_ESCAPE, Values::STR_FUNC_EXPAND, Values::STR_FUNC_INDENT, Values::STR_FUNC_LABEL, Values::STR_FUNC_LIST, Values::STR_FUNC_QWORDS, Values::STR_FUNC_REGEXP, Values::STR_FUNC_SYMBOL, Values::STR_FUNC_TERM, Values::STR_LABEL, Values::STR_REGEXP, Values::STR_SQUOTE, Values::STR_SSYM, Values::STR_SWORD, Values::STR_XQUOTE
Instance Attribute Summary collapse
-
#n ⇒ Object
Returns the value of attribute n.
-
#names ⇒ Object
Returns the value of attribute names.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #=~(v) ⇒ Object
-
#initialize(o, names) ⇒ State
constructor
TODO: take a shared hash of strings for inspect/to_s.
- #inspect ⇒ Object (also: #to_s)
- #|(v) ⇒ Object
Constructor Details
#initialize(o, names) ⇒ State
TODO: take a shared hash of strings for inspect/to_s
872 873 874 875 876 877 |
# 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 |
Instance Attribute Details
#n ⇒ Object
Returns the value of attribute n.
868 869 870 |
# File 'lib/ruby_lexer.rb', line 868 def n @n end |
#names ⇒ Object
Returns the value of attribute names.
869 870 871 |
# File 'lib/ruby_lexer.rb', line 869 def names @names end |
Instance Method Details
#==(o) ⇒ Object
879 880 881 |
# File 'lib/ruby_lexer.rb', line 879 def == o self.equal?(o) || (o.class == self.class && o.n == self.n) end |
#=~(v) ⇒ Object
883 884 885 |
# File 'lib/ruby_lexer.rb', line 883 def =~ v (self.n & v.n) != 0 end |
#inspect ⇒ Object Also known as: to_s
893 894 895 896 897 898 899 900 |
# 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 |
#|(v) ⇒ Object
887 888 889 890 891 |
# 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 |