Skip to content

Commit b8ef948

Browse files
committed
Simplify nodetypes for _pattern_constant
* alias 'pattern_constant_resolution' as 'scope_resolution' * replace 'pattern_constant' with just 'constant'
1 parent 12f10a5 commit b8ef948

5 files changed

Lines changed: 89386 additions & 89409 deletions

File tree

grammar.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,11 @@ module.exports = grammar({
522522
variable_reference_pattern: $ => seq('^', field('name', $.identifier)),
523523

524524
_pattern_constant: $ => choice(
525-
$.pattern_constant,
526-
$.pattern_constant_resolution
525+
$.constant,
526+
alias($._pattern_constant_resolution, $.scope_resolution)
527527
),
528528

529-
pattern_constant: $ => field('name', $.constant),
530-
531-
pattern_constant_resolution: $ => seq(
529+
_pattern_constant_resolution: $ => seq(
532530
optional(field('scope', $._pattern_constant)),
533531
'::',
534532
field('name', $.constant)

src/grammar.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,23 +2763,20 @@
27632763
"members": [
27642764
{
27652765
"type": "SYMBOL",
2766-
"name": "pattern_constant"
2766+
"name": "constant"
27672767
},
27682768
{
2769-
"type": "SYMBOL",
2770-
"name": "pattern_constant_resolution"
2769+
"type": "ALIAS",
2770+
"content": {
2771+
"type": "SYMBOL",
2772+
"name": "_pattern_constant_resolution"
2773+
},
2774+
"named": true,
2775+
"value": "scope_resolution"
27712776
}
27722777
]
27732778
},
2774-
"pattern_constant": {
2775-
"type": "FIELD",
2776-
"name": "name",
2777-
"content": {
2778-
"type": "SYMBOL",
2779-
"name": "constant"
2780-
}
2781-
},
2782-
"pattern_constant_resolution": {
2779+
"_pattern_constant_resolution": {
27832780
"type": "SEQ",
27842781
"members": [
27852782
{

src/node-types.json

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@
160160
"named": true,
161161
"subtypes": [
162162
{
163-
"type": "pattern_constant",
163+
"type": "constant",
164164
"named": true
165165
},
166166
{
167-
"type": "pattern_constant_resolution",
167+
"type": "scope_resolution",
168168
"named": true
169169
}
170170
]
@@ -2546,48 +2546,6 @@
25462546
]
25472547
}
25482548
},
2549-
{
2550-
"type": "pattern_constant",
2551-
"named": true,
2552-
"fields": {
2553-
"name": {
2554-
"multiple": false,
2555-
"required": true,
2556-
"types": [
2557-
{
2558-
"type": "constant",
2559-
"named": true
2560-
}
2561-
]
2562-
}
2563-
}
2564-
},
2565-
{
2566-
"type": "pattern_constant_resolution",
2567-
"named": true,
2568-
"fields": {
2569-
"name": {
2570-
"multiple": false,
2571-
"required": true,
2572-
"types": [
2573-
{
2574-
"type": "constant",
2575-
"named": true
2576-
}
2577-
]
2578-
},
2579-
"scope": {
2580-
"multiple": false,
2581-
"required": false,
2582-
"types": [
2583-
{
2584-
"type": "_pattern_constant",
2585-
"named": true
2586-
}
2587-
]
2588-
}
2589-
}
2590-
},
25912549
{
25922550
"type": "pattern_pair",
25932551
"named": true,
@@ -2946,6 +2904,10 @@
29462904
"multiple": false,
29472905
"required": false,
29482906
"types": [
2907+
{
2908+
"type": "_pattern_constant",
2909+
"named": true
2910+
},
29492911
{
29502912
"type": "_primary",
29512913
"named": true

0 commit comments

Comments
 (0)