Liking cljdoc? Tell your friends :D

spdx.regexes

Regex related functionality. This functionality is bespoke (it does not use any logic from Spdx-Java-Library).

Regex related functionality.  This functionality is bespoke (it does not use
any logic from `Spdx-Java-Library`).
raw docstring

addition-ref-reclj

(addition-ref-re)

Returns a regex (Pattern) that can find or match any SPDX AdditionRef. The regex provides these named capturing groups:

  • AdditionDocumentRef (optional) - captures the DocumentRef tag of an AdditionRef, if it contains one
  • AdditionRef (always present) - captures the AdditionRef tag of an AdditionRef

Notes:

  • caches the generated Pattern object and returns it on subsequent calls, so is efficient when called many times
Returns a regex (`Pattern`) that can find or match any SPDX `AdditionRef`.
The regex provides these named capturing groups:

 * `AdditionDocumentRef` (optional) - captures the `DocumentRef` tag of an
   `AdditionRef`, if it contains one
 * `AdditionRef` (always present) - captures the `AdditionRef` tag of an
   `AdditionRef`

 Notes:

 * caches the generated `Pattern` object and returns it on subsequent calls, so
   is efficient when called many times
sourceraw docstring

build-reclj

(build-re ids)
(build-re ids
          {:keys [case-sensitive? include-license-refs? include-addition-refs?]
           :or {case-sensitive? false
                include-license-refs? false
                include-addition-refs? false}
           :as opts})

Returns a regex (Pattern) that can find or match the given SPDX ids (a sequence of Strings) in a source text. Returns nil if ids is nil or empty.

The regex provides these named capturing groups:

  • Identifier (always present) - captures the entire identifier, LicenseRef or AdditionRef
  • DocumentRef (optional) - captures the DocumentRef tag of a LicenseRef, if it contains one
  • LicenseRef (optional) - captures the LicenseRef tag of a LicenseRef
  • AdditionDocumentRef (optional) - captures the DocumentRef tag of an AdditionRef, if it contains one
  • AdditionRef (optional) - captures the AdditionRef tag of an AdditionRef

Groups should not be accessed by index, as the groups in the returned regexes are not part of the public contract of this API, and are liable to change over time. You may choose to use something like rencg to ensure your code is future proof in this regard.

ids will appear in the regex sorted from longest to shortest, so that more specific values are preferentially found or matched first - this avoids mismatches when one id is a subset of another id (e.g. GPL-2.0 and GPL-2.0-or-later).

opts are:

  • case-sensitive? (boolean, default false) - controls whether SPDX identifier matching is case sensitive or not. The spec explicitly states that SPDX identifiers are not case sensitive, but there may be cases where case sensitive matching is preferred. Note that regardless of this setting, LicenseRefs and AdditionRefs are always matched case sensitively - this is required by the spec.
  • include-license-refs? (boolean, default false) - controls whether LicenseRef support is also included in the regex
  • include-addition-refs? (boolean, default false) - controls whether AdditionRef support is also included in the regex
Returns a regex (`Pattern`) that can find or match the given SPDX `ids` (a
sequence of `String`s) in a source text. Returns `nil` if `ids` is `nil` or empty.

The regex provides these named capturing groups:

* `Identifier` (always present) - captures the entire identifier, `LicenseRef`
  or `AdditionRef`
* `DocumentRef` (optional) - captures the `DocumentRef` tag of a `LicenseRef`,
  if it contains one
* `LicenseRef` (optional) - captures the `LicenseRef` tag of a `LicenseRef`
* `AdditionDocumentRef` (optional) - captures the `DocumentRef` tag of an
  `AdditionRef`, if it contains one
* `AdditionRef` (optional) - captures the `AdditionRef` tag of an
  `AdditionRef`

