8000 Use a fallback syntect syntax rather than a custom Rust parser in the license checker. by jrvanwhy · Pull Request #3434 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use a fallback syntect syntax rather than a custom Rust parser in the license checker. #3434

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

Merged
merged 1 commit into from
May 17, 2023

Conversation

jrvanwhy
Copy link
Contributor

The license checker uses the syntect crate to parse files wherever possible. syntect provides a number of syntax definitions for common language types. However, we have some files that syntect does not recognize. Currently, the license checker falls back to a hand-coded parser if it encounters a file type that syntect does not recognize. This PR removes that hand-coded parser, and replaces it with a fallback syntect syntax. This removes the duplicate parsing logic, replacing it with an easier-to-extend Sublime syntax definition file.

This will make it easier to resolve #3417, as one of the file types that syntect does not recognize does not support line comments (linker scripts), and parsing block comments is harder than parsing line comments.

… license checker.

The license checker uses the `syntect` crate to parse files wherever possible. `syntect` provides a number of syntax definitions for common language types. However, we have some files that `syntect` does not recognize. Currently, the license checker falls back to a hand-coded parser if it encounters a file type that `syntect` does not recognize. This PR removes that hand-coded parser, and replaces it with a fallback `syntect` syntax. This removes the duplicate parsing logic, replacing it with an easier-to-extend Sublime syntax definition file.

This will make it easier to resolve tock#3417, as one of the file types that `syntect` does not recognize does not support line comments (linker scripts), and parsing block comments is harder than parsing line comments.
@bradjc
Copy link
Contributor
bradjc commented May 17, 2023

bors r+

@bors
Copy link
Contributor
bors bot commented May 17, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 6051a5e into tock:master May 17, 2023
jrvanwhy pushed a commit to jrvanwhy/tock that referenced this pull request May 24, 2023
PR tock#3434 had the side effect of adding support for files with CRLF line endings. Regardless, the consensus in tock#3417 was to switch the jlink files to Unix line endings, so this PR does that. It also adds license headers to the jlink files. I did have to tweak the fallback syntax a bit, to allow a line that only contains a `#` to be counted as a comment.
jrvanwhy pushed a commit to jrvanwhy/tock that referenced this pull request Jun 6, 2023
PR tock#3434 had the side effect of adding support for files with CRLF line endings. Regardless, the consensus in tock#3417 was to switch the jlink files to Unix line endings, so this PR does that. It also adds license headers to the jlink files. I did have to tweak the fallback syntax a bit, to allow a line that only contains a `#` to be counted as a comment.
@jrvanwhy jrvanwhy deleted the refactor-fallback branch October 5, 2023 20:34
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.

Expand file type support in the license checker.
3 participants
0