Liking cljdoc? Tell your friends :D

spdx.expressions

SPDX license expression functionality. This functionality is bespoke (it is not provided by Spdx-Java-Library).

SPDX license expression functionality. This functionality is bespoke (it is not provided by Spdx-Java-Library).
raw docstring

init!clj

(init!)

Initialises this namespace upon first call (and does nothing on subsequent calls), returning nil. Consumers of this namespace are not required to call this fn, as initialisation will occur implicitly anyway; it is provided to allow explicit control of the cost of initialisation to callers who need it.

Initialises this namespace upon first call (and does nothing on subsequent
calls), returning nil. Consumers of this namespace are not required to call
this fn, as initialisation will occur implicitly anyway; it is provided to
allow explicit control of the cost of initialisation to callers who need it.
sourceraw docstring

parseclj

(parse s)

Attempt to parse the given string as an SPDX license expression, returning a data structure representing the parse tree or nil if the string cannot be parsed.

See SPDX Specification Annex D for details on SPDX license expressions: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/

Notes:

  • The parser normalises SPDX ids to their canonical case e.g. aPAcHe-2.0 -> Apache-2.0

  • The parser removes redundant grouping e.g. (((((Apache-2.0)))))) -> Apache-2.0

  • When a license is modified with the "or later" modifier ('+'), the two are grouped

  • When a license is modified WITH a license exception, the two are grouped

Examples:

"Apache-2.0" -> [{:license-id "Apache-2.0"}]

"GPL-2.0+" -> [{:license-id "GPL-2.0" :or-later true}]

"GPL-2.0 WITH Classpath-exception-2.0" -> [{:license-id "GPL-2.0" :license-exception-id "Classpath-exception-2.0"}]

"CDDL-1.1 OR (GPL-2.0+ WITH Classpath-exception-2.0)" -> [{:license-id "CDDL-1.1"} :or {:license-id "GPL-2.0" :or-later true :license-exception-id "Classpath-exception-2.0"}]

Attempt to parse the given string as an SPDX license expression, returning a
data structure representing the parse tree or nil if the string cannot be
parsed.

See SPDX Specification Annex D for details on SPDX license expressions:
https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/

Notes:
* The parser normalises SPDX ids to their canonical case
  e.g. aPAcHe-2.0 -> Apache-2.0

* The parser removes redundant grouping
  e.g. (((((Apache-2.0)))))) -> Apache-2.0

* When a license is modified with the "or later" modifier ('+'), the two
  are grouped

* When a license is modified WITH a license exception, the two are grouped

Examples:

"Apache-2.0"
-> [{:license-id "Apache-2.0"}]

"GPL-2.0+"
-> [{:license-id "GPL-2.0" :or-later true}]

"GPL-2.0 WITH Classpath-exception-2.0"
-> [{:license-id "GPL-2.0"
     :license-exception-id "Classpath-exception-2.0"}]

"CDDL-1.1 OR (GPL-2.0+ WITH Classpath-exception-2.0)"
-> [{:license-id "CDDL-1.1"}
    :or
    {:license-id "GPL-2.0"
     :or-later true
     :license-exception-id "Classpath-exception-2.0"}]
sourceraw docstring

parse-with-infoclj

(parse-with-info s)

As for parse, but returns instaparse parse error info if parsing fails, instead of nil.

See also https://github.com/Engelberg/instaparse#parse-errors

As for parse, but returns instaparse parse error info if parsing fails,
instead of nil.

See also https://github.com/Engelberg/instaparse#parse-errors
sourceraw docstring

valid?clj

(valid? s)

Is the given string a valid SPDX license expression?

Note: if you intend to parse the given string if it's valid, it's more efficient to call parse directly and check for a nil result.

Is the given string a valid SPDX license expression?

Note: if you intend to parse the given string if it's valid, it's more
efficient to call parse directly and check for a nil result.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close