examples/general/SRL/lib/regex/character.rb in rley-0.5.10 vs examples/general/SRL/lib/regex/character.rb in rley-0.5.11

- old
+ new

@@ -23,10 +23,12 @@ "\\4" => 4, "\\5" => 5, "\\6" => 6, "\\7" => 7 } + + MetaChars = '\^$+?.' # The integer value that uniquely identifies the character. attr_reader(:codepoint) # The initial text representation of the character (if any). @@ -61,11 +63,11 @@ # Should be an escape sequence... @codepoint = self.class.esc2codepoint(aValue) end @lexeme = aValue - when Fixnum + when Integer @codepoint = aValue else raise StandardError, "Cannot initialize a Character with a '#{aValue}'." end end @@ -123,17 +125,17 @@ # Example: # newOne = Character.new(?\u03a3) # newOne == newOne # true. Identity # newOne == Character.new(?\u03a3) # true. Both have same codepoint # newOne == ?\u03a3 # true. The single character String match exactly the char attribute. - # newOne == 0x03a3 # true. The Fixnum is compared to the codepoint value. + # newOne == 0x03a3 # true. The Integer is compared to the codepoint value. # Will test equality with any Object that knows the to_s method def ==(another) result = case another when Character self.to_str == another.to_str - when Fixnum + when Integer self.codepoint == another when String (another.size > 1) ? false : self.to_str == another \ No newline at end of file