Sha256: 67a693db05541137c9c53ab9a9b68f324517a2a280ebbbbdcdc81d92933f5a16

Contents?: true

Size: 1.22 KB

Versions: 57

Compression:

Stored size: 1.22 KB

Contents

require 'bel_parser/parsers/ast/node'

module BELParser
  module Language
    module Syntax
      # Undefined namespace value finds values that are missing from their
      # purported namespaces.
      class UndefinedNamespaceValue
        include SyntaxFunction

        private_class_method :new

        def self.map(value_node, spec, namespaces)
          return nil unless value_node.is_a?(BELParser::Parsers::AST::Value)
          return nil unless value_node.namespace

          nsv = value_node.namespace_value
          if nsv.nil? || nsv.encoding.nil?
            value = value_node.children[0].string_literal
            UndefinedNamespaceValueWarning.new(value_node, spec, value)
          end
        end
      end

      # UndefinedNamespaceValueWarning indicates a value is missing from a
      # namespace.
      class UndefinedNamespaceValueWarning < SyntaxWarning
        # Gets the undefined value.
        attr_reader :undefined_value

        def initialize(value_node, spec, value)
          super(value_node, spec)
          @value = value
        end

        def msg
          prefix = @expression_node.prefix
          %(Undefined namespace value "#@value" for namespace "#{prefix}".)
        end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
bel_parser-1.1.6-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.6 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.5 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.4-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.4 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.3-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.3 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.2-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.2 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.1-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.1.1 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.8-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.8 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.7-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.7 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.6-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.6 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.5-java lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.5 lib/bel_parser/language/syntax/undefined_namespace_value.rb
bel_parser-1.0.4-java lib/bel_parser/language/syntax/undefined_namespace_value.rb