Sha256: 832c35c984a2f72df52dc5953156d7dad1b9e49fa5f9324e90e1a4c533578494

Contents?: true

Size: 401 Bytes

Versions: 4

Compression:

Stored size: 401 Bytes

Contents

module RubyPhpSerialization
  class Tokenizer
    def initialize(string)
      @string = string
    end

    def next_token
      token = nil

      token = case @string
      when /\A[0-9]+(\.[0-9]+)?/m then [:NUMBER, $&]
      when /\A"([^"]*)"/m         then [:STRING, $1]
      when /\A[^\s]/m             then [$&, $&]
      end
      @string = $'

      token unless token.nil?
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
divoxx-ruby-php-serialization-0.2.0 lib/ruby_php_serialization/tokenizer.rb
divoxx-ruby-php-serialization-0.2.1 lib/ruby_php_serialization/tokenizer.rb
divoxx-ruby-php-serialization-0.2.2 lib/ruby_php_serialization/tokenizer.rb
divoxx-ruby_php_serialization-0.1.1 lib/ruby_php_serialization/tokenizer.rb