@willbooster/tree-sitter-c 5.0.4 → 5.0.5

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
@@ -1370,7 +1370,9 @@ module.exports = Object.assign(
1370
1370
  char_literal: ($) =>
1371
1371
  seq(
1372
1372
  choice("L'", "u'", "U'", "u8'", "'"),
1373
- repeat1(choice($.escape_sequence, alias(token.immediate(/[^\n']/), sym('character')))),
1373
+ repeat1(
1374
+ choice($.escape_sequence, $.invalid_escape_sequence, alias(token.immediate(/[^\\\n']/), sym('character')))
1375
+ ),
1374
1376
  "'"
1375
1377
  ),
1376
1378
 
@@ -1390,7 +1392,13 @@ module.exports = Object.assign(
1390
1392
  string_literal: ($) =>
1391
1393
  seq(
1392
1394
  choice('L"', 'u"', 'U"', 'u8"', '"'),
1393
- repeat(choice(alias(token.immediate(prec(1, /[^\\"\n]+/)), sym('string_content')), $.escape_sequence)),
1395
+ repeat(
1396
+ choice(
1397
+ alias(token.immediate(prec(1, /[^\\"\n]+/)), sym('string_content')),
1398
+ $.escape_sequence,
1399
+ $.invalid_escape_sequence
1400
+ )
1401
+ ),
1394
1402
  '"'
1395
1403
  ),
1396
1404
 
@@ -1401,12 +1409,17 @@ module.exports = Object.assign(
1401
1409
  seq(
1402
1410
  '\\',
1403
1411
  choice(
1404
- /[^xuU]/,
1412
+ /['"?\\abefnrtvE]/,
1413
+ '(',
1414
+ '[',
1415
+ '{',
1416
+ '%',
1417
+ /\r\n?|\n\r?/,
1405
1418
  /[xu]\{[0-9a-fA-F]+\}/,
1406
1419
  /o\{[0-7]+\}/,
1407
1420
  /N\{[^}\n]+\}/,
1408
- /\d{2,3}/,
1409
- /x[0-9a-fA-F]{1,4}/,
1421
+ /[0-7]{1,3}/,
1422
+ /x[0-9a-fA-F]+/,
1410
1423
  /u[0-9a-fA-F]{4}/,
1411
1424
  /U[0-9a-fA-F]{8}/
1412
1425
  )
@@ -1414,6 +1427,8 @@ module.exports = Object.assign(
1414
1427
  )
1415
1428
  ),
1416
1429
 
1430
+ invalid_escape_sequence: () => token(seq('\\', choice(/[^\r\n]/, /u[0-9a-fA-F]{1,3}/, /U[0-9a-fA-F]{1,7}/))),
1431
+
1417
1432
  system_lib_string: () => token(seq('<', repeat(choice(/[^>\n]/, String.raw`\>`)), '>')),
1418
1433
 
1419
1434
  true: () => token(choice('TRUE', 'true')),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -1087,6 +1087,10 @@
1087
1087
  {
1088
1088
  "type": "escape_sequence",
1089
1089
  "named": true
1090
+ },
1091
+ {
1092
+ "type": "invalid_escape_sequence",
1093
+ "named": true
1090
1094
  }
1091
1095
  ]
1092
1096
  }
@@ -3714,6 +3718,10 @@
3714
3718
  "type": "escape_sequence",
3715
3719
  "named": true
3716
3720
  },
3721
+ {
3722
+ "type": "invalid_escape_sequence",
3723
+ "named": true
3724
+ },
3717
3725
  {
3718
3726
  "type": "string_content",
3719
3727
  "named": true
@@ -4838,6 +4846,10 @@
4838
4846
  "type": "inline",
4839
4847
  "named": false
4840
4848
  },
4849
+ {
4850
+ "type": "invalid_escape_sequence",
4851
+ "named": true
4852
+ },
4841
4853
  {
4842
4854
  "type": "long",
4843
4855
  "named": false
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "5.0.4",
19
+ "version": "5.0.5",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [