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

[tree_sitter_v] Support for mut is clause #77

Merged
merged 4 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tree_sitter_v/bindings/node_types.v
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub enum NodeType {
interface_method_definition
interpolation_closing
interpreted_string_literal
is_clause
is_expression
key_value_attribute
keyed_element
Expand Down Expand Up @@ -394,6 +395,7 @@ const node_type_name_to_enum = {
'interface_method_definition': NodeType.interface_method_definition
'interpolation_closing': NodeType.interpolation_closing
'interpreted_string_literal': NodeType.interpreted_string_literal
'is_clause': NodeType.is_clause
'is_expression': NodeType.is_expression
'key_value_attribute': NodeType.key_value_attribute
'keyed_element': NodeType.keyed_element
Expand Down
5 changes: 4 additions & 1 deletion tree_sitter_v/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1190,10 +1190,13 @@ module.exports = grammar({
for_statement: ($) =>
seq(
'for',
optional(choice($.range_clause, $.for_clause, $._expression)),
optional(choice($.range_clause, $.for_clause, $.is_clause, $._expression)),
field('body', $.block),
),

is_clause: ($) =>
prec(PREC.primary, seq(optional(alias('mut', $.mutability_modifiers)), $.is_expression)),

range_clause: ($) =>
prec.left(
PREC.primary,
Expand Down
2 changes: 1 addition & 1 deletion tree_sitter_v/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"node-gyp-build": "^4.8.0"
},
"peerDependencies": {
"tree-sitter": "^0.21.0"
"tree-sitter": "^0.21.1"
},
"peerDependenciesMeta": {
"tree_sitter": {
Expand Down
34 changes: 34 additions & 0 deletions tree_sitter_v/src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions tree_sitter_v/src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading