tree-sitter-sed 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/grammar.js +264 -312
- package/common/regex.js +12 -23
- package/common/scanner.h +423 -460
- package/package.json +3 -3
- package/sed_ere/src/grammar.json +1264 -2013
- package/sed_ere/src/node-types.json +109 -32
- package/sed_ere/src/parser.c +37125 -36566
- package/src/grammar.json +1261 -2076
- package/src/node-types.json +131 -38
- package/src/parser.c +31231 -30740
- package/tree-sitter.json +1 -1
package/common/regex.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
const { issueField, namedExternal } = require("./dsl");
|
|
2
2
|
|
|
3
|
+
function subexpressionBody($, expression) {
|
|
4
|
+
return choice(
|
|
5
|
+
field("expression", expression),
|
|
6
|
+
issueField($, "empty_subexpression"),
|
|
7
|
+
issueField($, "missing_subexpression"),
|
|
8
|
+
$._missing_subexpression_placeholder_marker,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
function intervalExpression($, openingName, closingName) {
|
|
4
13
|
return seq(
|
|
5
14
|
field("opening", namedExternal($, $._regex_interval_open, openingName)),
|
|
@@ -438,27 +447,12 @@ function breRules() {
|
|
|
438
447
|
"opening",
|
|
439
448
|
namedExternal($, $._regex_group_open, "back_open_parenthesis"),
|
|
440
449
|
),
|
|
441
|
-
|
|
442
|
-
field("expression", $.basic_reg_exp),
|
|
443
|
-
issueField($, "empty_subexpression"),
|
|
444
|
-
issueField($, "missing_subexpression"),
|
|
445
|
-
$._missing_subexpression_placeholder_marker,
|
|
446
|
-
),
|
|
450
|
+
subexpressionBody($, $.basic_reg_exp),
|
|
447
451
|
field("closing", $.back_close_parenthesis),
|
|
448
452
|
),
|
|
449
453
|
$.backreference,
|
|
450
454
|
issueField($, "unmatched_subexpression_close"),
|
|
451
|
-
|
|
452
|
-
field(
|
|
453
|
-
"closing",
|
|
454
|
-
namedExternal(
|
|
455
|
-
$,
|
|
456
|
-
$._regex_unmatched_interval_close,
|
|
457
|
-
"back_close_brace",
|
|
458
|
-
),
|
|
459
|
-
),
|
|
460
|
-
issueField($, "unmatched_interval_close"),
|
|
461
|
-
),
|
|
455
|
+
issueField($, "unmatched_interval_close"),
|
|
462
456
|
),
|
|
463
457
|
|
|
464
458
|
back_close_parenthesis: ($) =>
|
|
@@ -589,12 +583,7 @@ function ereRules() {
|
|
|
589
583
|
"opening",
|
|
590
584
|
namedExternal($, $._regex_group_open, "open_parenthesis"),
|
|
591
585
|
),
|
|
592
|
-
|
|
593
|
-
field("expression", $.extended_reg_exp),
|
|
594
|
-
issueField($, "empty_subexpression"),
|
|
595
|
-
issueField($, "missing_subexpression"),
|
|
596
|
-
$._missing_subexpression_placeholder_marker,
|
|
597
|
-
),
|
|
586
|
+
subexpressionBody($, $.extended_reg_exp),
|
|
598
587
|
field("closing", $.close_parenthesis),
|
|
599
588
|
),
|
|
600
589
|
prec.left(
|