Skip to content

dts.pest: Add support for comments in devicetree source files #96

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

Open
wants to merge 1 commit into
base: v4.1-branch
Choose a base branch
from

Conversation

pillo79
Copy link

@pillo79 pillo79 commented May 2, 2025

Add support for comments in devicetree source files by extending the existing parser grammar. This is currently required to allow CI to pass on zephyrproject-rtos/zephyr#89410.

I have zero experience on Rust, but the COMMENT = syntax is taken verbatim from an example on the Pest website, and I also tried the change on the live editor there, so... I'm pretty hopeful 🙂

EDIT: CI passed on the manifest update PR (see message below)

This commit adds support for comments in devicetree source files by
extending the existing parser grammar.

The COMMENTS syntax is taken verbatim from a Pest example at
https://pest.rs/book/grammars/syntax.html .

Signed-off-by: Luca Burelli <[email protected]>
@pillo79 pillo79 force-pushed the pr-dts-allow-comments branch from f365bd7 to 58b3897 Compare May 2, 2025 17:41
@pillo79 pillo79 changed the base branch from main to v4.1-branch May 2, 2025 17:44
@pillo79
Copy link
Author

pillo79 commented May 2, 2025

Above manifest update PR passed Zephyr CI on the Rust targets.

Compare with the errors with current v4.1-branch in the original PR when comments are not ignored by the Rust DTS parser:

Parsing zephyr.dts: Error { variant: ParsingError { positives: [label], negatives: [] }, location: Pos(11), line_col: Pos((3, 1)), path: None, line: "/* node '/' defined in zephyr/dts/riscv/qemu/virt-riscv.dtsi:15 */", continued_line: None, parse_attempts: None }

@pillo79
Copy link
Author

pillo79 commented May 7, 2025

@d3zd3z PTAL when you have the chance, thanks!

I based this on the stable branch for CI to pass on the Zephyr PR, but it's trivial to apply to main as well. Should I file a separate PR?

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.

1 participant