-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changed all the keywords to anonymous nodes #17
Conversation
These sneaked in during the keyword->anonymous node find-and-replace
I have tried it with a few of my vhdl files, and looked through your tests. Looks good to me, makes the tree more concise. I don't think these keywords need to be present in the tree. Most of them are implied anyway. In other languages the tree-sitter doesn't explicitly spell them out neither (at least the ones i have tried). |
The one I'm wondering about now is the architecture declaration followed by identifier and name. I think I should clarify that with field names (I agree that removing the keywords was a good choice, but now that part of the tree is not quite as readable). Let me come up with something and then push to this PR... I'm thinking to use the italic parts in the formal grammar for the field names... |
I'm quite happy with the commit above. It certainly makes the highlights easier: (_ view: (_) @type)
(_ type: (_) @type)
(_ library: (_) @namespace)
(_ package: (_) @namespace)
(_ entity: (_) @namespace)
(_ component: (_) @namespace)
(_ configuration: (_) @type.parameter)
(_ architecture: (_) @type.parameter)
(_ function: (_) @function)
(_ procedure: (_) @function.method)
(_ attribute: (_) @attribute)
(_ view: (name (_)) @type)
(_ type: (name (_)) @type)
(_ entity: (name (_)) @namespace)
(_ component: (name (_)) @namespace)
(_ configuration: (name (_)) @namespace) An architecture now builds the following tree: (design_file
(design_unit
(architecture_definition
architecture: (identifier)
entity: (name
(identifier))
(architecture_head
...
(concurrent_block
...
(end_architecture
architecture: (identifier))))) I'm going to merge to |
I think this is a good idea - anonymous nodes can still be used in most tree-sitter extensions. |
@Chris44442, @superzanti,
I got annoyed with all the keywords that are explicit in the syntax tree, so I changed them all to anonymous nodes (i.e. strings, like the operators are at the moment).
But I need a second opinion... Is this a good idea? Should I merge this? Are there keywords (like
all
, for example, that are better left explicit?