Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit 50a73f9

Browse files
committed
grammar: support map updates
1 parent 72149f4 commit 50a73f9

File tree

6 files changed

+10676
-10691
lines changed

6 files changed

+10676
-10691
lines changed

docs/tree-sitter-erlang.wasm

24 KB
Binary file not shown.

grammar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const PREC = {
6969
MODULE_DECLARATION: 8,
7070
FUNCTION_CLAUSE: 7,
7171
FUNCTION_NAME: 5,
72+
EXPR_MAP_UPDATE: 9,
7273
PARENTHESIZED_EXPRESSION: 6,
7374
EXPR_LIST_CONS: 5,
7475
EXPRESSION: 4,
@@ -176,6 +177,7 @@ module.exports = grammar({
176177

177178
_expression: ($) =>
178179
choice(
180+
$.expr_map_update,
179181
$.expr_try,
180182
$.expr_catch,
181183
$.expr_throw,
@@ -196,6 +198,9 @@ module.exports = grammar({
196198
$.match
197199
),
198200

201+
expr_map_update: ($) =>
202+
prec.left(PREC.EXPR_MAP_UPDATE, seq($.expression, $.map)),
203+
199204
expr_try: ($) =>
200205
seq(
201206
"try",

src/grammar.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@
505505
"_expression": {
506506
"type": "CHOICE",
507507
"members": [
508+
{
509+
"type": "SYMBOL",
510+
"name": "expr_map_update"
511+
},
508512
{
509513
"type": "SYMBOL",
510514
"name": "expr_try"
@@ -579,6 +583,23 @@
579583
}
580584
]
581585
},
586+
"expr_map_update": {
587+
"type": "PREC_LEFT",
588+
"value": 9,
589+
"content": {
590+
"type": "SEQ",
591+
"members": [
592+
{
593+
"type": "SYMBOL",
594+
"name": "expression"
595+
},
596+
{
597+
"type": "SYMBOL",
598+
"name": "map"
599+
}
600+
]
601+
}
602+
},
582603
"expr_try": {
583604
"type": "SEQ",
584605
"members": [

src/node-types.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,25 @@
475475
]
476476
}
477477
},
478+
{
479+
"type": "expr_map_update",
480+
"named": true,
481+
"fields": {},
482+
"children": {
483+
"multiple": true,
484+
"required": true,
485+
"types": [
486+
{
487+
"type": "expression",
488+
"named": true
489+
},
490+
{
491+
"type": "map",
492+
"named": true
493+
}
494+
]
495+
}
496+
},
478497
{
479498
"type": "expr_operator",
480499
"named": true,
@@ -840,6 +859,10 @@
840859
"type": "expr_list_comprehension",
841860
"named": true
842861
},
862+
{
863+
"type": "expr_map_update",
864+
"named": true
865+
},
843866
{
844867
"type": "expr_operator",
845868
"named": true
@@ -1783,11 +1806,11 @@
17831806
},
17841807
{
17851808
"type": "float",
1786-
"named": false
1809+
"named": true
17871810
},
17881811
{
17891812
"type": "float",
1790-
"named": true
1813+
"named": false
17911814
},
17921815
{
17931816
"type": "fun",

0 commit comments

Comments
 (0)