Skip to content

Commit

Permalink
Add support for internal visibility modifier
Browse files Browse the repository at this point in the history
Summary:
Modern Hacklang introduced modules and the internal visibility modifier
to mark methods and functions as only accessible from within the current
module.

The Hacklang treesitter grammar doesn't support the internal visibility
modifier yet. This diff addresses it.

Test Plan:

Grammar tests pass:
```
tree-sitter generate
tree-sitter test
```

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
andryak committed Mar 21, 2024
1 parent fca1e29 commit c7a78c7
Show file tree
Hide file tree
Showing 6 changed files with 191,882 additions and 198,167 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ const rules = {

static_modifier: $ => 'static',

visibility_modifier: $ => choice('public', 'protected', 'private'),
visibility_modifier: $ => choice('public', 'protected', 'private', 'internal'),

attribute_modifier: $ =>
seq('<<', com($.qualified_identifier, opt($.arguments), ','), '>>'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"nan": "^2.14.1"
},
"devDependencies": {
"tree-sitter-cli": "~0.20.6"
"tree-sitter-cli": "^0.20.8"
},
"scripts": {
"build": "bin/generate-parser --force && node-gyp build",
Expand Down
4 changes: 4 additions & 0 deletions src/grammar.json

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

8 changes: 6 additions & 2 deletions src/node-types.json

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

Loading

0 comments on commit c7a78c7

Please sign in to comment.