Description
The SPDX license expression spec can be interpreted in many different and incompatible ways about the parentheses.
Actually, the new parser considers LGPL-2.1 AND MIT
as a valid expression, but many people are saying that complex expressions must be encapsulated with parentheses, and thus LGPL-2.1 AND MIT
is invalid. For example:
Any license expression that consists of more than one license identifier and/or LicenseRef should be encapsulated by parentheses.
There are similar parentheses in the examples of the npm doc.
I wrote the new parser mostly according to the formal grammar in the spec. And this grammar allows to omit those parentheses. Here is the proof:
LGPL-2.1
is asimple-expression
MIT
is also asimple-expression
- A
simple-expression
is also acompound-expression
LGPL-2.1 AND MIT
is acompound-expression
- A
compound-expression
is alicense-expression
It looks right.
However, it gets strange just below the grammar:
For the Tag:value format, any license expression that consists of more than one license identifier and/or LicenseRef, should be encapsulated by parentheses: "( )".
(I'm not here to blame the spec but it looks really strange. Why require parentheses? Or why not require parentheses in anyway? It would be much simpler.)
See also this in the SPDX wiki.
So:
- Is the SPDX license in npm's
package.json
file in Tag:value format? - Should the parser accept a
tagValueFormat
option? - Should this
tagValueFormat
option betrue
by default? - In examples, should we boycott useless parentheses or always use them?
- Should we ask The Linux Foundation to clarify the spec?
- Am I totally wrong?
Thanks.