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

Commit 11e9c6f

Browse files
committed
grammar: standardize expr node names
1 parent cf9daaf commit 11e9c6f

18 files changed

+1104
-1104
lines changed

grammar.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -303,33 +303,33 @@ module.exports = grammar({
303303

304304
expression: ($) =>
305305
choice(
306-
prec(PREC.PARENTHESIZED_EXPRESSION, parens($._expression)),
307-
prec(PREC.EXPRESSION, $._expression)
306+
prec(PREC.PARENTHESIZED_EXPRESSION, parens($._expr)),
307+
prec(PREC.EXPRESSION, $._expr)
308308
),
309309

310-
_expression: ($) =>
310+
_expr: ($) =>
311311
choice(
312-
$.expr_map_update,
313-
$.expr_record_update,
314-
$.expr_record_access,
315-
$.expr_try,
316-
$.expr_catch,
317-
$.expr_throw,
318312
$.expr_begin_block,
313+
$.expr_bitstring_comprehension,
314+
$.expr_case,
315+
$.expr_catch,
316+
$.expr_function_call,
317+
$.expr_if,
318+
$.expr_lambda,
319+
$.expr_list,
319320
$.expr_list_comprehension,
320-
$.expr_operator,
321+
$.expr_macro_application,
322+
$.expr_map_update,
323+
$.expr_match,
321324
$.expr_receive,
325+
$.expr_record_access,
326+
$.expr_record_update,
322327
$.expr_send,
323-
$.expr_if,
324-
$.expr_list,
325-
$.expr_bitstring_comprehension,
326-
$.case,
327-
$.variable,
328+
$.expr_throw,
329+
$.expr_try,
330+
$.expr_op,
328331
$.term,
329-
$.macro_application,
330-
$.function_call,
331-
$.lambda,
332-
$.match
332+
$.variable
333333
),
334334

335335
expr_map_update: ($) =>
@@ -402,7 +402,7 @@ module.exports = grammar({
402402
seq(BINARY_LEFT, $.expression, BINARY_RIGHT, REV_FAT_ARROW, $.expression),
403403
expr_bitstring_filter: ($) => sepBy(COMMA, $.expression),
404404

405-
expr_operator: ($) => choice($.expr_operator_unary, $.expr_operator_binary),
405+
expr_op: ($) => choice($.expr_operator_unary, $.expr_operator_binary),
406406

407407
expr_operator_unary: ($) =>
408408
prec(
@@ -465,7 +465,7 @@ module.exports = grammar({
465465
BRACKET_RIGHT
466466
),
467467

468-
case: ($) =>
468+
expr_case: ($) =>
469469
seq("case", $.expression, "of", sepBy(SEMI, $.case_clause), "end"),
470470

471471
case_clause: ($) =>
@@ -480,10 +480,10 @@ module.exports = grammar({
480480
guard_seq: ($) => sepBy(SEMI, $.guard),
481481
guard: ($) => sepBy(COMMA, $.expression),
482482

483-
match: ($) =>
483+
expr_match: ($) =>
484484
prec.right(PREC.MATCH, seq($.expression, EQUAL, $.expression)),
485485

486-
lambda: ($) => seq("fun", sepBy(SEMI, $.lambda_clause), "end"),
486+
expr_lambda: ($) => seq("fun", sepBy(SEMI, $.lambda_clause), "end"),
487487

488488
lambda_clause: ($) =>
489489
seq(
@@ -492,7 +492,7 @@ module.exports = grammar({
492492
field("body", sepBy(COMMA, $.expression))
493493
),
494494

495-
function_call: ($) =>
495+
expr_function_call: ($) =>
496496
seq(field("name", $._function_name), args($.expression)),
497497

498498
_function_name: ($) =>
@@ -514,7 +514,7 @@ module.exports = grammar({
514514
choice($.variable, $.atom, parens($.expression))
515515
),
516516

517-
macro_application: ($) =>
517+
expr_macro_application: ($) =>
518518
prec.right(
519519
PREC.MACRO_APPLICATION,
520520
seq(QUESTION, $._macro_name, opt(args($.expression)))

src/grammar.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@
13991399
},
14001400
{
14011401
"type": "SYMBOL",
1402-
"name": "_expression"
1402+
"name": "_expr"
14031403
},
14041404
{
14051405
"type": "STRING",
@@ -1413,97 +1413,97 @@
14131413
"value": 4,
14141414
"content": {
14151415
"type": "SYMBOL",
1416-
"name": "_expression"
1416+
"name": "_expr"
14171417
}
14181418
}
14191419
]
14201420
},
1421-
"_expression": {
1421+
"_expr": {
14221422
"type": "CHOICE",
14231423
"members": [
14241424
{
14251425
"type": "SYMBOL",
1426-
"name": "expr_map_update"
1426+
"name": "expr_begin_block"
14271427
},
14281428
{
14291429
"type": "SYMBOL",
1430-
"name": "expr_record_update"
1430+
"name": "expr_bitstring_comprehension"
14311431
},
14321432
{
14331433
"type": "SYMBOL",
1434-
"name": "expr_record_access"
1434+
"name": "expr_case"
14351435
},
14361436
{
14371437
"type": "SYMBOL",
1438-
"name": "expr_try"
1438+
"name": "expr_catch"
14391439
},
14401440
{
14411441
"type": "SYMBOL",
1442-
"name": "expr_catch"
1442+
"name": "expr_function_call"
14431443
},
14441444
{
14451445
"type": "SYMBOL",
1446-
"name": "expr_throw"
1446+
"name": "expr_if"
14471447
},
14481448
{
14491449
"type": "SYMBOL",
1450-
"name": "expr_begin_block"
1450+
"name": "expr_lambda"
14511451
},
14521452
{
14531453
"type": "SYMBOL",
1454-
"name": "expr_list_comprehension"
1454+
"name": "expr_list"
14551455
},
14561456
{
14571457
"type": "SYMBOL",
1458-
"name": "expr_operator"
1458+
"name": "expr_list_comprehension"
14591459
},
14601460
{
14611461
"type": "SYMBOL",
1462-
"name": "expr_receive"
1462+
"name": "expr_macro_application"
14631463
},
14641464
{
14651465
"type": "SYMBOL",
1466-
"name": "expr_send"
1466+
"name": "expr_map_update"
14671467
},
14681468
{
14691469
"type": "SYMBOL",
1470-
"name": "expr_if"
1470+
"name": "expr_match"
14711471
},
14721472
{
14731473
"type": "SYMBOL",
1474-
"name": "expr_list"
1474+
"name": "expr_receive"
14751475
},
14761476
{
14771477
"type": "SYMBOL",
1478-
"name": "expr_bitstring_comprehension"
1478+
"name": "expr_record_access"
14791479
},
14801480
{
14811481
"type": "SYMBOL",
1482-
"name": "case"
1482+
"name": "expr_record_update"
14831483
},
14841484
{
14851485
"type": "SYMBOL",
1486-
"name": "variable"
1486+
"name": "expr_send"
14871487
},
14881488
{
14891489
"type": "SYMBOL",
1490-
"name": "term"
1490+
"name": "expr_throw"
14911491
},
14921492
{
14931493
"type": "SYMBOL",
1494-
"name": "macro_application"
1494+
"name": "expr_try"
14951495
},
14961496
{
14971497
"type": "SYMBOL",
1498-
"name": "function_call"
1498+
"name": "expr_op"
14991499
},
15001500
{
15011501
"type": "SYMBOL",
1502-
"name": "lambda"
1502+
"name": "term"
15031503
},
15041504
{
15051505
"type": "SYMBOL",
1506-
"name": "match"
1506+
"name": "variable"
15071507
}
15081508
]
15091509
},
@@ -2083,7 +2083,7 @@
20832083
}
20842084
]
20852085
},
2086-
"expr_operator": {
2086+
"expr_op": {
20872087
"type": "CHOICE",
20882088
"members": [
20892089
{
@@ -2617,7 +2617,7 @@
26172617
}
26182618
]
26192619
},
2620-
"case": {
2620+
"expr_case": {
26212621
"type": "SEQ",
26222622
"members": [
26232623
{
@@ -2784,7 +2784,7 @@
27842784
}
27852785
]
27862786
},
2787-
"match": {
2787+
"expr_match": {
27882788
"type": "PREC_RIGHT",
27892789
"value": -1,
27902790
"content": {
@@ -2805,7 +2805,7 @@
28052805
]
28062806
}
28072807
},
2808-
"lambda": {
2808+
"expr_lambda": {
28092809
"type": "SEQ",
28102810
"members": [
28112811
{
@@ -2935,7 +2935,7 @@
29352935
}
29362936
]
29372937
},
2938-
"function_call": {
2938+
"expr_function_call": {
29392939
"type": "SEQ",
29402940
"members": [
29412941
{
@@ -3126,7 +3126,7 @@
31263126
]
31273127
}
31283128
},
3129-
"macro_application": {
3129+
"expr_macro_application": {
31303130
"type": "PREC_RIGHT",
31313131
"value": 1,
31323132
"content": {

0 commit comments

Comments
 (0)