tree-sitter-batch 0.7.2 → 0.8.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/src/grammar.json CHANGED
@@ -95,6 +95,10 @@
95
95
  "type": "SYMBOL",
96
96
  "name": "parenthesized"
97
97
  },
98
+ {
99
+ "type": "SYMBOL",
100
+ "name": "macro_invocation"
101
+ },
98
102
  {
99
103
  "type": "SYMBOL",
100
104
  "name": "cmd"
@@ -207,11 +211,32 @@
207
211
  "members": [
208
212
  {
209
213
  "type": "STRING",
210
- "value": "::"
214
+ "value": ":"
215
+ },
216
+ {
217
+ "type": "PATTERN",
218
+ "value": "[^$a-zA-Z_\\r\\n]"
219
+ },
220
+ {
221
+ "type": "PATTERN",
222
+ "value": "[^\\r\\n]*"
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "type": "SEQ",
228
+ "members": [
229
+ {
230
+ "type": "STRING",
231
+ "value": "%#"
211
232
  },
212
233
  {
213
234
  "type": "PATTERN",
214
235
  "value": "[^\\r\\n]*"
236
+ },
237
+ {
238
+ "type": "STRING",
239
+ "value": "#%"
215
240
  }
216
241
  ]
217
242
  }
@@ -230,7 +255,28 @@
230
255
  },
231
256
  {
232
257
  "type": "PATTERN",
233
- "value": "[a-zA-Z_][a-zA-Z0-9_-]*"
258
+ "value": "[$a-zA-Z_][$a-zA-Z0-9_.#-]*"
259
+ },
260
+ {
261
+ "type": "CHOICE",
262
+ "members": [
263
+ {
264
+ "type": "SEQ",
265
+ "members": [
266
+ {
267
+ "type": "PATTERN",
268
+ "value": "[ \\t]"
269
+ },
270
+ {
271
+ "type": "PATTERN",
272
+ "value": "[^\\r\\n]*"
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ "type": "BLANK"
278
+ }
279
+ ]
234
280
  }
235
281
  ]
236
282
  }
@@ -298,13 +344,25 @@
298
344
  "value": "\""
299
345
  },
300
346
  {
301
- "type": "ALIAS",
347
+ "type": "REPEAT1",
302
348
  "content": {
303
- "type": "PATTERN",
304
- "value": "[a-zA-Z_][a-zA-Z0-9_()\\[\\]]*"
305
- },
306
- "named": true,
307
- "value": "variable_name"
349
+ "type": "CHOICE",
350
+ "members": [
351
+ {
352
+ "type": "SYMBOL",
353
+ "name": "variable_reference"
354
+ },
355
+ {
356
+ "type": "ALIAS",
357
+ "content": {
358
+ "type": "SYMBOL",
359
+ "name": "_quoted_var_name_pattern"
360
+ },
361
+ "named": true,
362
+ "value": "variable_name"
363
+ }
364
+ ]
365
+ }
308
366
  },
309
367
  {
310
368
  "type": "STRING",
@@ -325,6 +383,18 @@
325
383
  {
326
384
  "type": "STRING",
327
385
  "value": "\""
386
+ },
387
+ {
388
+ "type": "CHOICE",
389
+ "members": [
390
+ {
391
+ "type": "SYMBOL",
392
+ "name": "argument_list"
393
+ },
394
+ {
395
+ "type": "BLANK"
396
+ }
397
+ ]
328
398
  }
329
399
  ]
330
400
  },
@@ -332,13 +402,80 @@
332
402
  "type": "SEQ",
333
403
  "members": [
334
404
  {
335
- "type": "ALIAS",
405
+ "type": "STRING",
406
+ "value": "^\""
407
+ },
408
+ {
409
+ "type": "REPEAT1",
336
410
  "content": {
337
- "type": "PATTERN",
338
- "value": "[a-zA-Z_][a-zA-Z0-9_()\\[\\]]*"
339
- },
340
- "named": true,
341
- "value": "variable_name"
411
+ "type": "CHOICE",
412
+ "members": [
413
+ {
414
+ "type": "SYMBOL",
415
+ "name": "variable_reference"
416
+ },
417
+ {
418
+ "type": "ALIAS",
419
+ "content": {
420
+ "type": "SYMBOL",
421
+ "name": "_quoted_var_name_pattern"
422
+ },
423
+ "named": true,
424
+ "value": "variable_name"
425
+ }
426
+ ]
427
+ }
428
+ },
429
+ {
430
+ "type": "STRING",
431
+ "value": "="
432
+ },
433
+ {
434
+ "type": "CHOICE",
435
+ "members": [
436
+ {
437
+ "type": "SYMBOL",
438
+ "name": "caret_quoted_assignment_value"
439
+ },
440
+ {
441
+ "type": "BLANK"
442
+ }
443
+ ]
444
+ },
445
+ {
446
+ "type": "CHOICE",
447
+ "members": [
448
+ {
449
+ "type": "STRING",
450
+ "value": "^\""
451
+ },
452
+ {
453
+ "type": "BLANK"
454
+ }
455
+ ]
456
+ }
457
+ ]
458
+ },
459
+ {
460
+ "type": "SEQ",
461
+ "members": [
462
+ {
463
+ "type": "CHOICE",
464
+ "members": [
465
+ {
466
+ "type": "SYMBOL",
467
+ "name": "variable_reference"
468
+ },
469
+ {
470
+ "type": "ALIAS",
471
+ "content": {
472
+ "type": "SYMBOL",
473
+ "name": "_var_name_pattern"
474
+ },
475
+ "named": true,
476
+ "value": "variable_name"
477
+ }
478
+ ]
342
479
  },
343
480
  {
344
481
  "type": "STRING",
@@ -367,6 +504,114 @@
367
504
  ]
368
505
  }
369
506
  },
507
+ "caret_quoted_assignment_value": {
508
+ "type": "PREC_RIGHT",
509
+ "value": 0,
510
+ "content": {
511
+ "type": "REPEAT1",
512
+ "content": {
513
+ "type": "CHOICE",
514
+ "members": [
515
+ {
516
+ "type": "SYMBOL",
517
+ "name": "variable_reference"
518
+ },
519
+ {
520
+ "type": "ALIAS",
521
+ "content": {
522
+ "type": "PATTERN",
523
+ "value": "[^%!\\r\\n^]+"
524
+ },
525
+ "named": true,
526
+ "value": "assignment_literal"
527
+ },
528
+ {
529
+ "type": "ALIAS",
530
+ "content": {
531
+ "type": "STRING",
532
+ "value": "%"
533
+ },
534
+ "named": true,
535
+ "value": "assignment_literal"
536
+ },
537
+ {
538
+ "type": "ALIAS",
539
+ "content": {
540
+ "type": "STRING",
541
+ "value": "!"
542
+ },
543
+ "named": true,
544
+ "value": "assignment_literal"
545
+ },
546
+ {
547
+ "type": "ALIAS",
548
+ "content": {
549
+ "type": "TOKEN",
550
+ "content": {
551
+ "type": "PREC",
552
+ "value": 1,
553
+ "content": {
554
+ "type": "STRING",
555
+ "value": "^^"
556
+ }
557
+ }
558
+ },
559
+ "named": true,
560
+ "value": "assignment_literal"
561
+ },
562
+ {
563
+ "type": "ALIAS",
564
+ "content": {
565
+ "type": "STRING",
566
+ "value": "^"
567
+ },
568
+ "named": true,
569
+ "value": "assignment_literal"
570
+ }
571
+ ]
572
+ }
573
+ }
574
+ },
575
+ "_var_name_pattern": {
576
+ "type": "TOKEN",
577
+ "content": {
578
+ "type": "CHOICE",
579
+ "members": [
580
+ {
581
+ "type": "PATTERN",
582
+ "value": "[$@a-zA-Z_][$@a-zA-Z0-9_.#()\\[\\]]*"
583
+ },
584
+ {
585
+ "type": "PATTERN",
586
+ "value": "\\/[@a-zA-Z_][@a-zA-Z0-9_.#()\\[\\]]+"
587
+ }
588
+ ]
589
+ }
590
+ },
591
+ "_quoted_var_name_pattern": {
592
+ "type": "TOKEN",
593
+ "content": {
594
+ "type": "PREC",
595
+ "value": 1,
596
+ "content": {
597
+ "type": "CHOICE",
598
+ "members": [
599
+ {
600
+ "type": "PATTERN",
601
+ "value": "[^\\s=\"%][^=\"%]*"
602
+ },
603
+ {
604
+ "type": "PATTERN",
605
+ "value": "%%[a-zA-Z]?"
606
+ },
607
+ {
608
+ "type": "PATTERN",
609
+ "value": "\"[^=\"\\r\\n]+\""
610
+ }
611
+ ]
612
+ }
613
+ }
614
+ },
370
615
  "arithmetic_assignment": {
371
616
  "type": "SEQ",
372
617
  "members": [
@@ -449,7 +694,7 @@
449
694
  "type": "ALIAS",
450
695
  "content": {
451
696
  "type": "PATTERN",
452
- "value": "[a-zA-Z_][a-zA-Z0-9_()\\[\\]]*"
697
+ "value": "[@a-zA-Z_][@a-zA-Z0-9_()\\[\\]]*"
453
698
  },
454
699
  "named": true,
455
700
  "value": "variable_name"
@@ -513,11 +758,15 @@
513
758
  "type": "SYMBOL",
514
759
  "name": "variable_reference"
515
760
  },
761
+ {
762
+ "type": "SYMBOL",
763
+ "name": "assignment_paren_group"
764
+ },
516
765
  {
517
766
  "type": "ALIAS",
518
767
  "content": {
519
768
  "type": "PATTERN",
520
- "value": "[^%!\\r\\n]+"
769
+ "value": "[^%!()\\r\\n]+"
521
770
  },
522
771
  "named": true,
523
772
  "value": "assignment_literal"
@@ -544,6 +793,66 @@
544
793
  }
545
794
  }
546
795
  },
796
+ "assignment_paren_group": {
797
+ "type": "SEQ",
798
+ "members": [
799
+ {
800
+ "type": "STRING",
801
+ "value": "("
802
+ },
803
+ {
804
+ "type": "REPEAT",
805
+ "content": {
806
+ "type": "CHOICE",
807
+ "members": [
808
+ {
809
+ "type": "SYMBOL",
810
+ "name": "variable_reference"
811
+ },
812
+ {
813
+ "type": "SYMBOL",
814
+ "name": "assignment_paren_group"
815
+ },
816
+ {
817
+ "type": "ALIAS",
818
+ "content": {
819
+ "type": "PATTERN",
820
+ "value": "[^%!()\\r\\n]+"
821
+ },
822
+ "named": true,
823
+ "value": "assignment_literal"
824
+ },
825
+ {
826
+ "type": "PATTERN",
827
+ "value": "\\r?\\n"
828
+ },
829
+ {
830
+ "type": "ALIAS",
831
+ "content": {
832
+ "type": "STRING",
833
+ "value": "%"
834
+ },
835
+ "named": true,
836
+ "value": "assignment_literal"
837
+ },
838
+ {
839
+ "type": "ALIAS",
840
+ "content": {
841
+ "type": "STRING",
842
+ "value": "!"
843
+ },
844
+ "named": true,
845
+ "value": "assignment_literal"
846
+ }
847
+ ]
848
+ }
849
+ },
850
+ {
851
+ "type": "STRING",
852
+ "value": ")"
853
+ }
854
+ ]
855
+ },
547
856
  "quoted_assignment_value": {
548
857
  "type": "PREC_RIGHT",
549
858
  "value": 0,
@@ -616,6 +925,23 @@
616
925
  }
617
926
  }
618
927
  },
928
+ {
929
+ "type": "CHOICE",
930
+ "members": [
931
+ {
932
+ "type": "ALIAS",
933
+ "content": {
934
+ "type": "PATTERN",
935
+ "value": "\\/[iI]"
936
+ },
937
+ "named": true,
938
+ "value": "if_option"
939
+ },
940
+ {
941
+ "type": "BLANK"
942
+ }
943
+ ]
944
+ },
619
945
  {
620
946
  "type": "CHOICE",
621
947
  "members": [
@@ -662,6 +988,10 @@
662
988
  {
663
989
  "type": "SYMBOL",
664
990
  "name": "variable_reference"
991
+ },
992
+ {
993
+ "type": "SYMBOL",
994
+ "name": "argument_value"
665
995
  }
666
996
  ]
667
997
  }
@@ -682,8 +1012,21 @@
682
1012
  }
683
1013
  },
684
1014
  {
685
- "type": "PATTERN",
686
- "value": "[a-zA-Z_][a-zA-Z0-9_]*"
1015
+ "type": "CHOICE",
1016
+ "members": [
1017
+ {
1018
+ "type": "PATTERN",
1019
+ "value": "[$a-zA-Z_][$a-zA-Z0-9_.]*"
1020
+ },
1021
+ {
1022
+ "type": "SYMBOL",
1023
+ "name": "string"
1024
+ },
1025
+ {
1026
+ "type": "SYMBOL",
1027
+ "name": "variable_reference"
1028
+ }
1029
+ ]
687
1030
  }
688
1031
  ]
689
1032
  },
@@ -711,42 +1054,16 @@
711
1054
  "type": "SEQ",
712
1055
  "members": [
713
1056
  {
714
- "type": "CHOICE",
715
- "members": [
716
- {
717
- "type": "SYMBOL",
718
- "name": "string"
719
- },
720
- {
721
- "type": "SYMBOL",
722
- "name": "variable_reference"
723
- },
724
- {
725
- "type": "SYMBOL",
726
- "name": "integer"
727
- }
728
- ]
1057
+ "type": "SYMBOL",
1058
+ "name": "_if_operand"
729
1059
  },
730
1060
  {
731
1061
  "type": "SYMBOL",
732
1062
  "name": "comparison_op"
733
1063
  },
734
1064
  {
735
- "type": "CHOICE",
736
- "members": [
737
- {
738
- "type": "SYMBOL",
739
- "name": "string"
740
- },
741
- {
742
- "type": "SYMBOL",
743
- "name": "variable_reference"
744
- },
745
- {
746
- "type": "SYMBOL",
747
- "name": "integer"
748
- }
749
- ]
1065
+ "type": "SYMBOL",
1066
+ "name": "_if_operand"
750
1067
  }
751
1068
  ]
752
1069
  }
@@ -778,7 +1095,7 @@
778
1095
  },
779
1096
  {
780
1097
  "type": "SYMBOL",
781
- "name": "cmd"
1098
+ "name": "_body_stmt"
782
1099
  }
783
1100
  ]
784
1101
  }
@@ -811,13 +1128,107 @@
811
1128
  },
812
1129
  {
813
1130
  "type": "SYMBOL",
814
- "name": "cmd"
1131
+ "name": "_body_stmt"
815
1132
  }
816
1133
  ]
817
1134
  }
818
1135
  ]
819
1136
  }
820
1137
  },
1138
+ "_body_stmt": {
1139
+ "type": "CHOICE",
1140
+ "members": [
1141
+ {
1142
+ "type": "SYMBOL",
1143
+ "name": "cmd"
1144
+ },
1145
+ {
1146
+ "type": "SYMBOL",
1147
+ "name": "variable_assignment"
1148
+ },
1149
+ {
1150
+ "type": "SYMBOL",
1151
+ "name": "call_stmt"
1152
+ },
1153
+ {
1154
+ "type": "SYMBOL",
1155
+ "name": "goto_stmt"
1156
+ },
1157
+ {
1158
+ "type": "SYMBOL",
1159
+ "name": "exit_stmt"
1160
+ },
1161
+ {
1162
+ "type": "SYMBOL",
1163
+ "name": "setlocal_stmt"
1164
+ },
1165
+ {
1166
+ "type": "SYMBOL",
1167
+ "name": "endlocal_stmt"
1168
+ },
1169
+ {
1170
+ "type": "SYMBOL",
1171
+ "name": "if_stmt"
1172
+ },
1173
+ {
1174
+ "type": "SYMBOL",
1175
+ "name": "for_stmt"
1176
+ },
1177
+ {
1178
+ "type": "SYMBOL",
1179
+ "name": "redirect_stmt"
1180
+ },
1181
+ {
1182
+ "type": "SYMBOL",
1183
+ "name": "pipe_stmt"
1184
+ },
1185
+ {
1186
+ "type": "SYMBOL",
1187
+ "name": "comment"
1188
+ }
1189
+ ]
1190
+ },
1191
+ "_if_operand": {
1192
+ "type": "CHOICE",
1193
+ "members": [
1194
+ {
1195
+ "type": "SYMBOL",
1196
+ "name": "string"
1197
+ },
1198
+ {
1199
+ "type": "SYMBOL",
1200
+ "name": "variable_reference"
1201
+ },
1202
+ {
1203
+ "type": "SYMBOL",
1204
+ "name": "integer"
1205
+ },
1206
+ {
1207
+ "type": "SYMBOL",
1208
+ "name": "bracketed_value"
1209
+ },
1210
+ {
1211
+ "type": "ALIAS",
1212
+ "content": {
1213
+ "type": "SYMBOL",
1214
+ "name": "_if_word"
1215
+ },
1216
+ "named": true,
1217
+ "value": "argument_value"
1218
+ }
1219
+ ]
1220
+ },
1221
+ "_if_word": {
1222
+ "type": "TOKEN",
1223
+ "content": {
1224
+ "type": "PREC",
1225
+ "value": -1,
1226
+ "content": {
1227
+ "type": "PATTERN",
1228
+ "value": "[^=<>\\s\\[\\]\"|&()][^=<>\\s\"|&()]*"
1229
+ }
1230
+ }
1231
+ },
821
1232
  "comparison_op": {
822
1233
  "type": "TOKEN",
823
1234
  "content": {
@@ -891,39 +1302,76 @@
891
1302
  "type": "CHOICE",
892
1303
  "members": [
893
1304
  {
894
- "type": "TOKEN",
895
- "content": {
896
- "type": "PREC",
897
- "value": 10,
898
- "content": {
899
- "type": "PATTERN",
900
- "value": ":[eE][oO][fF]"
1305
+ "type": "CHOICE",
1306
+ "members": [
1307
+ {
1308
+ "type": "TOKEN",
1309
+ "content": {
1310
+ "type": "PREC",
1311
+ "value": 10,
1312
+ "content": {
1313
+ "type": "PATTERN",
1314
+ "value": ":[eE][oO][fF]"
1315
+ }
1316
+ }
1317
+ },
1318
+ {
1319
+ "type": "SEQ",
1320
+ "members": [
1321
+ {
1322
+ "type": "TOKEN",
1323
+ "content": {
1324
+ "type": "SEQ",
1325
+ "members": [
1326
+ {
1327
+ "type": "CHOICE",
1328
+ "members": [
1329
+ {
1330
+ "type": "STRING",
1331
+ "value": ":"
1332
+ },
1333
+ {
1334
+ "type": "BLANK"
1335
+ }
1336
+ ]
1337
+ },
1338
+ {
1339
+ "type": "PATTERN",
1340
+ "value": "[$a-zA-Z_][$a-zA-Z0-9_.#-]*"
1341
+ }
1342
+ ]
1343
+ }
1344
+ },
1345
+ {
1346
+ "type": "CHOICE",
1347
+ "members": [
1348
+ {
1349
+ "type": "SYMBOL",
1350
+ "name": "variable_reference"
1351
+ },
1352
+ {
1353
+ "type": "BLANK"
1354
+ }
1355
+ ]
1356
+ }
1357
+ ]
901
1358
  }
902
- }
1359
+ ]
1360
+ },
1361
+ {
1362
+ "type": "BLANK"
1363
+ }
1364
+ ]
1365
+ },
1366
+ {
1367
+ "type": "CHOICE",
1368
+ "members": [
1369
+ {
1370
+ "type": "SYMBOL",
1371
+ "name": "comment"
903
1372
  },
904
1373
  {
905
- "type": "TOKEN",
906
- "content": {
907
- "type": "SEQ",
908
- "members": [
909
- {
910
- "type": "CHOICE",
911
- "members": [
912
- {
913
- "type": "STRING",
914
- "value": ":"
915
- },
916
- {
917
- "type": "BLANK"
918
- }
919
- ]
920
- },
921
- {
922
- "type": "PATTERN",
923
- "value": "[a-zA-Z_][a-zA-Z0-9_-]*"
924
- }
925
- ]
926
- }
1374
+ "type": "BLANK"
927
1375
  }
928
1376
  ]
929
1377
  }
@@ -973,7 +1421,7 @@
973
1421
  },
974
1422
  {
975
1423
  "type": "PATTERN",
976
- "value": "[a-zA-Z_][a-zA-Z0-9_-]*"
1424
+ "value": "[$a-zA-Z_][$a-zA-Z0-9_.#-]*"
977
1425
  }
978
1426
  ]
979
1427
  }
@@ -981,6 +1429,10 @@
981
1429
  {
982
1430
  "type": "SYMBOL",
983
1431
  "name": "command_name"
1432
+ },
1433
+ {
1434
+ "type": "SYMBOL",
1435
+ "name": "variable_reference"
984
1436
  }
985
1437
  ]
986
1438
  },
@@ -1118,61 +1570,56 @@
1118
1570
  }
1119
1571
  },
1120
1572
  {
1121
- "type": "CHOICE",
1122
- "members": [
1123
- {
1124
- "type": "CHOICE",
1125
- "members": [
1126
- {
1127
- "type": "TOKEN",
1573
+ "type": "REPEAT",
1574
+ "content": {
1575
+ "type": "CHOICE",
1576
+ "members": [
1577
+ {
1578
+ "type": "TOKEN",
1579
+ "content": {
1580
+ "type": "PREC",
1581
+ "value": 10,
1128
1582
  "content": {
1129
- "type": "PREC",
1130
- "value": 10,
1131
- "content": {
1132
- "type": "PATTERN",
1133
- "value": "[eE][nN][aA][bB][lL][eE][dD][eE][lL][aA][yY][eE][dD][eE][xX][pP][aA][nN][sS][iI][oO][nN]"
1134
- }
1583
+ "type": "PATTERN",
1584
+ "value": "[eE][nN][aA][bB][lL][eE][dD][eE][lL][aA][yY][eE][dD][eE][xX][pP][aA][nN][sS][iI][oO][nN]"
1135
1585
  }
1136
- },
1137
- {
1138
- "type": "TOKEN",
1586
+ }
1587
+ },
1588
+ {
1589
+ "type": "TOKEN",
1590
+ "content": {
1591
+ "type": "PREC",
1592
+ "value": 10,
1139
1593
  "content": {
1140
- "type": "PREC",
1141
- "value": 10,
1142
- "content": {
1143
- "type": "PATTERN",
1144
- "value": "[dD][iI][sS][aA][bB][lL][eE][dD][eE][lL][aA][yY][eE][dD][eE][xX][pP][aA][nN][sS][iI][oO][nN]"
1145
- }
1594
+ "type": "PATTERN",
1595
+ "value": "[dD][iI][sS][aA][bB][lL][eE][dD][eE][lL][aA][yY][eE][dD][eE][xX][pP][aA][nN][sS][iI][oO][nN]"
1146
1596
  }
1147
- },
1148
- {
1149
- "type": "TOKEN",
1597
+ }
1598
+ },
1599
+ {
1600
+ "type": "TOKEN",
1601
+ "content": {
1602
+ "type": "PREC",
1603
+ "value": 10,
1150
1604
  "content": {
1151
- "type": "PREC",
1152
- "value": 10,
1153
- "content": {
1154
- "type": "PATTERN",
1155
- "value": "[eE][nN][aA][bB][lL][eE][eE][xX][tT][eE][nN][sS][iI][oO][nN][sS]"
1156
- }
1605
+ "type": "PATTERN",
1606
+ "value": "[eE][nN][aA][bB][lL][eE][eE][xX][tT][eE][nN][sS][iI][oO][nN][sS]"
1157
1607
  }
1158
- },
1159
- {
1160
- "type": "TOKEN",
1608
+ }
1609
+ },
1610
+ {
1611
+ "type": "TOKEN",
1612
+ "content": {
1613
+ "type": "PREC",
1614
+ "value": 10,
1161
1615
  "content": {
1162
- "type": "PREC",
1163
- "value": 10,
1164
- "content": {
1165
- "type": "PATTERN",
1166
- "value": "[dD][iI][sS][aA][bB][lL][eE][eE][xX][tT][eE][nN][sS][iI][oO][nN][sS]"
1167
- }
1616
+ "type": "PATTERN",
1617
+ "value": "[dD][iI][sS][aA][bB][lL][eE][eE][xX][tT][eE][nN][sS][iI][oO][nN][sS]"
1168
1618
  }
1169
1619
  }
1170
- ]
1171
- },
1172
- {
1173
- "type": "BLANK"
1174
- }
1175
- ]
1620
+ }
1621
+ ]
1622
+ }
1176
1623
  }
1177
1624
  ]
1178
1625
  }
@@ -1219,34 +1666,48 @@
1219
1666
  "type": "CHOICE",
1220
1667
  "members": [
1221
1668
  {
1222
- "type": "STRING",
1223
- "value": "@"
1669
+ "type": "SEQ",
1670
+ "members": [
1671
+ {
1672
+ "type": "CHOICE",
1673
+ "members": [
1674
+ {
1675
+ "type": "STRING",
1676
+ "value": "@"
1677
+ },
1678
+ {
1679
+ "type": "BLANK"
1680
+ }
1681
+ ]
1682
+ },
1683
+ {
1684
+ "type": "TOKEN",
1685
+ "content": {
1686
+ "type": "PREC",
1687
+ "value": 10,
1688
+ "content": {
1689
+ "type": "PATTERN",
1690
+ "value": "[fF][oO][rR]"
1691
+ }
1692
+ }
1693
+ },
1694
+ {
1695
+ "type": "CHOICE",
1696
+ "members": [
1697
+ {
1698
+ "type": "SYMBOL",
1699
+ "name": "for_options"
1700
+ },
1701
+ {
1702
+ "type": "BLANK"
1703
+ }
1704
+ ]
1705
+ }
1706
+ ]
1224
1707
  },
1225
- {
1226
- "type": "BLANK"
1227
- }
1228
- ]
1229
- },
1230
- {
1231
- "type": "TOKEN",
1232
- "content": {
1233
- "type": "PREC",
1234
- "value": 10,
1235
- "content": {
1236
- "type": "PATTERN",
1237
- "value": "[fF][oO][rR]"
1238
- }
1239
- }
1240
- },
1241
- {
1242
- "type": "CHOICE",
1243
- "members": [
1244
1708
  {
1245
1709
  "type": "SYMBOL",
1246
- "name": "for_options"
1247
- },
1248
- {
1249
- "type": "BLANK"
1710
+ "name": "variable_reference"
1250
1711
  }
1251
1712
  ]
1252
1713
  },
@@ -1305,7 +1766,7 @@
1305
1766
  },
1306
1767
  {
1307
1768
  "type": "SYMBOL",
1308
- "name": "cmd"
1769
+ "name": "_body_stmt"
1309
1770
  }
1310
1771
  ]
1311
1772
  }
@@ -1440,15 +1901,23 @@
1440
1901
  "type": "SYMBOL",
1441
1902
  "name": "variable_reference"
1442
1903
  },
1904
+ {
1905
+ "type": "SYMBOL",
1906
+ "name": "for_set_group"
1907
+ },
1443
1908
  {
1444
1909
  "type": "ALIAS",
1445
1910
  "content": {
1446
1911
  "type": "PATTERN",
1447
- "value": "[^%!)\\r\\n]+"
1912
+ "value": "[^%!()\\r\\n]+"
1448
1913
  },
1449
1914
  "named": true,
1450
1915
  "value": "for_set_literal"
1451
1916
  },
1917
+ {
1918
+ "type": "PATTERN",
1919
+ "value": "\\r?\\n"
1920
+ },
1452
1921
  {
1453
1922
  "type": "ALIAS",
1454
1923
  "content": {
@@ -1471,6 +1940,62 @@
1471
1940
  }
1472
1941
  }
1473
1942
  },
1943
+ "for_set_group": {
1944
+ "type": "SEQ",
1945
+ "members": [
1946
+ {
1947
+ "type": "STRING",
1948
+ "value": "("
1949
+ },
1950
+ {
1951
+ "type": "REPEAT",
1952
+ "content": {
1953
+ "type": "CHOICE",
1954
+ "members": [
1955
+ {
1956
+ "type": "SYMBOL",
1957
+ "name": "variable_reference"
1958
+ },
1959
+ {
1960
+ "type": "SYMBOL",
1961
+ "name": "for_set_group"
1962
+ },
1963
+ {
1964
+ "type": "ALIAS",
1965
+ "content": {
1966
+ "type": "PATTERN",
1967
+ "value": "[^%!()\\r\\n]+"
1968
+ },
1969
+ "named": true,
1970
+ "value": "for_set_literal"
1971
+ },
1972
+ {
1973
+ "type": "ALIAS",
1974
+ "content": {
1975
+ "type": "STRING",
1976
+ "value": "%"
1977
+ },
1978
+ "named": true,
1979
+ "value": "for_set_literal"
1980
+ },
1981
+ {
1982
+ "type": "ALIAS",
1983
+ "content": {
1984
+ "type": "STRING",
1985
+ "value": "!"
1986
+ },
1987
+ "named": true,
1988
+ "value": "for_set_literal"
1989
+ }
1990
+ ]
1991
+ }
1992
+ },
1993
+ {
1994
+ "type": "STRING",
1995
+ "value": ")"
1996
+ }
1997
+ ]
1998
+ },
1474
1999
  "parenthesized": {
1475
2000
  "type": "SEQ",
1476
2001
  "members": [
@@ -1525,28 +2050,59 @@
1525
2050
  "type": "PREC_RIGHT",
1526
2051
  "value": 4,
1527
2052
  "content": {
1528
- "type": "SEQ",
2053
+ "type": "CHOICE",
1529
2054
  "members": [
1530
2055
  {
1531
- "type": "CHOICE",
2056
+ "type": "SEQ",
1532
2057
  "members": [
1533
2058
  {
1534
- "type": "SYMBOL",
1535
- "name": "call_stmt"
1536
- },
1537
- {
1538
- "type": "SYMBOL",
1539
- "name": "cmd"
2059
+ "type": "CHOICE",
2060
+ "members": [
2061
+ {
2062
+ "type": "SYMBOL",
2063
+ "name": "call_stmt"
2064
+ },
2065
+ {
2066
+ "type": "SYMBOL",
2067
+ "name": "cmd"
2068
+ },
2069
+ {
2070
+ "type": "SYMBOL",
2071
+ "name": "parenthesized"
2072
+ }
2073
+ ]
1540
2074
  },
1541
2075
  {
1542
2076
  "type": "SYMBOL",
1543
- "name": "parenthesized"
2077
+ "name": "redirection"
1544
2078
  }
1545
2079
  ]
1546
2080
  },
1547
2081
  {
1548
- "type": "SYMBOL",
1549
- "name": "redirection"
2082
+ "type": "SEQ",
2083
+ "members": [
2084
+ {
2085
+ "type": "SYMBOL",
2086
+ "name": "redirection"
2087
+ },
2088
+ {
2089
+ "type": "CHOICE",
2090
+ "members": [
2091
+ {
2092
+ "type": "SYMBOL",
2093
+ "name": "call_stmt"
2094
+ },
2095
+ {
2096
+ "type": "SYMBOL",
2097
+ "name": "cmd"
2098
+ },
2099
+ {
2100
+ "type": "SYMBOL",
2101
+ "name": "parenthesized"
2102
+ }
2103
+ ]
2104
+ }
2105
+ ]
1550
2106
  }
1551
2107
  ]
1552
2108
  }
@@ -1595,15 +2151,27 @@
1595
2151
  "fd_redirect": {
1596
2152
  "type": "TOKEN",
1597
2153
  "content": {
1598
- "type": "CHOICE",
2154
+ "type": "SEQ",
1599
2155
  "members": [
2156
+ {
2157
+ "type": "CHOICE",
2158
+ "members": [
2159
+ {
2160
+ "type": "PATTERN",
2161
+ "value": "[0-2]"
2162
+ },
2163
+ {
2164
+ "type": "BLANK"
2165
+ }
2166
+ ]
2167
+ },
1600
2168
  {
1601
2169
  "type": "STRING",
1602
- "value": "2>&1"
2170
+ "value": ">&"
1603
2171
  },
1604
2172
  {
1605
- "type": "STRING",
1606
- "value": ">&1"
2173
+ "type": "PATTERN",
2174
+ "value": "[0-9]"
1607
2175
  }
1608
2176
  ]
1609
2177
  }
@@ -1750,6 +2318,38 @@
1750
2318
  {
1751
2319
  "type": "SYMBOL",
1752
2320
  "name": "parenthesized"
2321
+ },
2322
+ {
2323
+ "type": "SYMBOL",
2324
+ "name": "variable_assignment"
2325
+ },
2326
+ {
2327
+ "type": "SYMBOL",
2328
+ "name": "goto_stmt"
2329
+ },
2330
+ {
2331
+ "type": "SYMBOL",
2332
+ "name": "exit_stmt"
2333
+ },
2334
+ {
2335
+ "type": "SYMBOL",
2336
+ "name": "setlocal_stmt"
2337
+ },
2338
+ {
2339
+ "type": "SYMBOL",
2340
+ "name": "endlocal_stmt"
2341
+ },
2342
+ {
2343
+ "type": "SYMBOL",
2344
+ "name": "if_stmt"
2345
+ },
2346
+ {
2347
+ "type": "SYMBOL",
2348
+ "name": "for_stmt"
2349
+ },
2350
+ {
2351
+ "type": "SYMBOL",
2352
+ "name": "macro_invocation"
1753
2353
  }
1754
2354
  ]
1755
2355
  },
@@ -1817,6 +2417,38 @@
1817
2417
  {
1818
2418
  "type": "SYMBOL",
1819
2419
  "name": "parenthesized"
2420
+ },
2421
+ {
2422
+ "type": "SYMBOL",
2423
+ "name": "variable_assignment"
2424
+ },
2425
+ {
2426
+ "type": "SYMBOL",
2427
+ "name": "goto_stmt"
2428
+ },
2429
+ {
2430
+ "type": "SYMBOL",
2431
+ "name": "exit_stmt"
2432
+ },
2433
+ {
2434
+ "type": "SYMBOL",
2435
+ "name": "setlocal_stmt"
2436
+ },
2437
+ {
2438
+ "type": "SYMBOL",
2439
+ "name": "endlocal_stmt"
2440
+ },
2441
+ {
2442
+ "type": "SYMBOL",
2443
+ "name": "if_stmt"
2444
+ },
2445
+ {
2446
+ "type": "SYMBOL",
2447
+ "name": "for_stmt"
2448
+ },
2449
+ {
2450
+ "type": "SYMBOL",
2451
+ "name": "macro_invocation"
1820
2452
  }
1821
2453
  ]
