-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relaxed parsing? #11
Comments
bump |
Thanks for this PR. I'm not sure why I didn't see a notification the first time. I'm not usually a fan of bumps, but I'm thankful for this one! It's certainly possible to write a parser that works that way. Just drop an identifier-like pattern in for the static lists of standardized IDs and exception IDs in the grammar. There isn't really much to the syntax after that. Parentheses, However, I don't think that's what this package should be. Certainly for npm upstream, the main concern is single, invalid identifiers like Just FYI, non-list identifiers have certainly come up before. npm considered various "escape hatches" for custom and non-SPDX licenses, settling eventually on This parser actually retains support for |
I definitely agree with that sentiment and my request is in service to that. More specifically, I'd like to be able to show users where their license expression is incorrect and suggest how to fix it. You might think of this as spdx-correct on steroids:
But I can't do that without an AST, and I can't get an AST if the license token lexemes are literally the license list. I suppose I could write my own library, but that would seem like poor reuse. At the same time, I think the default behavior should be as-is, where invalid licenses raise errors. |
You're not going to bother me writing any new code, or even taking what I've written and turning it into your own package. |
@danielmoore, you may be interested in jslicense/spdx-correct.js#19, and especially @motet-a's work in #16. I'd also like to hear about your use case, if you can share. I'm seeing more complex expressions in issues than I expected to. |
The structure of the ABNF documented in Appendix IV of SPDX 2.1 makes it impossible to recover from an expression like
(MIT OR BSD)
using a tool like spdx-correct. Would it be reasonable to assume that alllicense-id
tokens are a subset of all validid-string
tokens so we could apply validation optionally at the parse phase instead of the lex phase?That is, could we do something like this:
The text was updated successfully, but these errors were encountered: