Closed mskelton closed 12 months ago
@joelspadin Anything that needs additional updates in this PR or can it be merged?
Sorry, I was busy with other things and forgot about this. Is there a reason you chose to only allow #include? Other preprocessor commands like #define, #if, etc. can be used anywhere in a file as well.
Sorry, I was busy with other things and forgot about this. Is there a reason you chose to only allow #include? Other preprocessor commands like #define, #if, etc. can be used anywhere in a file as well.
No specific reason other than I'm not super familiar with the language spec. Added the other preproc nodes.
@joelspadin any chance we can get this PR merged? I think I addressed all of the feedback at this point
I don't think the previous conversation on grammar.js has been resolved? It's fine if a preprocessor command doesn't parse unless there's whitespace after the first token, but including the whitespace in the token itself isn't ideal. For example, if code using this parser were to change the background color of #if
tokens, then I expect it would extend to the first whitespace character after the #if
as well.
@joelspadin I was able to figure it out finally and re-opened this pull request as I had some of my branches messed up https://github.com/joelspadin/tree-sitter-devicetree/pull/11
I'm using this for a Kinesis advantage 360 keyboard which uses ZMK. It is possible to use
#include
directives inside of nodes so that you can write code like this: