Skip to content
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

New SPDX expression parser #8227

Merged
merged 4 commits into from
Feb 12, 2024
Merged

New SPDX expression parser #8227

merged 4 commits into from
Feb 12, 2024

Conversation

mnonnenmacher
Copy link
Member

Replace the ANTLR parser with a handwritten parser. See the commit messages for details.

@mnonnenmacher mnonnenmacher requested a review from a team as a code owner February 4, 2024 20:20
Copy link
Member

@sschuberth sschuberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pausing my review at the second commit and file utils/spdx/src/main/kotlin/parser/SpdxExpressionLexer.kt.

@mnonnenmacher mnonnenmacher force-pushed the spdx-expression-parser branch 2 times, most recently from f0da513 to cf4648a Compare February 6, 2024 18:37
Add a test dependency on kotest-framework-datatest to be able to use
data driven testing [1] in upcoming changes.

[1]: https://kotest.io/docs/framework/datatesting/data-driven-testing.html

Signed-off-by: Martin Nonnenmacher <[email protected]>
@mnonnenmacher mnonnenmacher force-pushed the spdx-expression-parser branch from cf4648a to 2f4560e Compare February 9, 2024 19:09
Add a handwritten parser for SPDX expressions which will replace the
parser generated by ANTLR in a later commit. Having a parser that is
implemented in pure Kotlin will make it possible to make `spdx-utils` a
multiplatform module.

Performance tests with various SPDX expressions have shown that the
handwritten parser is on average seven times faster than the one
generated by ANTLR.

Signed-off-by: Martin Nonnenmacher <[email protected]>
@mnonnenmacher mnonnenmacher force-pushed the spdx-expression-parser branch from 2f4560e to 1b2a53f Compare February 9, 2024 22:20
Replace the ANTLR based parser with the new implementation in
`SpdxExpression.parse()`.

Signed-off-by: Martin Nonnenmacher <[email protected]>
Remove the dependency on ANTLR and all related files as the parser
generated by ANTLR was replaced in the previous commit.

Relates to #8164.

Signed-off-by: Martin Nonnenmacher <[email protected]>
@fviernau fviernau dismissed their stale review February 12, 2024 09:56

Addressed.

@mnonnenmacher mnonnenmacher merged commit 4c73645 into main Feb 12, 2024
@mnonnenmacher mnonnenmacher deleted the spdx-expression-parser branch February 12, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants