tree-sitter-sh 0.11.0 → 0.12.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/grammar.js CHANGED
@@ -821,6 +821,8 @@ export default grammar({
821
821
  $._quoted_here_document_body_start,
822
822
  $._quoted_here_document_end_begin,
823
823
  $._quoted_here_document_end_text,
824
+ $._quoted_here_document_text,
825
+ $._quoted_here_document_text_run_begin,
824
826
  $._here_document_end_begin,
825
827
  $._here_document_end_leading_tabs,
826
828
  $._here_document_end_commit,
@@ -861,8 +863,10 @@ export default grammar({
861
863
  $._command_substitution_body_begin,
862
864
  $._subshell_close,
863
865
  $._word_bracket_literal_start,
866
+ $._assignment_bracket_literal_start,
864
867
  $._parameter_bracket_literal_start,
865
868
  $._word_bracket_fallback_end,
869
+ $._assignment_bracket_fallback_end,
866
870
  $._parameter_bracket_fallback_end,
867
871
  $._pattern_bracket_character_token,
868
872
  $._parameter_pattern_bracket_character_token,
@@ -1500,9 +1504,18 @@ export default grammar({
1500
1504
  choice(
1501
1505
  seq(
1502
1506
  $._quoted_here_document_end_begin,
1503
- optional($._here_document_end_leading_tabs),
1504
- optional(
1505
- alias($._quoted_here_document_end_text, $.here_document_end_text),
1507
+ repeat(
1508
+ choice(
1509
+ $._here_document_end_leading_tabs,
1510
+ $._line_continuation,
1511
+ seq(
1512
+ optional($._quoted_here_document_text_run_begin),
1513
+ alias(
1514
+ $._quoted_here_document_end_text,
1515
+ $.here_document_end_text,
1516
+ ),
1517
+ ),
1518
+ ),
1506
1519
  ),
1507
1520
  ),
1508
1521
  seq(
@@ -1581,9 +1594,16 @@ export default grammar({
1581
1594
  token.immediate(seq("\\", /[^\\\n$`]/)),
1582
1595
 
1583
1596
  quoted_here_document_body: ($) =>
1584
- repeat1(choice($.quoted_here_document_text, $._newline)),
1585
-
1586
- quoted_here_document_text: (_) => token.immediate(prec(-1, /[^\n]+/)),
1597
+ repeat1(
1598
+ choice(
1599
+ seq(
1600
+ optional($._quoted_here_document_text_run_begin),
1601
+ alias($._quoted_here_document_text, $.quoted_here_document_text),
1602
+ ),
1603
+ $._line_continuation,
1604
+ $._newline,
1605
+ ),
1606
+ ),
1587
1607
 
1588
1608
  assignment_word: ($) =>
1589
1609
  prec.dynamic(
@@ -1636,10 +1656,21 @@ export default grammar({
1636
1656
  _assignment_word_part: ($) =>
1637
1657
  choice(
1638
1658
  $._assignment_non_delimiter_part,
1639
- $._word_incomplete_bracket_literal,
1659
+ $._assignment_incomplete_bracket_literal,
1640
1660
  prec(-1, alias($._literal_slash, $.literal)),
1641
1661
  ),
1642
1662
 
1663
+ _assignment_incomplete_bracket_literal: ($) =>
1664
+ incompleteBracketLiteral(
1665
+ $,
1666
+ $._assignment_bracket_literal_start,
1667
+ choice(
1668
+ $._word_incomplete_bracket_literal_part,
1669
+ prec(-1, $._pattern_special_literal_left),
1670
+ ),
1671
+ $._assignment_bracket_fallback_end,
1672
+ ),
1673
+
1643
1674
  _assignment_literal: ($) => prec.right(assignmentPlainChunk($)),
1644
1675
 
1645
1676
  _assignment_colon_part: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-sh",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "description": "Tree-sitter grammar for POSIX sh.",
6
6
  "license": "MIT",
package/src/grammar.json CHANGED
@@ -3528,33 +3528,46 @@
3528
3528
  "name": "_quoted_here_document_end_begin"
3529
3529
  },
3530
3530
  {
3531
- "type": "CHOICE",
3532
- "members": [
3533
- {
3534
- "type": "SYMBOL",
3535
- "name": "_here_document_end_leading_tabs"
3536
- },
3537
- {
3538
- "type": "BLANK"
3539
- }
3540
- ]
3541
- },
3542
- {
3543
- "type": "CHOICE",
3544
- "members": [
3545
- {
3546
- "type": "ALIAS",
3547
- "content": {
3531
+ "type": "REPEAT",
3532
+ "content": {
3533
+ "type": "CHOICE",
3534
+ "members": [
3535
+ {
3548
3536
  "type": "SYMBOL",
3549
- "name": "_quoted_here_document_end_text"
3537
+ "name": "_here_document_end_leading_tabs"
3550
3538
  },
3551
- "named": true,
3552
- "value": "here_document_end_text"
3553
- },
3554
- {
3555
- "type": "BLANK"
3556
- }
3557
- ]
3539
+ {
3540
+ "type": "SYMBOL",
3541
+ "name": "_line_continuation"
3542
+ },
3543
+ {
3544
+ "type": "SEQ",
3545
+ "members": [
3546
+ {
3547
+ "type": "CHOICE",
3548
+ "members": [
3549
+ {
3550
+ "type": "SYMBOL",
3551
+ "name": "_quoted_here_document_text_run_begin"
3552
+ },
3553
+ {
3554
+ "type": "BLANK"
3555
+ }
3556
+ ]
3557
+ },
3558
+ {
3559
+ "type": "ALIAS",
3560
+ "content": {
3561
+ "type": "SYMBOL",
3562
+ "name": "_quoted_here_document_end_text"
3563
+ },
3564
+ "named": true,
3565
+ "value": "here_document_end_text"
3566
+ }
3567
+ ]
3568
+ }
3569
+ ]
3570
+ }
3558
3571
  }
3559
3572
  ]
3560
3573
  },
@@ -3963,9 +3976,35 @@
3963
3976
  "content": {
3964
3977
  "type": "CHOICE",
3965
3978
  "members": [
3979
+ {
3980
+ "type": "SEQ",
3981
+ "members": [
3982
+ {
3983
+ "type": "CHOICE",
3984
+ "members": [
3985
+ {
3986
+ "type": "SYMBOL",
3987
+ "name": "_quoted_here_document_text_run_begin"
3988
+ },
3989
+ {
3990
+ "type": "BLANK"
3991
+ }
3992
+ ]
3993
+ },
3994
+ {
3995
+ "type": "ALIAS",
3996
+ "content": {
3997
+ "type": "SYMBOL",
3998
+ "name": "_quoted_here_document_text"
3999
+ },
4000
+ "named": true,
4001
+ "value": "quoted_here_document_text"
4002
+ }
4003
+ ]
4004
+ },
3966
4005
  {
3967
4006
  "type": "SYMBOL",
3968
- "name": "quoted_here_document_text"
4007
+ "name": "_line_continuation"
3969
4008
  },
3970
4009
  {
3971
4010
  "type": "SYMBOL",
@@ -3974,17 +4013,6 @@
3974
4013
  ]
3975
4014
  }
3976
4015
  },
3977
- "quoted_here_document_text": {
3978
- "type": "IMMEDIATE_TOKEN",
3979
- "content": {
3980
- "type": "PREC",
3981
- "value": -1,
3982
- "content": {
3983
- "type": "PATTERN",
3984
- "value": "[^\\n]+"
3985
- }
3986
- }
3987
- },
3988
4016
  "assignment_word": {
3989
4017
  "type": "PREC_DYNAMIC",
3990
4018
  "value": 3,
@@ -4200,7 +4228,7 @@
4200
4228
  },
4201
4229
  {
4202
4230
  "type": "SYMBOL",
4203
- "name": "_word_incomplete_bracket_literal"
4231
+ "name": "_assignment_incomplete_bracket_literal"
4204
4232
  },
4205
4233
  {
4206
4234
  "type": "PREC",
@@ -4217,6 +4245,52 @@
4217
4245
  }
4218
4246
  ]
4219
4247
  },
4248
+ "_assignment_incomplete_bracket_literal": {
4249
+ "type": "PREC_DYNAMIC",
4250
+ "value": -2,
4251
+ "content": {
4252
+ "type": "PREC_RIGHT",
4253
+ "value": 1,
4254
+ "content": {
4255
+ "type": "SEQ",
4256
+ "members": [
4257
+ {
4258
+ "type": "ALIAS",
4259
+ "content": {
4260
+ "type": "SYMBOL",
4261
+ "name": "_assignment_bracket_literal_start"
4262
+ },
4263
+ "named": true,
4264
+ "value": "literal"
4265
+ },
4266
+ {
4267
+ "type": "REPEAT",
4268
+ "content": {
4269
+ "type": "CHOICE",
4270
+ "members": [
4271
+ {
4272
+ "type": "SYMBOL",
4273
+ "name": "_word_incomplete_bracket_literal_part"
4274
+ },
4275
+ {
4276
+ "type": "PREC",
4277
+ "value": -1,
4278
+ "content": {
4279
+ "type": "SYMBOL",
4280
+ "name": "_pattern_special_literal_left"
4281
+ }
4282
+ }
4283
+ ]
4284
+ }
4285
+ },
4286
+ {
4287
+ "type": "SYMBOL",
4288
+ "name": "_assignment_bracket_fallback_end"
4289
+ }
4290
+ ]
4291
+ }
4292
+ }
4293
+ },
4220
4294
  "_assignment_literal": {
4221
4295
  "type": "PREC_RIGHT",
4222
4296
  "value": 0,
@@ -13443,6 +13517,14 @@
13443
13517
  "type": "SYMBOL",
13444
13518
  "name": "_quoted_here_document_end_text"
13445
13519
  },
13520
+ {
13521
+ "type": "SYMBOL",
13522
+ "name": "_quoted_here_document_text"
13523
+ },
13524
+ {
13525
+ "type": "SYMBOL",
13526
+ "name": "_quoted_here_document_text_run_begin"
13527
+ },
13446
13528
  {
13447
13529
  "type": "SYMBOL",
13448
13530
  "name": "_here_document_end_begin"
@@ -13639,6 +13721,10 @@
13639
13721
  "type": "SYMBOL",
13640
13722
  "name": "_word_bracket_literal_start"
13641
13723
  },
13724
+ {
13725
+ "type": "SYMBOL",
13726
+ "name": "_assignment_bracket_literal_start"
13727
+ },
13642
13728
  {
13643
13729
  "type": "SYMBOL",
13644
13730
  "name": "_parameter_bracket_literal_start"
@@ -13647,6 +13733,10 @@
13647
13733
  "type": "SYMBOL",
13648
13734
  "name": "_word_bracket_fallback_end"
13649
13735
  },
13736
+ {
13737
+ "type": "SYMBOL",
13738
+ "name": "_assignment_bracket_fallback_end"
13739
+ },
13650
13740
  {
13651
13741
  "type": "SYMBOL",
13652
13742
  "name": "_parameter_bracket_fallback_end"
@@ -2999,6 +2999,10 @@
2999
2999
  "multiple": true,
3000
3000
  "required": false,
3001
3001
  "types": [
3002
+ {
3003
+ "type": "line_continuation",
3004
+ "named": true
3005
+ },
3002
3006
  {
3003
3007
  "type": "quoted_here_document_text",
3004
3008
  "named": true