Skip to content

What does the spec say about parentheses? #20

Open
@motet-a

Description

@motet-a

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 a simple-expression
  • MIT is also a simple-expression
  • A simple-expression is also a compound-expression
  • LGPL-2.1 AND MIT is a compound-expression
  • A compound-expression is a license-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 be true 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions