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

Improve parsing of node paths in references #19

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

igor-prusov
Copy link
Contributor

This change fixes handling of paths with unit addresses in the middle,
i.e. path = <&/path@100/to@200/node>; Each path segment is represented
by a separate node so grammar's users don't have to parse it manually.

This fixes ~150 false positives on current Linux DTS files.

grammar.js Outdated
),
path_in_tree: ($) => repeat1($.path_node),
_node_reference: ($) => seq('&{', alias($.path_in_tree, $.path), '}'),
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure I understand this part. Is there a reason that "path_in_tree" is being aliased to "path" instead of just being named "path" to begin with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My initial idea was to use a separate rule for paths to nodes to avoid potential overlap with paths in includes, but it seems like string_literal works fine there, so I removed this alias.

This change fixes handling of paths with unit addresses in the middle,
i.e. path = <&/path@100/to@200/node>; Each path segment is represented
by a separate node so grammar's users don't have to parse it manually.
@joelspadin
Copy link
Owner

Looks good to me. Thanks!

@joelspadin joelspadin merged commit 16f640f into joelspadin:main Nov 3, 2024
4 checks passed
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.

2 participants