Groups should _not_ be accessed by index, as the groups in the returned
regexes are not part of the public contract of this API, and are liable to
change over time.  You may choose to use something like
[rencg](https://github.com/pmonks/rencg) to ensure your code is future proof
in this regard.

`ids` will appear in the regex sorted from longest to shortest, so that more
specific values are preferentially found or matched first - this avoids
mismatches when one id is a subset of another id (e.g. `GPL-2.0` and
`GPL-2.0-or-later`).

`opts` are:

* `case-sensitive?` (`boolean`, default `false`) - controls whether SPDX
  identifier matching is case sensitive or not. The [spec explicitly states
  that SPDX identifiers are _not_ case sensitive](https://spdx.github.io/spdx-spec/v3.0.1/annexes/spdx-license-expressions/#case-sensitivity),
  but there may be cases where case sensitive matching is preferred.  Note
  that regardless of this setting, LicenseRefs and AdditionRefs are _always_
  matched case sensitively - this is required by the spec.
* `include-license-refs?` (`boolean`, default `false`) - controls whether
  `LicenseRef` support is also included in the regex
* `include-addition-refs?` (`boolean`, default `false`) - controls whether
  `AdditionRef` support is also included in the regex
sourceraw docstring

exception-ids-reclj

(exception-ids-re)

Returns a regex (Pattern) that can find or match any SPDX license exception identifier, or AdditionRef in a source text.

Specifics of the regex are as for build-re.

Notes:

  • caches the generated Pattern object and returns it on subsequent calls, so is efficient when called many times
Returns a regex (`Pattern`) that can find or match any SPDX license exception
identifier, or `AdditionRef` in a source text.

Specifics of the regex are as for [[build-re]].

Notes:

* caches the generated `Pattern` object and returns it on subsequent calls, so
  is efficient when called many times
sourceraw docstring

ids-reclj

(ids-re)

Returns a regex (Pattern) that can find or match any SPDX license identifier, SPDX exception identifier, LicenseRef, or AdditionRef in a source text.

Specifics of the regex are as for build-re.

Notes:

  • caches the generated Pattern object and returns it on subsequent calls, so is efficient when called many times
Returns a regex (`Pattern`) that can find or match any SPDX license
identifier, SPDX exception identifier, `LicenseRef`, or `AdditionRef` in
a source text.

Specifics of the regex are as for [[build-re]].

Notes:

* caches the generated `Pattern` object and returns it on subsequent calls, so
  is efficient when called many times
sourceraw 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.

Note: this method may have a substantial performance cost.

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.

Note: this method may have a substantial performance cost.
sourceraw docstring

license-ids-reclj

(license-ids-re)

Returns a regex (Pattern) that can find or match any SPDX license identifier, or LicenseRef in a source text.

Specifics of the regex are as for build-re.

Notes:

  • caches the generated Pattern object and returns it on subsequent calls, so is efficient when called many times
Returns a regex (`Pattern`) that can find or match any SPDX license
identifier, or `LicenseRef` in a source text.

Specifics of the regex are as for [[build-re]].

Notes:

* caches the generated `Pattern` object and returns it on subsequent calls, so
  is efficient when called many times
sourceraw docstring

license-ref-reclj

(license-ref-re)

Returns a regex (Pattern) that can find or match any SPDX LicenseRef. The regex provides these named capturing groups:

  • DocumentRef (optional) - captures the DocumentRef tag of a LicenseRef, if it contains one
  • LicenseRef (always present) - captures the LicenseRef tag of a LicenseRef

Notes:

  • caches the generated Pattern object and returns it on subsequent calls, so is efficient when called many times
Returns a regex (`Pattern`) that can find or match any SPDX `LicenseRef`.
The regex provides these named capturing groups:

* `DocumentRef` (optional) - captures the `DocumentRef` tag of a `LicenseRef`,
  if it contains one
* `LicenseRef` (always present) - captures the `LicenseRef` tag of a
  `LicenseRef`

Notes:

* caches the generated `Pattern` object and returns it on subsequent calls, so
  is efficient when called many times
sourceraw docstring

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

× close