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

Add devicetree parser #683

Closed
wants to merge 58 commits into from
Closed

Conversation

arbrauns
Copy link
Contributor

No description provided.

nickcoutsos and others added 27 commits August 31, 2023 12:50
Define 'name' field for /delete-node/ and /delete-property/
Support `#include` directives in nodes
Removed Node latest from the build matrix, since tree-sitter is failing
to build on it.

Split up the GitHub workflow into separate build and linting workflows.
Added Mac and Windows builds to the tests, and added eslint.
"dts" is a much more common abbreviation for devicetree than "dt"
The other tree-sitter grammars I used as reference use a different main
branch name than I do. Fixed the branch name.
With the GitHub actions extension installed, these files are identified
as github-actions-workflow instead of yml.
Reworked labels to be a field on the labeled node instead of a separate
node type.

Added support for labels on property names and /memreserve/.
The Devicetree Specification v0.4, section 2.2.1 "Node Names", says

> The unit-address component of the name is specific to the bus type on
> which the node sits. It consists of one or more ASCII characters from
> the set of characters in Table 2.1.

Table 2.1 allows for all a-z characters, ',', '.', '_', '+', and '-'.

In normal use the unit-address is just a hex number and the devicetree
spec technically requires this by saying

> The unit-address must match the first address specified in the reg
> property of the node.

However the devicetree compiler supports the full ASCII table, and there
are a significant number of devicetrees in the Linux kernel that use the
unit-address as a "name" field. For example see
https://elixir.bootlin.com/linux/v6.7.4/source/arch/arm/boot/dts/marvell/armada-xp-crs328-4c-20s-4s.dtsi#L91
Changes based on tree-sitter-c as of 371fd0b
…ffd36932c57a5be01ba5d6b8a9337bb'

git-subtree-dir: vendored_parsers/tree-sitter-devicetree
git-subtree-mainline: 415c591
git-subtree-split: fb07e60
@Wilfred
Copy link
Owner

Wilfred commented May 14, 2024

I've just merged #642, but thanks for the PR :)

@Wilfred Wilfred closed this May 14, 2024
@arbrauns
Copy link
Contributor Author

Derp, should've searched first. Thanks!

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.

None yet

6 participants