Sha256: 62f4d366382b4d658571d628dab6291c977b063838e15ab0c65983d26ba811de

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

require "sie/parser/entry_types"

module Sie
  class Parser
    class Tokenizer
      class Token
        attr_accessor :value

        def initialize(value = "")
          @value = value
        end

        def known_entry_type?
          Sie::Parser::ENTRY_TYPES.has_key?(label)
        end

        def entry_type
          Sie::Parser::ENTRY_TYPES.fetch(label)
        end

        def label
          value.sub(/^#/, "").downcase
        end
      end

      class EntryToken < Token; end
      class BeginArrayToken < Token; end
      class EndArrayToken < Token; end
      class StringToken < Token; end
      class ArrayToken < Token; end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sie-4.1.2 lib/sie/parser/tokenizer/token.rb
sie-4.1.1 lib/sie/parser/tokenizer/token.rb