Skip to content

Commit

Permalink
refactor: rename block of case_clause to case_block
Browse files Browse the repository at this point in the history
This change is to follow the naming of the official Python grammar.
  • Loading branch information
theHamsta committed Aug 4, 2023
1 parent 8141216 commit ac9605b
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 236 deletions.
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ module.exports = grammar({
commaSep1(field('subject', $.expression)),
optional(','),
':',
field('body', alias($._match_block, $.block)),
field('body', $.case_block),
),

_match_block: $ => choice(
case_block: $ => choice(
seq(
$._indent,
repeat(field('alternative', $.case_clause)),
Expand Down
11 changes: 3 additions & 8 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -962,18 +962,13 @@
"type": "FIELD",
"name": "body",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_match_block"
},
"named": true,
"value": "block"
"type": "SYMBOL",
"name": "case_block"
}
}
]
},
"_match_block": {
"case_block": {
"type": "CHOICE",
"members": [
{
Expand Down
31 changes: 18 additions & 13 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -717,18 +717,7 @@
{
"type": "block",
"named": true,
"fields": {
"alternative": {
"multiple": true,
"required": false,
"types": [
{
"type": "case_clause",
"named": true
}
]
}
},
"fields": {},
"children": {
"multiple": true,
"required": false,
Expand Down Expand Up @@ -819,6 +808,22 @@
}
}
},
{
"type": "case_block",
"named": true,
"fields": {
"alternative": {
"multiple": true,
"required": false,
"types": [
{
"type": "case_clause",
"named": true
}
]
}
}
},
{
"type": "case_clause",
"named": true,
Expand Down Expand Up @@ -2007,7 +2012,7 @@
"required": true,
"types": [
{
"type": "block",
"type": "case_block",
"named": true
}
]
Expand Down
Loading

0 comments on commit ac9605b

Please sign in to comment.