1822
2454
  },
@@ -1890,6 +2522,38 @@
1890
2522
  {
1891
2523
  "type": "SYMBOL",
1892
2524
  "name": "parenthesized"
2525
+ },
2526
+ {
2527
+ "type": "SYMBOL",
2528
+ "name": "variable_assignment"
2529
+ },
2530
+ {
2531
+ "type": "SYMBOL",
2532
+ "name": "goto_stmt"
2533
+ },
2534
+ {
2535
+ "type": "SYMBOL",
2536
+ "name": "exit_stmt"
2537
+ },
2538
+ {
2539
+ "type": "SYMBOL",
2540
+ "name": "setlocal_stmt"
2541
+ },
2542
+ {
2543
+ "type": "SYMBOL",
2544
+ "name": "endlocal_stmt"
2545
+ },
2546
+ {
2547
+ "type": "SYMBOL",
2548
+ "name": "if_stmt"
2549
+ },
2550
+ {
2551
+ "type": "SYMBOL",
2552
+ "name": "for_stmt"
2553
+ },
2554
+ {
2555
+ "type": "SYMBOL",
2556
+ "name": "macro_invocation"
1893
2557
  }
1894
2558
  ]
1895
2559
  },
@@ -1923,6 +2587,42 @@
1923
2587
  {
1924
2588
  "type": "SYMBOL",
1925
2589
  "name": "parenthesized"
2590
+ },
2591
+ {
2592
+ "type": "SYMBOL",
2593
+ "name": "variable_assignment"
2594
+ },
2595
+ {
2596
+ "type": "SYMBOL",
2597
+ "name": "goto_stmt"
2598
+ },
2599
+ {
2600
+ "type": "SYMBOL",
2601
+ "name": "exit_stmt"
2602
+ },
2603
+ {
2604
+ "type": "SYMBOL",
2605
+ "name": "setlocal_stmt"
2606
+ },
2607
+ {
2608
+ "type": "SYMBOL",
2609
+ "name": "endlocal_stmt"
2610
+ },
2611
+ {
2612
+ "type": "SYMBOL",
2613
+ "name": "if_stmt"
2614
+ },
2615
+ {
2616
+ "type": "SYMBOL",
2617
+ "name": "for_stmt"
2618
+ },
2619
+ {
2620
+ "type": "SYMBOL",
2621
+ "name": "macro_invocation"
2622
+ },
2623
+ {
2624
+ "type": "SYMBOL",
2625
+ "name": "comment"
1926
2626
  }
1927
2627
  ]
1928
2628
  }
@@ -1943,7 +2643,7 @@
1943
2643
  },
1944
2644
  {
1945
2645
  "type": "PATTERN",
1946
- "value": "[a-zA-Z_][a-zA-Z0-9_()\\[\\]]*"
2646
+ "value": "[$@a-zA-Z_][$@a-zA-Z0-9_.#()\\[\\]]*"
1947
2647
  },
1948
2648
  {
1949
2649
  "type": "STRING",
@@ -1981,6 +2681,10 @@
1981
2681
  }
1982
2682
  ]
1983
2683
  },
