From bda37cbc8adf49306ec53a29440e634662db9e4b Mon Sep 17 00:00:00 2001 From: "Alexios Zavras (zvr)" Date: Sat, 16 Aug 2025 14:55:39 +0200 Subject: [PATCH 1/7] Deletes the outdated RDF information from license expressions annex Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 71 ------------------------ 1 file changed, 71 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index ec40291566..3a55feac00 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -186,74 +186,3 @@ MIT AND (LGPL-2.1-or-later OR BSD-3-Clause) states the OR operator should be applied before the AND operator. That is, one should first select between the LGPL-2.1-or-later or the BSD-3-Clause license before applying the MIT license. -### License expressions in RDF - -A conjunctive license can be expressed in RDF via a `` element, with an spdx:member property for each element in the conjunctive license. Two or more members are required. - -```XML - - - - - In exchange for using this software, you agree to give - its author all your worldly possessions. You will not - hold the author liable for all the damage this software - will inevitably cause not only to your person and - property, but to the entire fabric of the cosmos. - - LicenseRef-EternalSurrender - - -``` - -A disjunctive license can be expressed in RDF via a `` element, with an spdx:member property for each element in the disjunctive license. Two or more members are required. - -```XML - - - - - - In exchange for using this software, you agree to - give its author all your worldly possessions. You - will not hold the author liable for all the damage - this software will inevitably cause not only to - your person and property, but to the entire fabric - of the cosmos. - - LicenseRef-EternalSurrender - - - -``` - -A License Exception can be expressed in RDF via a `` element. This element has the following unique mandatory (unless specified otherwise) attributes: - -- `comment` - An `rdfs:comment` element describing the nature of the exception. -- `seeAlso` (optional, one or more)- An `rdfs:seeAlso` element referencing external sources of information on the exception. -- `example` (optional) - Text describing examples of this exception. -- `name` - The full human readable name of the item. -- `licenseExceptionId` - The identifier of an exception in the SPDX License List to which the exception applies. -- `licenseExceptionText` - Full text of the license exception. - -```XML - - This exception may be invalid in some - jurisdictions. - http://dilbert.com/strip/1997-01-15 - So this one time, I had a license exception - … - - A user of this software may decline to follow any subset of - the terms of this license upon finding any or all such terms - unfavorable. - - "But I Don't Want To" Exception - SPDXRef-ButIDontWantToException - - -``` From 7452b2a77341a9dd4fce0268b52f237044304041 Mon Sep 17 00:00:00 2001 From: "Alexios Zavras (zvr)" Date: Mon, 18 Aug 2025 17:16:21 +0200 Subject: [PATCH 2/7] Adds a complete ABNF grammar Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index 3a55feac00..425e00e29a 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -186,3 +186,68 @@ MIT AND (LGPL-2.1-or-later OR BSD-3-Clause) states the OR operator should be applied before the AND operator. That is, one should first select between the LGPL-2.1-or-later or the BSD-3-Clause license before applying the MIT license. +## Complete grammar + +The complete syntax of license expressions, +including precedence and whitespace, +is described by the following ABNF: + +``` ABNF +; ABNF Grammar for License Expressions + +expression = (or-operand *( required-ws KW_OR required-ws or-operand )) / special-identifier + +or-operand = (term required-ws KW_AND required-ws term *( required-ws KW_AND required-ws term )) / base-term + +term = base-term / special-identifier + +base-term = with-expression / identifier / parenthesized-expression + +with-expression = identifier required-ws KW_WITH required-ws addition-identifier + +addition-identifier = license-exception-id / addition-ref + +identifier = license-id / or-later-expression / licesnse-ref + +or-later-expression = license-id PLUS + +parenthesized-expression = LPAREN optional-ws expression optional-ws RPAREN + +special-identifier = "NONE" / "NOASSERTION" + +; --- Keywords --- + +KW_AND = %s"AND" / %s"and" +KW_OR = %s"OR" / %s"or" +KW_WITH = %s"WITH" / %s"with" + +; --- SPDX License List contents --- + +license-id = +license-exception-id = + +; --- User-defined identifiers --- + +license-ref = [%s"DocumentRef-"(idstring)":"]%s"LicenseRef-"(idstring) +addition-ref = [%s"DocumentRef-"(idstring)":"]%s"AdditionRef-"(idstring) + +idstring = *id-char alnum *id-char +idchar = alnum / DOT / DASH +alnum = ALPHA / DIGIT + +; --- Whitespace and characters --- + +optional-ws = *SPACE ; Optional whitespace (zero or more spaces) +required-ws = 1*SPACE ; Required whitespace (one or more spaces) + +SPACE = %x20 ; Space character +LPAREN = %x28 ; ( - Left parenthesis +RPAREN = %x29 ; ) - Right parenthesis +PLUS = %2B ; + - Plus +DASH = %2D ; - - Dash, hyphen +DOT = %2E ; . - Dot, fullstop, period + +ALPHA = %x41-5A / %x61-7A ; A-Z / a-z +DIGIT = %x30-39 ; 0-9 + +``` From 013b67b6177e3550551ec84232089c849be5fa99 Mon Sep 17 00:00:00 2001 From: "Alexios Zavras (zvr)" Date: Tue, 19 Aug 2025 09:32:41 +0200 Subject: [PATCH 3/7] Adds NONE and NOASSERTION, and simplifies old wordings in some places Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 42 ++++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index 425e00e29a..859155dda4 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -6,11 +6,11 @@ Often a single license can be used to represent the licensing terms of a source SPDX License Expressions provide a way for one to construct expressions that more accurately represent the licensing terms typically found in open source software source code. A license expression could be a single license identifier found on the SPDX License List; a user defined license reference denoted by the `LicenseRef-(idstring)`; a license identifier combined with an SPDX exception; or some combination of license identifiers, license references and exceptions constructed using a small set of defined operators (e.g., `AND`, `OR`, `WITH` and `+`). We provide the definition of what constitutes a valid SPDX License Expression in this section. -The exact syntax of license expressions is described below in ABNF, as defined +The general format of license expressions is described below in ABNF, as defined in [RFC 5234](https://datatracker.ietf.org/doc/rfc5234/) and expanded in [RFC 7405](https://datatracker.ietf.org/doc/rfc7405/). -```ANBF +```ABNF idstring = 1*(ALPHA / DIGIT / "-" / "." ) license-id = @@ -21,7 +21,7 @@ license-ref = [%s"DocumentRef-"(idstring)":"]%s"LicenseRef-"(idstring) addition-ref = [%s"DocumentRef-"(idstring)":"]%s"AdditionRef-"(idstring) -simple-expression = license-id / license-id"+" / license-ref +simple-expression = license-id / license-id"+" / license-ref / "NONE" / "NOASSERTION" addition-expression = license-exception-id / addition-ref @@ -46,21 +46,22 @@ A valid `` string consists of either: (ii) a more complex expression constructed by combining smaller valid expressions using Boolean license operators. -There MUST NOT be white space between a license-id and any following `+`. This supports easy parsing and backwards compatibility. There MUST be white space on either side of the operator "WITH". There MUST be white space and/or parentheses on either side of the operators `AND` and `OR`. +There MUST NOT be any space between a license-id and any following `+`. This supports easy parsing and backwards compatibility. -In the `tag:value` format, a license expression MUST be on a single line, and MUST NOT include a line break in the middle of the expression. +There MUST be at least one space on either side of the operators `AND`, `OR`, and "WITH". + +A license expression MUST be on a single line, and MUST NOT include a line break in the middle of the expression. ## Case sensitivity License expression operators (`AND`, `and`, `OR`, `or`, `WITH` and `with`) should be matched in a *case-sensitive* manner, i.e., letters must be all upper case or all lower case. License identifiers (including license exception identifiers) used in SPDX documents or source code files should be matched in a *case-insensitive* manner. In other words, `MIT`, `Mit` and `mIt` should all be treated as the same identifier and referring to the same license. - However, please be aware that it is often important to match with the case of the canonical identifier on the [SPDX License List](https://spdx.org/licenses). This is because the canonical identifier's case is used in the URL of the license's or exception's entry on the List, and because the canonical identifier is translated to a URI in RDF documents. For user defined license identifiers, only the variable part (after `LicenseRef-`) is case insensitive. This means, for example, that `LicenseRef-Name` and `LicenseRef-name` should be treated as the same identifier and considered to refer to the same license, while `licenseref-name` is not a valid license identifier. -The same applies to `AdditionRef-` user defined identifiers. +The same applies to `AdditionRef-` user defined addition identifiers, as well as to `DocumentRef-` for referencing other SPDX documents. ## Simple license expressions @@ -68,7 +69,8 @@ A simple `` is composed one of the following: - An SPDX License List Short Form Identifier. For example: `CDDL-1.0` - An SPDX License List Short Form Identifier with a unary "+" operator suffix to represent the current version of the license or any later version. For example: `CDDL-1.0+` -- An SPDX user defined license reference: +- One of the special identifiers "NONE" or "NOASSERTION" +- A user defined license reference: `["DocumentRef-"(idstring)":"]"LicenseRef-"(idstring)`. For example: `LicenseRef-23`, @@ -83,11 +85,9 @@ The current set of valid license identifiers can be found in [spdx.org/licenses] More expressive composite license expressions can be constructed using "OR", "AND", and "WITH" operators similar to constructing mathematical expressions using arithmetic operators. -For the `tag:value` format, any license expression that consists of more than one license identifier and/or LicenseRef, may optionally be encapsulated by parentheses: "( )". +Any license expression that consists of more than one license identifier and/or LicenseRef, may optionally be encapsulated by parentheses: "( )". -Nested parentheses can also be used to specify an order of precedence which is -discussed in more detail in -[Order of precedence and parentheses](#order-of-precedence-and-parentheses). +Nested parentheses can also be used to specify an order of precedence which is discussed in more detail below. ### Disjunctive "OR" operator @@ -111,11 +111,13 @@ An example representing a choice between three different licenses would be: LGPL-2.1-only OR MIT OR BSD-3-Clause ``` +The special identifiers "NONE" or "NOASSERTION" cannot be used with the OR operator. + It is allowed to use the operator in lower case form `or`. ### Conjunctive "AND" operator -If required to simultaneously comply with two or more licenses, use the conjunctive binary "AND" operator to construct a new license expression, where both the left and right operands are a valid license expression values. +If required to simultaneously comply with two or more licenses, use the conjunctive binary "AND" operator to construct a new license expression, where both the left and right operands are valid license expression values. For example, when one is required to comply with both the LGPL-2.1-only and MIT licenses, a valid expression would be: @@ -129,12 +131,14 @@ The "AND" operator is commutative, meaning that the above expression should be c MIT AND LGPL-2.1-only ``` -An example where all three different licenses apply would be: +An example where three different licenses apply would be: ```text LGPL-2.1-only AND MIT AND BSD-2-Clause ``` +The "AND" operator is the only operator that can be used in conjuction with the special identifiers "NONE" or "NOASSERTION". + It is allowed to use the operator in lower case form `and`. ### Additive "WITH" operator @@ -153,6 +157,8 @@ GPL-2.0-or-later WITH Bison-exception-2.2 The current set of valid license exceptions identifiers can be found in [spdx.org/licenses](https://spdx.org/licenses). +The special identifiers "NONE" or "NOASSERTION" cannot be used with the WITH operator. + It is allowed to use the operator in lower case form `with`. ### Order of precedence and parentheses @@ -181,7 +187,7 @@ When required to express an order of precedence that is different from the defau For instance, the following expression: ```text -MIT AND (LGPL-2.1-or-later OR BSD-3-Clause) +(LGPL-2.1-or-later OR BSD-3-Clause) AND MIT ``` states the OR operator should be applied before the AND operator. That is, one should first select between the LGPL-2.1-or-later or the BSD-3-Clause license before applying the MIT license. @@ -195,7 +201,7 @@ is described by the following ABNF: ``` ABNF ; ABNF Grammar for License Expressions -expression = (or-operand *( required-ws KW_OR required-ws or-operand )) / special-identifier +SPSX-license-expression = (or-operand *( required-ws KW_OR required-ws or-operand )) / special-identifier or-operand = (term required-ws KW_AND required-ws term *( required-ws KW_AND required-ws term )) / base-term @@ -228,8 +234,8 @@ license-exception-id = Date: Tue, 19 Aug 2025 23:06:03 +0200 Subject: [PATCH 4/7] Makes all license expressions case-insensitive Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 44 +++++++++--------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index 859155dda4..2612444ce5 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -17,9 +17,9 @@ license-id = license-exception-id = -license-ref = [%s"DocumentRef-"(idstring)":"]%s"LicenseRef-"(idstring) +license-ref = ["DocumentRef-"(idstring)":"]"LicenseRef-"(idstring) -addition-ref = [%s"DocumentRef-"(idstring)":"]%s"AdditionRef-"(idstring) +addition-ref = ["DocumentRef-"(idstring)":"]"AdditionRef-"(idstring) simple-expression = license-id / license-id"+" / license-ref / "NONE" / "NOASSERTION" @@ -27,11 +27,11 @@ addition-expression = license-exception-id / addition-ref compound-expression = (simple-expression / - simple-expression ( %s"WITH" / %s"with" ) addition-expression / + simple-expression "WITH" addition-expression / - compound-expression ( %s"AND" / %s"and" ) compound-expression / + compound-expression "AND" compound-expression / - compound-expression ( %s"OR" / %s"or" ) compound-expression / + compound-expression "OR" compound-expression / "(" compound-expression ")" ) @@ -54,14 +54,14 @@ A license expression MUST be on a single line, and MUST NOT include a line break ## Case sensitivity -License expression operators (`AND`, `and`, `OR`, `or`, `WITH` and `with`) should be matched in a *case-sensitive* manner, i.e., letters must be all upper case or all lower case. +In SPDX-3, license expressions are completely *case-insensitive*. -License identifiers (including license exception identifiers) used in SPDX documents or source code files should be matched in a *case-insensitive* manner. In other words, `MIT`, `Mit` and `mIt` should all be treated as the same identifier and referring to the same license. -However, please be aware that it is often important to match with the case of the canonical identifier on the [SPDX License List](https://spdx.org/licenses). This is because the canonical identifier's case is used in the URL of the license's or exception's entry on the List, and because the canonical identifier is translated to a URI in RDF documents. +That includes the operators (`AND`, `OR`, `WITH`), the special identifiers (`NONE` and `NOASSERTION`), as well as the license identifiers, including the user-defined ones. -For user defined license identifiers, only the variable part (after `LicenseRef-`) is case insensitive. This means, for example, that `LicenseRef-Name` and `LicenseRef-name` should be treated as the same identifier and considered to refer to the same license, while `licenseref-name` is not a valid license identifier. +For example, the expressions `MIT AND NOASSERTION AND (BSD-3-Clause OR LicenseRef-Name)` and `mit aNd NoaSSerTion AnD (bSd-3-clausE OR licenseref-NAME)` are equivalent. + +However, please be aware that it is often important to note the case of the canonical identifier on the [SPDX License List](https://spdx.org/licenses). This is because the canonical identifier's case is used in the URL of the license's or exception's entry on the List, and because the canonical identifier is translated to a URI in RDF documents. -The same applies to `AdditionRef-` user defined addition identifiers, as well as to `DocumentRef-` for referencing other SPDX documents. ## Simple license expressions @@ -77,7 +77,7 @@ A simple `` is composed one of the following: `LicenseRef-MIT-Style-1`, and `DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2` -The current set of valid license identifiers can be found in [spdx.org/licenses](https://spdx.org/licenses). +The current set of valid license identifiers can be found in the SPDX License List. ## Composite license expressions @@ -113,8 +113,6 @@ LGPL-2.1-only OR MIT OR BSD-3-Clause The special identifiers "NONE" or "NOASSERTION" cannot be used with the OR operator. -It is allowed to use the operator in lower case form `or`. - ### Conjunctive "AND" operator If required to simultaneously comply with two or more licenses, use the conjunctive binary "AND" operator to construct a new license expression, where both the left and right operands are valid license expression values. @@ -139,8 +137,6 @@ LGPL-2.1-only AND MIT AND BSD-2-Clause The "AND" operator is the only operator that can be used in conjuction with the special identifiers "NONE" or "NOASSERTION". -It is allowed to use the operator in lower case form `and`. - ### Additive "WITH" operator Sometimes license texts are found with additional text, which might or might not modify the original license terms. @@ -159,8 +155,6 @@ The current set of valid license exceptions identifiers can be found in [spdx.or The special identifiers "NONE" or "NOASSERTION" cannot be used with the WITH operator. -It is allowed to use the operator in lower case form `with`. - ### Order of precedence and parentheses The order of application of the operators in an expression matters (similar to mathematical operators). The default operator order of precedence of a `` is: @@ -201,15 +195,15 @@ is described by the following ABNF: ``` ABNF ; ABNF Grammar for License Expressions -SPSX-license-expression = (or-operand *( required-ws KW_OR required-ws or-operand )) / special-identifier +SPSX-license-expression = (or-operand *( required-ws "OR" required-ws or-operand )) / special-identifier -or-operand = (term required-ws KW_AND required-ws term *( required-ws KW_AND required-ws term )) / base-term +or-operand = (term required-ws "AND" required-ws term *( required-ws "AND" required-ws term )) / base-term term = base-term / special-identifier base-term = with-expression / identifier / parenthesized-expression -with-expression = identifier required-ws KW_WITH required-ws addition-identifier +with-expression = identifier required-ws "WITH" required-ws addition-identifier addition-identifier = license-exception-id / addition-ref @@ -221,12 +215,6 @@ parenthesized-expression = LPAREN optional-ws expression optional-ws RPAREN special-identifier = "NONE" / "NOASSERTION" -; --- Keywords --- - -KW_AND = %s"AND" / %s"and" -KW_OR = %s"OR" / %s"or" -KW_WITH = %s"WITH" / %s"with" - ; --- SPDX License List contents --- license-id = @@ -234,8 +222,8 @@ license-exception-id = Date: Wed, 20 Aug 2025 00:48:41 +0200 Subject: [PATCH 5/7] Replaces "MUST" with "shall" (as per #1236) Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index 2612444ce5..1ce0ddbe44 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -46,11 +46,11 @@ A valid `` string consists of either: (ii) a more complex expression constructed by combining smaller valid expressions using Boolean license operators. -There MUST NOT be any space between a license-id and any following `+`. This supports easy parsing and backwards compatibility. +There shall not be any space between a license-id and any following `+`. This supports easy parsing and backwards compatibility. -There MUST be at least one space on either side of the operators `AND`, `OR`, and "WITH". +There shall be at least one space on either side of the operators `AND`, `OR`, and "WITH". -A license expression MUST be on a single line, and MUST NOT include a line break in the middle of the expression. +A license expression shall be on a single line, and shall not include a line break in the middle of the expression. ## Case sensitivity From 5e9d4e9d7b64846e1093118ff6f8630848f82a11 Mon Sep 17 00:00:00 2001 From: "Alexios Zavras (zvr)" Date: Wed, 20 Aug 2025 21:06:15 +0200 Subject: [PATCH 6/7] Changes "can not" to "shall not" to express restriction Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index 1ce0ddbe44..d53e30ddef 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -111,7 +111,7 @@ An example representing a choice between three different licenses would be: LGPL-2.1-only OR MIT OR BSD-3-Clause ``` -The special identifiers "NONE" or "NOASSERTION" cannot be used with the OR operator. +The special identifiers "NONE" or "NOASSERTION" shall not be used with the OR operator. ### Conjunctive "AND" operator @@ -153,7 +153,7 @@ GPL-2.0-or-later WITH Bison-exception-2.2 The current set of valid license exceptions identifiers can be found in [spdx.org/licenses](https://spdx.org/licenses). -The special identifiers "NONE" or "NOASSERTION" cannot be used with the WITH operator. +The special identifiers "NONE" or "NOASSERTION" shall not be used with the WITH operator. ### Order of precedence and parentheses From d393c3f2eb99d60c7235d3c268d33a8226f2413a Mon Sep 17 00:00:00 2001 From: "Alexios Zavras (zvr)" Date: Wed, 27 Aug 2025 11:22:43 +0200 Subject: [PATCH 7/7] Changes to consistent referencing of operators Signed-off-by: Alexios Zavras (zvr) --- docs/annexes/spdx-license-expressions.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/annexes/spdx-license-expressions.md b/docs/annexes/spdx-license-expressions.md index d53e30ddef..b125df8e57 100644 --- a/docs/annexes/spdx-license-expressions.md +++ b/docs/annexes/spdx-license-expressions.md @@ -2,9 +2,9 @@ ## Overview -Often a single license can be used to represent the licensing terms of a source code or binary file, but there are situations where a single license identifier is not sufficient. A common example is when software is offered under a choice of one or more licenses (e.g., GPL-2.0-only OR BSD-3-Clause). Another example is when a set of licenses is needed to represent a binary program constructed by compiling and linking two (or more) different source files each governed by different licenses (e.g., LGPL-2.1-only AND BSD-3-Clause). +Often a single license can be used to represent the licensing terms of a source code or binary file, but there are situations where a single license identifier is not sufficient. A common example is when software is offered under a choice of one or more licenses (e.g., `GPL-2.0-only OR BSD-3-Clause`). Another example is when a set of licenses is needed to represent a binary program constructed by compiling and linking two (or more) different source files each governed by different licenses (e.g., `LGPL-2.1-only AND BSD-3-Clause`). -SPDX License Expressions provide a way for one to construct expressions that more accurately represent the licensing terms typically found in open source software source code. A license expression could be a single license identifier found on the SPDX License List; a user defined license reference denoted by the `LicenseRef-(idstring)`; a license identifier combined with an SPDX exception; or some combination of license identifiers, license references and exceptions constructed using a small set of defined operators (e.g., `AND`, `OR`, `WITH` and `+`). We provide the definition of what constitutes a valid SPDX License Expression in this section. +SPDX License Expressions provide a way for one to construct expressions that more accurately represent the licensing terms typically found in open source software source code. A license expression could be a single license identifier found on the SPDX License List; a user defined license reference denoted by the "LicenseRef-(idstring)"; a license identifier combined with an SPDX exception; or some combination of license identifiers, license references and exceptions constructed using a small set of defined operators (e.g., "AND", "OR", "WITH" and "+"). We provide the definition of what constitutes a valid SPDX License Expression in this section. The general format of license expressions is described below in ABNF, as defined in [RFC 5234](https://datatracker.ietf.org/doc/rfc5234/) and expanded @@ -46,17 +46,17 @@ A valid `` string consists of either: (ii) a more complex expression constructed by combining smaller valid expressions using Boolean license operators. -There shall not be any space between a license-id and any following `+`. This supports easy parsing and backwards compatibility. +There shall not be any space between a license-id and any following "+". This supports easy parsing and backwards compatibility. -There shall be at least one space on either side of the operators `AND`, `OR`, and "WITH". +There shall be at least one space on either side of the operators "AND", "OR", and "WITH". A license expression shall be on a single line, and shall not include a line break in the middle of the expression. ## Case sensitivity -In SPDX-3, license expressions are completely *case-insensitive*. +In SPDX 3, license expressions are completely *case-insensitive*. -That includes the operators (`AND`, `OR`, `WITH`), the special identifiers (`NONE` and `NOASSERTION`), as well as the license identifiers, including the user-defined ones. +That includes the operators ("AND", "OR", "WITH"), the special identifiers ("NONE" and "NOASSERTION"), as well as the license identifiers, including the user-defined ones. For example, the expressions `MIT AND NOASSERTION AND (BSD-3-Clause OR LicenseRef-Name)` and `mit aNd NoaSSerTion AnD (bSd-3-clausE OR licenseref-NAME)` are equivalent. @@ -111,7 +111,7 @@ An example representing a choice between three different licenses would be: LGPL-2.1-only OR MIT OR BSD-3-Clause ``` -The special identifiers "NONE" or "NOASSERTION" shall not be used with the OR operator. +The special identifiers "NONE" or "NOASSERTION" shall not be used with the "OR" operator. ### Conjunctive "AND" operator @@ -153,7 +153,7 @@ GPL-2.0-or-later WITH Bison-exception-2.2 The current set of valid license exceptions identifiers can be found in [spdx.org/licenses](https://spdx.org/licenses). -The special identifiers "NONE" or "NOASSERTION" shall not be used with the WITH operator. +The special identifiers "NONE" or "NOASSERTION" shall not be used with the "WITH" operator. ### Order of precedence and parentheses @@ -174,7 +174,7 @@ For example, the following expression: LGPL-2.1-only OR BSD-3-Clause AND MIT ``` -represents a license choice between either LGPL-2.1-only or the expression "BSD-3-Clause AND MIT" because the AND operator takes precedence over (is applied before) the OR operator. +represents a license choice between either LGPL-2.1-only or the expression "BSD-3-Clause AND MIT" because the "AND" operator takes precedence over (is applied before) the "OR" operator. When required to express an order of precedence that is different from the default order a `` can be encapsulated in pairs of parentheses: ( ), to indicate that the operators found inside the parentheses takes precedence over operators outside. This is also similar to the use of parentheses in an algebraic expression e.g., (5+7)/2. @@ -184,7 +184,7 @@ For instance, the following expression: (LGPL-2.1-or-later OR BSD-3-Clause) AND MIT ``` -states the OR operator should be applied before the AND operator. That is, one should first select between the LGPL-2.1-or-later or the BSD-3-Clause license before applying the MIT license. +states the "OR" operator should be applied before the "AND" operator. That is, one should first select between the LGPL-2.1-or-later or the BSD-3-Clause license before applying the MIT license. ## Complete grammar @@ -192,7 +192,7 @@ The complete syntax of license expressions, including precedence and whitespace, is described by the following ABNF: -``` ABNF +```ABNF ; ABNF Grammar for License Expressions SPSX-license-expression = (or-operand *( required-ws "OR" required-ws or-operand )) / special-identifier @@ -207,7 +207,7 @@ with-expression = identifier required-ws "WITH" required-ws addition-identifier addition-identifier = license-exception-id / addition-ref -identifier = license-id / or-later-expression / licesnse-ref +identifier = license-id / or-later-expression / license-ref or-later-expression = license-id PLUS