package spdx_licenses

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type user_defined_license = {
  1. document_ref : string option;
  2. license_ref : string;
}

"DocumentRef-" idstring ":""LicenseRef-" idstring

type simple_license =
  1. | LicenseID of string
    (*

    license-id

    *)
  2. | LicenseIDPlus of string
    (*

    license-id '+' (the '+' isn't contained in the string)

    *)
  3. | LicenseRef of user_defined_license
    (*

    A SPDX user defined license reference

    *)

simple-expression

type t =
  1. | Simple of simple_license
    (*

    simple-expression

    *)
  2. | WITH of simple_license * string
    (*

    simple-expression "WITH" license-exception-id

    *)
  3. | AND of t * t
    (*

    compound-expression "AND" compound-expression

    *)
  4. | OR of t * t
    (*

    compound-expression "OR" compound-expression

    *)

license-expression

type error = [
  1. | `InvalidLicenseID of string
  2. | `InvalidExceptionID of string
  3. | `ParseError
]

The errors returned by the parser

val parse : string -> (t, [> error ]) result

parse str parses str according to the syntax described in: https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/

val to_string : t -> string

to_string license returns a normalized string corresponding to license in a valid SPDX license expression format.

val valid_license_ids : string list

valid_license_ids gives the list of valid license IDs. The list does not contain deprecated licenses. See Appendix I.1: https://spdx.github.io/spdx-spec/appendix-I-SPDX-license-list/

val valid_exception_ids : string list

valid_exception_ids gives the list of valid exception IDs. The list does not contain deprecated exceptions. See Appendix I.2: https://spdx.github.io/spdx-spec/appendix-I-SPDX-license-list/

OCaml

Innovation. Community. Security.