Permalink
Browse files

Merge pull request #3 from zettabyte/master

Added support for negative integers
  • Loading branch information...
2 parents e5ffd18 + 0a4d73a commit d6ad748f4e5e609b70fdff2f6d50d42497daa3c1 @divoxx committed Jan 21, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/php_serialization/tokenizer.rb
@@ -7,7 +7,7 @@ def initialize(string)
def each
while !@string.empty?
token = case @string
- when /\A[0-9]+(\.[0-9]+)?/m then yield([:NUMBER, $&])
+ when /\A-?[0-9]+(\.[0-9]+)?/m then yield([:NUMBER, $&])
when /\A"([^"]*)"/m then yield([:STRING, $1])
when /\A[^\s]/m then yield([$&, $&])
end
@@ -18,4 +18,4 @@ def each
yield([false, '$'])
end
end
-end
+end

0 comments on commit d6ad748

Please sign in to comment.