pub struct ParseMode {
pub allow_lower_case_operators: bool,
pub allow_slash_as_or_operator: bool,
pub allow_imprecise_license_names: bool,
pub allow_postfix_plus_on_gpl: bool,
}
Expand description
Parsing configuration for SPDX expression
Fields§
§allow_lower_case_operators: bool
The AND
, OR
, and WITH
operators are required to be uppercase in
the SPDX spec, but enabling this option allows them to be lowercased
allow_slash_as_or_operator: bool
Allows the use of /
as a synonym for the OR
operator.
This also allows for not having whitespace between the /
and the terms
on either side
allow_imprecise_license_names: bool
Allows some invalid/imprecise identifiers as synonyms for an actual license identifier.
See IMPRECISE_NAMES
for a list
of the current synonyms. Note that this list is not comprehensive but
can be expanded upon when invalid identifiers are found in the wild.
allow_postfix_plus_on_gpl: bool
The various GPL licenses diverge from every other license in the SPDX
license list by having an -or-later
variant that is used as a suffix
on a base license (eg. GPL-3.0-or-later
) rather than the canonical
GPL-3.0+
.
This option just allows GPL licenses to be treated similarly to all of the other SPDX licenses.
Implementations§
Source§impl ParseMode
impl ParseMode
Sourcepub const STRICT: Self
pub const STRICT: Self
Strict, specification compliant SPDX parsing.
- Only license identifiers in the SPDX license list, or Document/LicenseRef, are allowed. The license identifiers are also case-sensitive.
WITH
,AND
, andOR
are the only valid operators
Sourcepub const LAX: Self
pub const LAX: Self
Allow non-conforming syntax for crates-io compatibility
- Additional, invalid, identifiers are accepted and mapped to a correct
SPDX license identifier.
See
IMPRECISE_NAMES
for the list of additionally accepted identifiers and the license they correspond to. /
can by used as a synonym forOR
, and doesn’t need to be separated by whitespace from the terms it combines