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

A couple of bug fixes #292

Merged
merged 5 commits into from
Dec 22, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up the repo
uses: tree-sitter/setup-action/cli@v1
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v2
- name: Set up examples
run: |-
git clone https://github.com/numpy/numpy examples/numpy --single-branch --depth=1 --filter=blob:none
Expand Down
14 changes: 10 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ module.exports = grammar({
except_clause: $ => seq(
'except',
optional(seq(
$.expression,
field('value', $.expression),
optional(seq(
choice('as', ','),
$.expression,
field('alias', $.expression),
)),
)),
':',
Expand Down Expand Up @@ -943,15 +943,21 @@ module.exports = grammar({
)),

type: $ => choice(
$.expression,
prec(1, $.expression),
$.splat_type,
$.generic_type,
$.union_type,
$.constrained_type,
$.member_type,
),
splat_type: $ => prec(1, seq(choice('*', '**'), $.identifier)),
generic_type: $ => prec(1, seq($.identifier, $.type_parameter)),
generic_type: $ => prec(1, seq(
choice(
$.identifier,
alias('type', $.identifier),
),
$.type_parameter,
)),
union_type: $ => prec.left(seq($.type, '|', $.type)),
constrained_type: $ => prec.right(seq($.type, ':', $.type)),
member_type: $ => seq($.type, '.', $.identifier),
Expand Down
29 changes: 16 additions & 13 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json

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

42 changes: 34 additions & 8 deletions src/grammar.json

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

29 changes: 23 additions & 6 deletions src/node-types.json

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

Loading
Loading