Sha256: fefac53c9379e73b621819dc362900facc103908cc4c532d08ff43c1aef8f183

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

module JMESPath
  # @api private
  class Token < Struct.new(:type, :value, :position, :binding_power)

    # @api private
    NULL_TOKEN = Token.new(:eof, '', nil)

    # binding power
    # @api private
    BINDING_POWER = {
      :eof               => 0,
      :quoted_identifier => 0,
      :identifier        => 0,
      :rbracket          => 0,
      :rparen            => 0,
      :comma             => 0,
      :rbrace            => 0,
      :number            => 0,
      :current           => 0,
      :expref            => 0,
      :pipe              => 1,
      :comparator        => 2,
      :or                => 5,
      :flatten           => 6,
      :star              => 20,
      :dot               => 40,
      :lbrace            => 50,
      :filter            => 50,
      :lbracket          => 50,
      :lparen            => 60,
    }

    # @param [Symbol] type
    # @param [Mixed] value
    # @param [Integer] position
    def initialize(type, value, position)
      super(type, value, position, BINDING_POWER[type])
    end

  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
burtpath-1.1.2 lib/jmespath/token.rb
burtpath-1.1.1 lib/jmespath/token.rb
burtpath-1.1.0 lib/jmespath/token.rb
aws-codedeploy-agent-0.0.3 vendor/gems/jmespath-1.0.1/lib/jmespath/token.rb
jmespath-1.0.2 lib/jmespath/token.rb
jmespath-1.0.1 lib/jmespath/token.rb
jmespath-1.0.0 lib/jmespath/token.rb
jmespath-0.9.0 lib/jmespath/token.rb
jmespath-0.2.0 lib/jmespath/token.rb