@willbooster/tree-sitter-c 5.0.4 → 5.0.6

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
@@ -1146,7 +1146,10 @@ module.exports = Object.assign(
1146
1146
  2,
1147
1147
  prec(
1148
1148
  PREC.SIZEOF,
1149
- seq('sizeof', choice(field('value', $.expression), seq('(', field('type', $.type_descriptor), ')')))
1149
+ seq(
1150
+ 'sizeof',
1151
+ choice(field('value', prec.dynamic(3, $.expression)), seq('(', field('type', $.type_descriptor), ')'))
1152
+ )
1150
1153
  )
1151
1154
  ),
1152
1155
 
@@ -1370,7 +1373,9 @@ module.exports = Object.assign(
1370
1373
  char_literal: ($) =>
1371
1374
  seq(
1372
1375
  choice("L'", "u'", "U'", "u8'", "'"),
1373
- repeat1(choice($.escape_sequence, alias(token.immediate(/[^\n']/), sym('character')))),
1376
+ repeat1(
1377
+ choice($.escape_sequence, $.invalid_escape_sequence, alias(token.immediate(/[^\\\n']/), sym('character')))
1378
+ ),
1374
1379
  "'"
1375
1380
  ),
1376
1381
 
@@ -1390,7 +1395,13 @@ module.exports = Object.assign(
1390
1395
  string_literal: ($) =>
1391
1396
  seq(
1392
1397
  choice('L"', 'u"', 'U"', 'u8"', '"'),
1393
- repeat(choice(alias(token.immediate(prec(1, /[^\\"\n]+/)), sym('string_content')), $.escape_sequence)),
1398
+ repeat(
1399
+ choice(
1400
+ alias(token.immediate(prec(1, /[^\\"\n]+/)), sym('string_content')),
1401
+ $.escape_sequence,
1402
+ $.invalid_escape_sequence
1403
+ )
1404
+ ),
1394
1405
  '"'
1395
1406
  ),
1396
1407
 
@@ -1401,12 +1412,17 @@ module.exports = Object.assign(
1401
1412
  seq(
1402
1413
  '\\',
1403
1414
  choice(
1404
- /[^xuU]/,
1415
+ /['"?\\abefnrtvE]/,
1416
+ '(',
1417
+ '[',
1418
+ '{',
1419
+ '%',
1420
+ /\r\n?|\n\r?/,
1405
1421
  /[xu]\{[0-9a-fA-F]+\}/,
1406
1422
  /o\{[0-7]+\}/,
1407
1423
  /N\{[^}\n]+\}/,
1408
- /\d{2,3}/,
1409
- /x[0-9a-fA-F]{1,4}/,
1424
+ /[0-7]{1,3}/,
1425
+ /x[0-9a-fA-F]+/,
1410
1426
  /u[0-9a-fA-F]{4}/,
1411
1427
  /U[0-9a-fA-F]{8}/
1412
1428
  )
@@ -1414,6 +1430,8 @@ module.exports = Object.assign(
1414
1430
  )
1415
1431
  ),
1416
1432
 
1433
+ invalid_escape_sequence: () => token(seq('\\', choice(/[^\r\n]/, /u[0-9a-fA-F]{1,3}/, /U[0-9a-fA-F]{1,7}/))),
1434
+
1417
1435
  system_lib_string: () => token(seq('<', repeat(choice(/[^>\n]/, String.raw`\>`)), '>')),
1418
1436
 
1419
1437
  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.6",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -50,19 +50,19 @@
50
50
  "@vitest/browser-playwright": "5.0.3",
51
51
  "@willbooster/oxfmt-config": "1.2.2",
52
52
  "@willbooster/oxlint-config": "1.4.8",
53
- "@willbooster/wb": "22.24.0",
54
- "@willbooster/web-tree-sitter": "2.0.1",
55
- "conventional-changelog-conventionalcommits": "10.4.0",
56
- "lefthook": "2.1.16",
57
- "oxfmt": "0.71.0",
58
- "oxlint": "1.86.0",
59
- "oxlint-tsgolint": "7.0.2003",
60
- "playwright": "1.63.0",
53
+ "@willbooster/wb": "22.26.1",
54
+ "@willbooster/web-tree-sitter": "2.0.25",
55
+ "conventional-changelog-conventionalcommits": "10.4.1",
56
+ "lefthook": "2.2.1",
57
+ "oxfmt": "0.72.0",
58
+ "oxlint": "1.87.0",
59
+ "oxlint-tsgolint": "7.0.2004",
60
+ "playwright": "1.64.0",
61
61
  "semantic-release": "25.0.9",
62
62
  "sort-package-json": "4.0.0",
63
63
  "typescript": "7.0.2",
64
64
  "vitest": "5.0.3",
65
- "wrangler": "4.147.0"
65
+ "wrangler": "4.149.0"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@willbooster/web-tree-sitter": "^2.0.0"
@@ -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.6",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [