lib/rouge/reader.rb in rouge-lang-0.0.14 vs lib/rouge/reader.rb in rouge-lang-0.0.15
- old
+ new
@@ -179,24 +179,23 @@
Float(s)
else
Integer(s)
end
elsif /\A#{RATIONAL}\z/o.match(s)
- numerator, denominator = s.split("/").map {|s| number(s) }
+ numerator, denominator = s.split("/").map {|n| number(n)}
Rational(numerator, denominator)
else
reader_raise NumberFormatError, "Invalid number #{s}", s
end
end
def keyword
- begin
- slurp(/:"/)
- retract!
+ advance!
+ if peek == ?"
s = string
s.intern
- rescue UnexpectedCharacterError
- slurp(/^:[a-zA-Z0-9\-_!\?\*\/]+/)[1..-1].intern
+ else
+ slurp(/^[a-zA-Z0-9\-_!\?\*\/]+/).intern
end
end
def string
s = ""