Skip to content

Commit

Permalink
Merge pull request #2 from MarkMcCulloh/sync
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMcCulloh authored Apr 14, 2024
2 parents 86ecf36 + e0e8a5f commit 5ce7e00
Show file tree
Hide file tree
Showing 6 changed files with 22,497 additions and 22,426 deletions.
10 changes: 8 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = grammar({

// These modifier conflicts should be solved through GLR parsing
[$.field_modifiers, $.method_modifiers],
[$.class_modifiers, $.closure_modifiers],
[$.class_modifiers, $.closure_modifiers, $.interface_modifiers],
[$.inflight_method_signature, $.field_modifiers],
],

Expand Down Expand Up @@ -225,14 +225,20 @@ module.exports = grammar({
$._semicolon
),

/// Interfaces

interface_modifiers: ($) =>
repeat1(choice($.access_modifier, $.inflight_specifier)),

interface_definition: ($) =>
seq(
optional(field("access_modifier", $.access_modifier)),
optional(field("modifiers", $.interface_modifiers)),
"interface",
field("name", $.identifier),
optional(seq("extends", field("extends", commaSep1($.custom_type)))),
field("implementation", $.interface_implementation)
),

interface_implementation: ($) =>
braced(
repeat(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglang/tree-sitter-wing",
"version": "0.69.1",
"version": "0.70.6",
"description": "winglang grammar for tree-sitter",
"main": "bindings/node",
"keywords": [
Expand Down
23 changes: 20 additions & 3 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,22 @@
}
]
},
"interface_modifiers": {
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "access_modifier"
},
{
"type": "SYMBOL",
"name": "inflight_specifier"
}
]
}
},
"interface_definition": {
"type": "SEQ",
"members": [
Expand All @@ -1133,10 +1149,10 @@
"members": [
{
"type": "FIELD",
"name": "access_modifier",
"name": "modifiers",
"content": {
"type": "SYMBOL",
"name": "access_modifier"
"name": "interface_modifiers"
}
},
{
Expand Down Expand Up @@ -4515,7 +4531,8 @@
],
[
"class_modifiers",
"closure_modifiers"
"closure_modifiers",
"interface_modifiers"
],
[
"inflight_method_signature",
Expand Down
39 changes: 29 additions & 10 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -1481,16 +1481,6 @@
"type": "interface_definition",
"named": true,
"fields": {
"access_modifier": {
"multiple": false,
"required": false,
"types": [
{
"type": "access_modifier",
"named": true
}
]
},
"extends": {
"multiple": true,
"required": false,
Expand All @@ -1515,6 +1505,16 @@
}
]
},
"modifiers": {
"multiple": false,
"required": false,
"types": [
{
"type": "interface_modifiers",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
Expand Down Expand Up @@ -1550,6 +1550,25 @@
]
}
},
{
"type": "interface_modifiers",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "access_modifier",
"named": true
},
{
"type": "inflight_specifier",
"named": true
}
]
}
},
{
"type": "json_container_type",
"named": true,
Expand Down
Loading

0 comments on commit 5ce7e00

Please sign in to comment.