2684
+ {
2685
+ "type": "STRING",
2686
+ "value": "%*"
2687
+ },
1984
2688
  {
1985
2689
  "type": "SEQ",
1986
2690
  "members": [
@@ -2015,7 +2719,7 @@
2015
2719
  },
2016
2720
  {
2017
2721
  "type": "PATTERN",
2018
- "value": "[a-zA-Z_][a-zA-Z0-9_]*"
2722
+ "value": "[$%a-zA-Z_][$a-zA-Z0-9_.#]*"
2019
2723
  },
2020
2724
  {
2021
2725
  "type": "STRING",
@@ -2032,7 +2736,7 @@
2032
2736
  },
2033
2737
  {
2034
2738
  "type": "PATTERN",
2035
- "value": "[a-zA-Z_][a-zA-Z0-9_()\\[\\]]*"
2739
+ "value": "[$@a-zA-Z_][$@a-zA-Z0-9_.#()\\[\\]]*"
2036
2740
  },
2037
2741
  {
2038
2742
  "type": "STRING",
@@ -2040,7 +2744,96 @@
2040
2744
  },
2041
2745
  {
2042
2746
  "type": "PATTERN",
2043
- "value": "[^%]+"
2747
+ "value": "[^%\\r\\n]+"
2748
+ },
2749
+ {
2750
+ "type": "STRING",
2751
+ "value": "%"
2752
+ }
2753
+ ]
2754
+ },
2755
+ {
2756
+ "type": "SEQ",
2757
+ "members": [
2758
+ {
2759
+ "type": "STRING",
2760
+ "value": "%"
2761
+ },
2762
+ {
2763
+ "type": "PATTERN",
2764
+ "value": "[^%=\\s\\r\\n]"
2765
+ },
2766
+ {
2767
+ "type": "STRING",
2768
+ "value": "%"
2769
+ }
2770
+ ]
2771
+ },
2772
+ {
2773
+ "type": "SEQ",
2774
+ "members": [
2775
+ {
2776
+ "type": "STRING",
2777
+ "value": "!"
2778
+ },
2779
+ {
2780
+ "type": "PATTERN",
2781
+ "value": "[%$a-zA-Z_][%$a-zA-Z0-9_.#()\\[\\]]*"
2782
+ },
2783
+ {
2784
+ "type": "PATTERN",
2785
+ "value": ":[^!\\r\\n]+"
2786
+ },
2787
+ {
2788
+ "type": "STRING",
2789
+ "value": "!"
2790
+ }
2791
+ ]
2792
+ },
2793
+ {
2794
+ "type": "SEQ",
2795
+ "members": [
2796
+ {
2797
+ "type": "STRING",
2798
+ "value": "%"
2799
+ },
2800
+ {
2801
+ "type": "PATTERN",
2802
+ "value": "[<>\\/]+[@a-zA-Z_0-9.]*"
2803
+ },
2804
+ {
2805
+ "type": "STRING",
2806
+ "value": "%"
2807
+ }
2808
+ ]
2809
+ },
2810
+ {
2811
+ "type": "SEQ",
2812
+ "members": [
2813
+ {
2814
+ "type": "STRING",
2815
+ "value": "%"
2816
+ },
2817
+ {
2818
+ "type": "PATTERN",
2819
+ "value": "\\\\[@a-zA-Z_0-9.]+"
2820
+ },
2821
+ {
2822
+ "type": "STRING",
2823
+ "value": "%"
2824
+ }
2825
+ ]
2826
+ },
2827
+ {
2828
+ "type": "SEQ",
2829
+ "members": [
2830
+ {
2831
+ "type": "STRING",
2832
+ "value": "%"
2833
+ },
2834
+ {
2835
+ "type": "PATTERN",
2836
+ "value": "\"[^\"%\\r\\n]+\""
2044
2837
  },
2045
2838
  {
2046
2839
  "type": "STRING",
@@ -2071,6 +2864,43 @@
2071
2864
  ]
2072
2865
  }
2073
2866
  },
2867
+ "bracketed_value": {
2868
+ "type": "SEQ",
2869
+ "members": [
2870
+ {
2871
+ "type": "STRING",
2872
+ "value": "["
2873
+ },
2874
+ {
2875
+ "type": "REPEAT",
2876
+ "content": {
2877
+ "type": "CHOICE",
2878
+ "members": [
2879
+ {
2880
+ "type": "SYMBOL",
2881
+ "name": "variable_reference"
2882
+ },
2883
+ {
2884
+ "type": "ALIAS",
2885
+ "content": {
2886
+ "type": "TOKEN",
2887
+ "content": {
2888
+ "type": "PATTERN",
2889
+ "value": "[^%!\\[\\]\\r\\n]+"
2890
+ }
2891
+ },
2892
+ "named": true,
2893
+ "value": "bracketed_literal"
2894
+ }
2895
+ ]
2896
+ }
2897
+ },
2898
+ {
2899
+ "type": "STRING",
2900
+ "value": "]"
2901
+ }
2902
+ ]
2903
+ },
2074
2904
  "cmd": {
2075
2905
  "type": "PREC_RIGHT",
2076
2906
  "value": 5,
@@ -2090,8 +2920,17 @@
2090
2920
  ]
2091
2921
  },
2092
2922
  {
2093
- "type": "SYMBOL",
2094
- "name": "command_name"
2923
+ "type": "CHOICE",
2924
+ "members": [
2925
+ {
2926
+ "type": "SYMBOL",
2927
+ "name": "command_name"
2928
+ },
2929
+ {
2930
+ "type": "SYMBOL",
2931
+ "name": "variable_reference"
2932
+ }
2933
+ ]
2095
2934
  },
2096
2935
  {
2097
2936
  "type": "CHOICE",
@@ -2108,9 +2947,38 @@
2108
2947
  ]
2109
2948
  }
2110
2949
  },
2950
+ "macro_invocation": {
2951
+ "type": "PREC_RIGHT",
2952
+ "value": 6,
2953
+ "content": {
2954
+ "type": "SEQ",
2955
+ "members": [
2956
+ {
2957
+ "type": "SYMBOL",
2958
+ "name": "variable_reference"
2959
+ },
2960
+ {
2961
+ "type": "SYMBOL",
2962
+ "name": "parenthesized"
2963
+ },
2964
+ {
2965
+ "type": "CHOICE",
2966
+ "members": [
2967
+ {
2968
+ "type": "SYMBOL",
2969
+ "name": "else_clause"
2970
+ },
2971
+ {
2972
+ "type": "BLANK"
2973
+ }
2974
+ ]
2975
+ }
2976
+ ]
2977
+ }
2978
+ },
2111
2979
  "command_name": {
2112
2980
  "type": "PATTERN",
2113
- "value": "[a-zA-Z_][a-zA-Z0-9_.-]*"
2981
+ "value": "[$a-zA-Z_][$a-zA-Z0-9_.#-]*"
2114
2982
  },
2115
2983
  "argument_list": {
2116
2984
  "type": "PREC_RIGHT",
@@ -2199,7 +3067,12 @@
2199
3067
  "value": "[ \\t]"
2200
3068
  }
2201
3069
  ],
2202
- "conflicts": [],
3070
+ "conflicts": [
3071
+ [
3072
+ "parenthesized",
3073
+ "paren_expression"
3074
+ ]
3075
+ ],
2203
3076
  "precedences": [],
2204
3077
  "externals": [],
2205
3078
  "inline": [],