Skip to content

Commit

Permalink
read_number lexer to not rely on eval().
Browse files Browse the repository at this point in the history
Otherwise we can't run Rouge in $SAFE ≥ 3.
  • Loading branch information
Arlen Christian Mart Cuss committed Dec 3, 2012
1 parent 03941e6 commit 19b1fa4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rouge/reader.rb
Expand Up @@ -404,7 +404,11 @@ def reader_raise ex, m

def read_number s
if NUMBER.match s
eval s
if s =~ /[.eE]/
Float(s)
else
Integer(s)
end
else
reader_raise UnexpectedCharacterError, "#{s} in #read_number"
end
Expand Down

0 comments on commit 19b1fa4

Please sign in to comment.