Sha256: c9610babe4c40b5db45d39729a1a6ddb448388c661264d81b152827f5be751a4

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

module SpdxGrammar
  class LogicalBinary < Treetop::Runtime::SyntaxNode
    # Used internally

    def licenses
      (left.licenses + right.licenses).uniq
    end

    def left
      elements[0]
    end

    def right
      elements[1]
    end
  end

  class LogicalAnd < LogicalBinary
  end

  class LogicalOr < LogicalBinary
  end

  class With < Treetop::Runtime::SyntaxNode
    def licenses
      license.licenses
    end

    def license
      elements[0]
    end

    def exception
      elements[1]
    end
  end

  class None < Treetop::Runtime::SyntaxNode
    def licenses
      []
    end
  end

  class NoAssertion < Treetop::Runtime::SyntaxNode
    def licenses
      []
    end
  end

  class License < Treetop::Runtime::SyntaxNode
    def licenses
      [text_value]
    end
  end

  class LicensePlus < Treetop::Runtime::SyntaxNode
    def licenses
      child.licenses
    end

    def child
      elements[0]
    end
  end

  class LicenseRef < Treetop::Runtime::SyntaxNode
    def licenses
      [text_value]
    end
  end

  class DocumentRef < Treetop::Runtime::SyntaxNode
    def licenses
      [text_value]
    end
  end

  class LicenseException < Treetop::Runtime::SyntaxNode
    # TODO: actually do license exceptions
  end

  class GroupedExpression < Treetop::Runtime::SyntaxNode
    # Used internally
  end

  class Operand < Treetop::Runtime::SyntaxNode
    # Used internally
  end

  class SpdxParseError < StandardError
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spdx-4.0.1 lib/spdx_grammar.rb
spdx-4.0.0 lib/spdx_grammar.rb