tree-sitter-clojure-orchard 0.2.5 → 0.2.8

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/README.md CHANGED
@@ -2,13 +2,30 @@
2
2
 
3
3
  [![crates][crates]](https://crates.io/crates/tree-sitter-clojure-orchard)
4
4
  [![pypi][pypi]](https://pypi.org/project/tree-sitter-clojure-orchard)
5
+ [![npm][npm]](https://www.npmjs.com/package/tree-sitter-clojure-orchard)
5
6
 
6
- This is a fork of the [tree-sitter-clojure](https://github.com/sogaiu/tree-sitter-clojure) grammar.
7
+ This is a tree-sitter grammar for Clojure.
7
8
 
8
- Note that unlike upstream, generated files are not checked into git, so you need to run `tree-sitter generate` after cloning this repository.
9
- Generated files are also available in the archives found in releases.
9
+ ### Using it
10
+
11
+ You can obtain this parser in various formats:
12
+ * as an archive from [the Releases page](/grammar-orchard/tree-sitter-clojure-orchard/releases), which contains all the generated files (bindings, parser code)
13
+ * as a Rust crate: `cargo add tree-sitter-clojure-orchard`
14
+ * as a Python package: `pip install tree-sitter-clojure-orchard`
15
+ * as an NPM package: `npm install tree-sitter-clojure-orchard`
16
+
17
+ ### Contributing
10
18
 
11
19
  Contributions are welcome, so are co-maintainers.
12
20
 
13
- [crates]: https://img.shields.io/crates/v/tree-sitter-clojure-orchard?logo=clojure
21
+ Unlike many grammar repositories, this one does not track generated files.
22
+ After cloning this repository, you'll need to run `tree-sitter generate` to obtain the parser.
23
+ If you want to use it via bindings, you'll also need to run `tree-sitter init`.
24
+
25
+ ### Origin
26
+
27
+ This project was forked from https://github.com/sogaiu/tree-sitter-clojure, to [ease the use and collaboration](https://codeberg.org/grammar-orchard) on this grammar
28
+
29
+ [crates]: https://img.shields.io/crates/v/tree-sitter-clojure-orchard?logo=rust
14
30
  [pypi]: https://img.shields.io/pypi/v/tree-sitter-clojure-orchard?logo=pypi&logoColor=ffd242
31
+ [npm]: https://img.shields.io/npm/v/tree-sitter-clojure-orchard?logo=npm
@@ -1,9 +1,11 @@
1
- const assert = require("node:assert");
2
- const { test } = require("node:test");
3
-
4
- const Parser = require("tree-sitter");
1
+ import assert from "node:assert";
2
+ import { test } from "node:test";
3
+ import Parser from "tree-sitter";
5
4
 
6
5
  test("can load grammar", () => {
7
6
  const parser = new Parser();
8
- assert.doesNotThrow(() => parser.setLanguage(require(".")));
7
+ assert.doesNotReject(async () => {
8
+ const { default: language } = await import("./index.js");
9
+ parser.setLanguage(language);
10
+ });
9
11
  });
@@ -18,10 +18,43 @@ type NodeInfo =
18
18
  children: ChildNode[];
19
19
  });
20
20
 
21
- type Language = {
21
+ /**
22
+ * The tree-sitter language object for this grammar.
23
+ *
24
+ * @see {@linkcode https://tree-sitter.github.io/node-tree-sitter/interfaces/Parser.Language.html Parser.Language}
25
+ *
26
+ * @example
27
+ * import Parser from "tree-sitter";
28
+ * import ClojureOrchard from "tree-sitter-clojure-orchard";
29
+ *
30
+ * const parser = new Parser();
31
+ * parser.setLanguage(ClojureOrchard);
32
+ */
33
+ declare const binding: {
34
+ /**
35
+ * The inner language object.
36
+ * @private
37
+ */
22
38
  language: unknown;
39
+
40
+ /**
41
+ * The content of the `node-types.json` file for this grammar.
42
+ *
43
+ * @see {@linkplain https://tree-sitter.github.io/tree-sitter/using-parsers/6-static-node-types Static Node Types}
44
+ */
23
45
  nodeTypeInfo: NodeInfo[];
46
+
47
+ /** The syntax highlighting query for this grammar. */
48
+ HIGHLIGHTS_QUERY?: string;
49
+
50
+ /** The language injection query for this grammar. */
51
+ INJECTIONS_QUERY?: string;
52
+
53
+ /** The local variable query for this grammar. */
54
+ LOCALS_QUERY?: string;
55
+
56
+ /** The symbol tagging query for this grammar. */
57
+ TAGS_QUERY?: string;
24
58
  };
25
59
 
26
- declare const language: Language;
27
- export = language;
60
+ export default binding;
@@ -1,11 +1,37 @@
1
- const root = require("path").join(__dirname, "..", "..");
1
+ import { readFileSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
2
3
 
3
- module.exports =
4
- typeof process.versions.bun === "string"
5
- // Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time
6
- ? require(`../../prebuilds/${process.platform}-${process.arch}/tree-sitter-clojure-orchard.node`)
7
- : require("node-gyp-build")(root);
4
+ const root = fileURLToPath(new URL("../..", import.meta.url));
5
+
6
+ const binding = typeof process.versions.bun === "string"
7
+ // Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time
8
+ ? await import(`${root}/prebuilds/${process.platform}-${process.arch}/tree-sitter-clojure-orchard.node`)
9
+ : (await import("node-gyp-build")).default(root);
8
10
 
9
11
  try {
10
- module.exports.nodeTypeInfo = require("../../src/node-types.json");
11
- } catch (_) {}
12
+ const nodeTypes = await import(`${root}/src/node-types.json`, { with: { type: "json" } });
13
+ binding.nodeTypeInfo = nodeTypes.default;
14
+ } catch { }
15
+
16
+ const queries = [
17
+ ["HIGHLIGHTS_QUERY", `${root}/queries/highlights.scm`],
18
+ ["INJECTIONS_QUERY", `${root}/queries/injections.scm`],
19
+ ["LOCALS_QUERY", `${root}/queries/locals.scm`],
20
+ ["TAGS_QUERY", `${root}/queries/tags.scm`],
21
+ ];
22
+
23
+ for (const [prop, path] of queries) {
24
+ Object.defineProperty(binding, prop, {
25
+ configurable: true,
26
+ enumerable: true,
27
+ get() {
28
+ delete binding[prop];
29
+ try {
30
+ binding[prop] = readFileSync(path, "utf8");
31
+ } catch { }
32
+ return binding[prop];
33
+ }
34
+ });
35
+ }
36
+
37
+ export default binding;
package/grammar.js CHANGED
@@ -227,7 +227,7 @@ const SYMBOL =
227
227
  token(seq(SYMBOL_HEAD,
228
228
  repeat(SYMBOL_BODY)));
229
229
 
230
- module.exports = grammar({
230
+ export default grammar({
231
231
  name: 'clojure_orchard',
232
232
 
233
233
  extras: $ =>
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "tree-sitter-clojure-orchard",
3
- "version": "0.2.5",
3
+ "version": "0.2.8",
4
4
  "description": "Parser for Clojure files",
5
- "repository": "https://codeberg.org/grammar-orchard/tree-sitter-clojure-orchard",
6
- "license": "CC0",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://codeberg.org/grammar-orchard/tree-sitter-clojure-orchard.git"
9
+ },
10
+ "license": "CC0-1.0",
7
11
  "author": {
8
12
  "name": "sogaiu"
9
13
  },
@@ -32,7 +36,7 @@
32
36
  "devDependencies": {
33
37
  "prebuildify": "^6.0.1",
34
38
  "tree-sitter": "^0.25.0",
35
- "tree-sitter-cli": "^0.25.10"
39
+ "tree-sitter-cli": "^0.26.11"
36
40
  },
37
41
  "peerDependencies": {
38
42
  "tree-sitter": "^0.25.0"
package/src/parser.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Automatically @generated by tree-sitter v0.25.5 */
1
+ /* Automatically @generated by tree-sitter */
2
2
 
3
3
  #include "tree_sitter/parser.h"
4
4
 
@@ -1334,26 +1334,26 @@ static const TSCharacterRange sym__ws_character_set_1[] = {
1334
1334
 
1335
1335
  static const TSCharacterRange aux_sym__kwd_leading_slash_token1_character_set_1[] = {
1336
1336
  {0, 0x08}, {0x0e, 0x1b}, {'!', '!'}, {'#', '\''}, {'*', '+'}, {'-', ':'}, {'<', '?'}, {'A', 'Z'},
1337
- {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027}, {0x202a, 0x205e},
1338
- {0x2060, 0x2fff}, {0x3001, 0x10ffff},
1337
+ {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x17e}, {0x180, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027},
1338
+ {0x202a, 0x205e}, {0x2060, 0x2129}, {0x212b, 0x2fff}, {0x3001, 0x10ffff},
1339
1339
  };
1340
1340
 
1341
1341
  static const TSCharacterRange aux_sym__kwd_qualified_token1_character_set_1[] = {
1342
1342
  {0, 0x08}, {0x0e, 0x1b}, {'!', '!'}, {'#', '\''}, {'*', '+'}, {'-', '.'}, {'0', '9'}, {'<', '?'},
1343
- {'A', 'Z'}, {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027},
1344
- {0x202a, 0x205e}, {0x2060, 0x2fff}, {0x3001, 0x10ffff},
1343
+ {'A', 'Z'}, {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x17e}, {0x180, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007},
1344
+ {0x200b, 0x2027}, {0x202a, 0x205e}, {0x2060, 0x2129}, {0x212b, 0x2fff}, {0x3001, 0x10ffff},
1345
1345
  };
1346
1346
 
1347
1347
  static const TSCharacterRange aux_sym__kwd_qualified_token1_character_set_2[] = {
1348
1348
  {0, 0x08}, {0x0e, 0x1b}, {'!', '!'}, {'#', '\''}, {'*', '+'}, {'-', '.'}, {'0', ':'}, {'<', '?'},
1349
- {'A', 'Z'}, {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027},
1350
- {0x202a, 0x205e}, {0x2060, 0x2fff}, {0x3001, 0x10ffff},
1349
+ {'A', 'Z'}, {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x17e}, {0x180, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007},
1350
+ {0x200b, 0x2027}, {0x202a, 0x205e}, {0x2060, 0x2129}, {0x212b, 0x2fff}, {0x3001, 0x10ffff},
1351
1351
  };
1352
1352
 
1353
1353
  static const TSCharacterRange aux_sym__sym_qualified_token1_character_set_1[] = {
1354
1354
  {0, 0x08}, {0x0e, 0x1b}, {'!', '!'}, {'$', '&'}, {'*', '+'}, {'-', '.'}, {'<', '?'}, {'A', 'Z'},
1355
- {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027}, {0x202a, 0x205e},
1356
- {0x2060, 0x2fff}, {0x3001, 0x10ffff},
1355
+ {'_', '_'}, {'a', 'z'}, {'|', '|'}, {0x7f, 0x17e}, {0x180, 0x167f}, {0x1681, 0x1fff}, {0x2007, 0x2007}, {0x200b, 0x2027},
1356
+ {0x202a, 0x205e}, {0x2060, 0x2129}, {0x212b, 0x2fff}, {0x3001, 0x10ffff},
1357
1357
  };
1358
1358
 
1359
1359
  static bool ts_lex(TSLexer *lexer, TSStateId state) {
@@ -1389,7 +1389,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1389
1389
  );
1390
1390
  if (('1' <= lookahead && lookahead <= '9')) ADVANCE(57);
1391
1391
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1392
- if (lookahead != 0) ADVANCE(93);
1392
+ if (lookahead != 0 &&
1393
+ lookahead != 0x17f &&
1394
+ lookahead != 0x212a) ADVANCE(93);
1393
1395
  END_STATE();
1394
1396
  case 1:
1395
1397
  ADVANCE_MAP(
@@ -1413,12 +1415,16 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1413
1415
  (lookahead < '/' || ';' < lookahead) &&
1414
1416
  (lookahead < '[' || '^' < lookahead) &&
1415
1417
  lookahead != '}' &&
1416
- lookahead != '~') ADVANCE(134);
1418
+ lookahead != '~' &&
1419
+ lookahead != 0x17f &&
1420
+ lookahead != 0x212a) ADVANCE(134);
1417
1421
  END_STATE();
1418
1422
  case 2:
1419
1423
  if (lookahead == '"') ADVANCE(106);
1420
1424
  if (lookahead == '\\') ADVANCE(43);
1421
- if (lookahead != 0) ADVANCE(2);
1425
+ if (lookahead != 0 &&
1426
+ lookahead != 0x17f &&
1427
+ lookahead != 0x212a) ADVANCE(2);
1422
1428
  END_STATE();
1423
1429
  case 3:
1424
1430
  ADVANCE_MAP(
@@ -1433,7 +1439,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1433
1439
  '{', 140,
1434
1440
  '~', 164,
1435
1441
  );
1436
- if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 18, lookahead))) ADVANCE(134);
1442
+ if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 20, lookahead))) ADVANCE(134);
1437
1443
  END_STATE();
1438
1444
  case 4:
1439
1445
  ADVANCE_MAP(
@@ -1457,7 +1463,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1457
1463
  (lookahead < '\'' || ')' < lookahead) &&
1458
1464
  (lookahead < '[' || '^' < lookahead) &&
1459
1465
  lookahead != '}' &&
1460
- lookahead != '~') ADVANCE(93);
1466
+ lookahead != '~' &&
1467
+ lookahead != 0x17f &&
1468
+ lookahead != 0x212a) ADVANCE(93);
1461
1469
  END_STATE();
1462
1470
  case 5:
1463
1471
  if (lookahead == '#') ADVANCE(77);
@@ -1468,7 +1476,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1468
1476
  if (lookahead == '\'' ||
1469
1477
  ('0' <= lookahead && lookahead <= ':')) ADVANCE(99);
1470
1478
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1471
- if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 18, lookahead))) ADVANCE(93);
1479
+ if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 20, lookahead))) ADVANCE(93);
1472
1480
  END_STATE();
1473
1481
  case 6:
1474
1482
  if (lookahead == '#') ADVANCE(78);
@@ -1478,7 +1486,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1478
1486
  if (lookahead == '\'' ||
1479
1487
  ('0' <= lookahead && lookahead <= ':')) ADVANCE(99);
1480
1488
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1481
- if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 18, lookahead))) ADVANCE(93);
1489
+ if ((!eof && set_contains(aux_sym__sym_qualified_token1_character_set_1, 20, lookahead))) ADVANCE(93);
1482
1490
  END_STATE();
1483
1491
  case 7:
1484
1492
  if (lookahead == '#') ADVANCE(100);
@@ -1486,27 +1494,18 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1486
1494
  if (lookahead == ';') ADVANCE(50);
1487
1495
  if (lookahead == '{') ADVANCE(140);
1488
1496
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1489
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_1, 19, lookahead))) ADVANCE(101);
1497
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_1, 21, lookahead))) ADVANCE(101);
1490
1498
  END_STATE();
1491
1499
  case 8:
1492
1500
  if (lookahead == '#') ADVANCE(79);
1493
1501
  if (lookahead == ';') ADVANCE(50);
1494
1502
  if (lookahead == '{') ADVANCE(140);
1495
1503
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1496
- if (lookahead != 0 &&
1497
- lookahead != '"' &&
1498
- lookahead != '#' &&
1499
- lookahead != '(' &&
1500
- lookahead != ')' &&
1501
- lookahead != '@' &&
1502
- (lookahead < '[' || '^' < lookahead) &&
1503
- lookahead != '`' &&
1504
- lookahead != '}' &&
1505
- lookahead != '~') ADVANCE(99);
1504
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1506
1505
  END_STATE();
1507
1506
  case 9:
1508
1507
  if (lookahead == '/') ADVANCE(75);
1509
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_1, 19, lookahead))) ADVANCE(101);
1508
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_1, 21, lookahead))) ADVANCE(101);
1510
1509
  END_STATE();
1511
1510
  case 10:
1512
1511
  if (lookahead == 'a') ADVANCE(14);
@@ -1522,7 +1521,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1522
1521
  't', 109,
1523
1522
  'u', 117,
1524
1523
  );
1525
- if (lookahead != 0) ADVANCE(107);
1524
+ if (lookahead != 0 &&
1525
+ lookahead != 0x17f &&
1526
+ lookahead != 0x212a) ADVANCE(107);
1526
1527
  END_STATE();
1527
1528
  case 12:
1528
1529
  if (lookahead == 'b') ADVANCE(107);
@@ -1624,14 +1625,16 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1624
1625
  ('a' <= lookahead && lookahead <= 'z')) ADVANCE(74);
1625
1626
  END_STATE();
1626
1627
  case 41:
1627
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
1628
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1628
1629
  END_STATE();
1629
1630
  case 42:
1630
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(135);
1631
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(135);
1631
1632
  END_STATE();
1632
1633
  case 43:
1633
1634
  if (lookahead != 0 &&
1634
- lookahead != '\n') ADVANCE(2);
1635
+ lookahead != '\n' &&
1636
+ lookahead != 0x17f &&
1637
+ lookahead != 0x212a) ADVANCE(2);
1635
1638
  END_STATE();
1636
1639
  case 44:
1637
1640
  if (eof) ADVANCE(45);
@@ -1662,7 +1665,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1662
1665
  );
1663
1666
  if (('1' <= lookahead && lookahead <= '9')) ADVANCE(63);
1664
1667
  if (set_contains(sym__ws_character_set_1, 9, lookahead)) ADVANCE(46);
1665
- if (lookahead != 0) ADVANCE(134);
1668
+ if (lookahead != 0 &&
1669
+ lookahead != 0x17f &&
1670
+ lookahead != 0x212a) ADVANCE(134);
1666
1671
  END_STATE();
1667
1672
  case 45:
1668
1673
  ACCEPT_TOKEN(ts_builtin_sym_end);
@@ -1688,7 +1693,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1688
1693
  lookahead == '{' ||
1689
1694
  lookahead == '}' ||
1690
1695
  lookahead == '~') ADVANCE(50);
1691
- if (lookahead != 0) ADVANCE(48);
1696
+ if (lookahead != 0 &&
1697
+ lookahead != 0x17f &&
1698
+ lookahead != 0x212a) ADVANCE(48);
1692
1699
  END_STATE();
1693
1700
  case 49:
1694
1701
  ACCEPT_TOKEN(sym_comment);
@@ -1705,23 +1712,27 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1705
1712
  lookahead == '{' ||
1706
1713
  lookahead == '}' ||
1707
1714
  lookahead == '~') ADVANCE(50);
1708
- if (lookahead != 0) ADVANCE(49);
1715
+ if (lookahead != 0 &&
1716
+ lookahead != 0x17f &&
1717
+ lookahead != 0x212a) ADVANCE(49);
1709
1718
  END_STATE();
1710
1719
  case 50:
1711
1720
  ACCEPT_TOKEN(sym_comment);
1712
1721
  if (lookahead == '\n') ADVANCE(47);
1713
- if (lookahead != 0) ADVANCE(50);
1722
+ if (lookahead != 0 &&
1723
+ lookahead != 0x17f &&
1724
+ lookahead != 0x212a) ADVANCE(50);
1714
1725
  END_STATE();
1715
1726
  case 51:
1716
1727
  ACCEPT_TOKEN(anon_sym_POUND_);
1717
1728
  END_STATE();
1718
1729
  case 52:
1719
1730
  ACCEPT_TOKEN(anon_sym_POUND_);
1720
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(101);
1731
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(101);
1721
1732
  END_STATE();
1722
1733
  case 53:
1723
1734
  ACCEPT_TOKEN(anon_sym_POUND_);
1724
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
1735
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1725
1736
  END_STATE();
1726
1737
  case 54:
1727
1738
  ACCEPT_TOKEN(sym_num_lit);
@@ -1965,7 +1976,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1965
1976
  END_STATE();
1966
1977
  case 76:
1967
1978
  ACCEPT_TOKEN(anon_sym_SLASH);
1968
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
1979
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1969
1980
  END_STATE();
1970
1981
  case 77:
1971
1982
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
@@ -1973,75 +1984,75 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
1973
1984
  if (lookahead == '?') ADVANCE(151);
1974
1985
  if (lookahead == '^') ADVANCE(137);
1975
1986
  if (lookahead == '_') ADVANCE(53);
1976
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
1987
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1977
1988
  END_STATE();
1978
1989
  case 78:
1979
1990
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
1980
1991
  if (lookahead == '!') ADVANCE(48);
1981
1992
  if (lookahead == '^') ADVANCE(137);
1982
1993
  if (lookahead == '_') ADVANCE(53);
1983
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
1994
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1984
1995
  END_STATE();
1985
1996
  case 79:
1986
1997
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
1987
1998
  if (lookahead == '!') ADVANCE(48);
1988
1999
  if (lookahead == '_') ADVANCE(53);
1989
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2000
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
1990
2001
  END_STATE();
1991
2002
  case 80:
1992
2003
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
1993
2004
  if (lookahead == '/') ADVANCE(99);
1994
2005
  if (lookahead == '0') ADVANCE(58);
1995
2006
  if (('1' <= lookahead && lookahead <= '9')) ADVANCE(60);
1996
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2007
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
1997
2008
  END_STATE();
1998
2009
  case 81:
1999
2010
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2000
2011
  if (lookahead == '/') ADVANCE(99);
2001
2012
  if (lookahead == 'a') ADVANCE(84);
2002
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2013
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2003
2014
  END_STATE();
2004
2015
  case 82:
2005
2016
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2006
2017
  if (lookahead == '/') ADVANCE(99);
2007
2018
  if (lookahead == 'e') ADVANCE(93);
2008
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2019
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2009
2020
  END_STATE();
2010
2021
  case 83:
2011
2022
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2012
2023
  if (lookahead == '/') ADVANCE(99);
2013
2024
  if (lookahead == 'i') ADVANCE(85);
2014
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2025
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2015
2026
  END_STATE();
2016
2027
  case 84:
2017
2028
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2018
2029
  if (lookahead == '/') ADVANCE(99);
2019
2030
  if (lookahead == 'l') ADVANCE(87);
2020
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2031
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2021
2032
  END_STATE();
2022
2033
  case 85:
2023
2034
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2024
2035
  if (lookahead == '/') ADVANCE(99);
2025
2036
  if (lookahead == 'l') ADVANCE(118);
2026
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2037
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2027
2038
  END_STATE();
2028
2039
  case 86:
2029
2040
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2030
2041
  if (lookahead == '/') ADVANCE(99);
2031
2042
  if (lookahead == 'r') ADVANCE(88);
2032
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2043
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2033
2044
  END_STATE();
2034
2045
  case 87:
2035
2046
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2036
2047
  if (lookahead == '/') ADVANCE(99);
2037
2048
  if (lookahead == 's') ADVANCE(82);
2038
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2049
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2039
2050
  END_STATE();
2040
2051
  case 88:
2041
2052
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2042
2053
  if (lookahead == '/') ADVANCE(99);
2043
2054
  if (lookahead == 'u') ADVANCE(82);
2044
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2055
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2045
2056
  END_STATE();
2046
2057
  case 89:
2047
2058
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
@@ -2049,13 +2060,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2049
2060
  if (lookahead == '+' ||
2050
2061
  lookahead == '-') ADVANCE(90);
2051
2062
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2052
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2063
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2053
2064
  END_STATE();
2054
2065
  case 90:
2055
2066
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2056
2067
  if (lookahead == '/') ADVANCE(99);
2057
2068
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2058
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2069
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2059
2070
  END_STATE();
2060
2071
  case 91:
2061
2072
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
@@ -2063,7 +2074,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2063
2074
  if (('0' <= lookahead && lookahead <= '9') ||
2064
2075
  ('A' <= lookahead && lookahead <= 'F') ||
2065
2076
  ('a' <= lookahead && lookahead <= 'f')) ADVANCE(72);
2066
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2077
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2067
2078
  END_STATE();
2068
2079
  case 92:
2069
2080
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
@@ -2071,62 +2082,62 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2071
2082
  if (('0' <= lookahead && lookahead <= '9') ||
2072
2083
  ('A' <= lookahead && lookahead <= 'Z') ||
2073
2084
  ('a' <= lookahead && lookahead <= 'z')) ADVANCE(74);
2074
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2085
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2075
2086
  END_STATE();
2076
2087
  case 93:
2077
2088
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2078
2089
  if (lookahead == '/') ADVANCE(99);
2079
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2090
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2080
2091
  END_STATE();
2081
2092
  case 94:
2082
2093
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2083
2094
  if (lookahead == '+' ||
2084
2095
  lookahead == '-') ADVANCE(96);
2085
2096
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2086
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2097
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2087
2098
  END_STATE();
2088
2099
  case 95:
2089
2100
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2090
2101
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(73);
2091
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2102
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2092
2103
  END_STATE();
2093
2104
  case 96:
2094
2105
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2095
2106
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2096
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2107
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2097
2108
  END_STATE();
2098
2109
  case 97:
2099
2110
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2100
2111
  if (('0' <= lookahead && lookahead <= '9') ||
2101
2112
  ('A' <= lookahead && lookahead <= 'F') ||
2102
2113
  ('a' <= lookahead && lookahead <= 'f')) ADVANCE(72);
2103
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2114
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2104
2115
  END_STATE();
2105
2116
  case 98:
2106
2117
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2107
2118
  if (('0' <= lookahead && lookahead <= '9') ||
2108
2119
  ('A' <= lookahead && lookahead <= 'Z') ||
2109
2120
  ('a' <= lookahead && lookahead <= 'z')) ADVANCE(74);
2110
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2121
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2111
2122
  END_STATE();
2112
2123
  case 99:
2113
2124
  ACCEPT_TOKEN(aux_sym__kwd_leading_slash_token1);
2114
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2125
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2115
2126
  END_STATE();
2116
2127
  case 100:
2117
2128
  ACCEPT_TOKEN(aux_sym__kwd_qualified_token1);
2118
2129
  if (lookahead == '!') ADVANCE(49);
2119
2130
  if (lookahead == '_') ADVANCE(52);
2120
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(101);
2131
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(101);
2121
2132
  END_STATE();
2122
2133
  case 101:
2123
2134
  ACCEPT_TOKEN(aux_sym__kwd_qualified_token1);
2124
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(101);
2135
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(101);
2125
2136
  END_STATE();
2126
2137
  case 102:
2127
2138
  ACCEPT_TOKEN(anon_sym_COLON);
2128
2139
  if (lookahead == ':') ADVANCE(105);
2129
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2140
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2130
2141
  END_STATE();
2131
2142
  case 103:
2132
2143
  ACCEPT_TOKEN(anon_sym_COLON);
@@ -2137,7 +2148,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2137
2148
  END_STATE();
2138
2149
  case 105:
2139
2150
  ACCEPT_TOKEN(anon_sym_COLON_COLON);
2140
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2151
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2141
2152
  END_STATE();
2142
2153
  case 106:
2143
2154
  ACCEPT_TOKEN(aux_sym_str_lit_token1);
@@ -2190,95 +2201,95 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2190
2201
  case 118:
2191
2202
  ACCEPT_TOKEN(sym_nil_lit);
2192
2203
  if (lookahead == '/') ADVANCE(99);
2193
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(93);
2204
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(93);
2194
2205
  END_STATE();
2195
2206
  case 119:
2196
2207
  ACCEPT_TOKEN(sym_nil_lit);
2197
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2208
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2198
2209
  END_STATE();
2199
2210
  case 120:
2200
2211
  ACCEPT_TOKEN(sym_bool_lit);
2201
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2212
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2202
2213
  END_STATE();
2203
2214
  case 121:
2204
2215
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2205
2216
  if (lookahead == '0') ADVANCE(64);
2206
2217
  if (('1' <= lookahead && lookahead <= '9')) ADVANCE(66);
2207
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2218
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2208
2219
  END_STATE();
2209
2220
  case 122:
2210
2221
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2211
2222
  if (lookahead == 'a') ADVANCE(125);
2212
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2223
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2213
2224
  END_STATE();
2214
2225
  case 123:
2215
2226
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2216
2227
  if (lookahead == 'e') ADVANCE(120);
2217
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2228
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2218
2229
  END_STATE();
2219
2230
  case 124:
2220
2231
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2221
2232
  if (lookahead == 'i') ADVANCE(126);
2222
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2233
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2223
2234
  END_STATE();
2224
2235
  case 125:
2225
2236
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2226
2237
  if (lookahead == 'l') ADVANCE(128);
2227
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2238
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2228
2239
  END_STATE();
2229
2240
  case 126:
2230
2241
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2231
2242
  if (lookahead == 'l') ADVANCE(119);
2232
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2243
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2233
2244
  END_STATE();
2234
2245
  case 127:
2235
2246
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2236
2247
  if (lookahead == 'r') ADVANCE(129);
2237
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2248
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2238
2249
  END_STATE();
2239
2250
  case 128:
2240
2251
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2241
2252
  if (lookahead == 's') ADVANCE(123);
2242
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2253
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2243
2254
  END_STATE();
2244
2255
  case 129:
2245
2256
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2246
2257
  if (lookahead == 'u') ADVANCE(123);
2247
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2258
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2248
2259
  END_STATE();
2249
2260
  case 130:
2250
2261
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2251
2262
  if (lookahead == '+' ||
2252
2263
  lookahead == '-') ADVANCE(131);
2253
2264
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2254
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2265
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2255
2266
  END_STATE();
2256
2267
  case 131:
2257
2268
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2258
2269
  if (('0' <= lookahead && lookahead <= '9')) ADVANCE(71);
2259
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2270
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2260
2271
  END_STATE();
2261
2272
  case 132:
2262
2273
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2263
2274
  if (('0' <= lookahead && lookahead <= '9') ||
2264
2275
  ('A' <= lookahead && lookahead <= 'F') ||
2265
2276
  ('a' <= lookahead && lookahead <= 'f')) ADVANCE(72);
2266
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2277
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2267
2278
  END_STATE();
2268
2279
  case 133:
2269
2280
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2270
2281
  if (('0' <= lookahead && lookahead <= '9') ||
2271
2282
  ('A' <= lookahead && lookahead <= 'Z') ||
2272
2283
  ('a' <= lookahead && lookahead <= 'z')) ADVANCE(74);
2273
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2284
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2274
2285
  END_STATE();
2275
2286
  case 134:
2276
2287
  ACCEPT_TOKEN(aux_sym__sym_qualified_token1);
2277
- if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 19, lookahead))) ADVANCE(134);
2288
+ if ((!eof && set_contains(aux_sym__kwd_qualified_token1_character_set_2, 21, lookahead))) ADVANCE(134);
2278
2289
  END_STATE();
2279
2290
  case 135:
2280
2291
  ACCEPT_TOKEN(aux_sym__sym_qualified_token2);
2281
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(135);
2292
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(135);
2282
2293
  END_STATE();
2283
2294
  case 136:
2284
2295
  ACCEPT_TOKEN(anon_sym_CARET);
@@ -2332,7 +2343,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2332
2343
  if (lookahead == '?') ADVANCE(150);
2333
2344
  if (lookahead == '^') ADVANCE(137);
2334
2345
  if (lookahead == '_') ADVANCE(53);
2335
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2346
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2336
2347
  END_STATE();
2337
2348
  case 147:
2338
2349
  ACCEPT_TOKEN(anon_sym_POUND);
@@ -2342,7 +2353,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2342
2353
  if (lookahead == '?') ADVANCE(150);
2343
2354
  if (lookahead == '^') ADVANCE(137);
2344
2355
  if (lookahead == '_') ADVANCE(53);
2345
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2356
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2346
2357
  END_STATE();
2347
2358
  case 148:
2348
2359
  ACCEPT_TOKEN(anon_sym_POUND);
@@ -2358,11 +2369,11 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2358
2369
  case 150:
2359
2370
  ACCEPT_TOKEN(anon_sym_POUND_QMARK);
2360
2371
  if (lookahead == '@') ADVANCE(152);
2361
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2372
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2362
2373
  END_STATE();
2363
2374
  case 151:
2364
2375
  ACCEPT_TOKEN(anon_sym_POUND_QMARK);
2365
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2376
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2366
2377
  END_STATE();
2367
2378
  case 152:
2368
2379
  ACCEPT_TOKEN(anon_sym_POUND_QMARK_AT);
@@ -2372,21 +2383,21 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2372
2383
  END_STATE();
2373
2384
  case 154:
2374
2385
  ACCEPT_TOKEN(anon_sym_POUND_SQUOTE);
2375
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2386
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2376
2387
  END_STATE();
2377
2388
  case 155:
2378
2389
  ACCEPT_TOKEN(anon_sym_POUND_POUND);
2379
2390
  END_STATE();
2380
2391
  case 156:
2381
2392
  ACCEPT_TOKEN(anon_sym_POUND_POUND);
2382
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2393
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2383
2394
  END_STATE();
2384
2395
  case 157:
2385
2396
  ACCEPT_TOKEN(anon_sym_POUND_EQ);
2386
2397
  END_STATE();
2387
2398
  case 158:
2388
2399
  ACCEPT_TOKEN(anon_sym_POUND_EQ);
2389
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2400
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2390
2401
  END_STATE();
2391
2402
  case 159:
2392
2403
  ACCEPT_TOKEN(anon_sym_AT);
@@ -2396,7 +2407,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
2396
2407
  END_STATE();
2397
2408
  case 161:
2398
2409
  ACCEPT_TOKEN(anon_sym_SQUOTE);
2399
- if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 18, lookahead))) ADVANCE(99);
2410
+ if ((!eof && set_contains(aux_sym__kwd_leading_slash_token1_character_set_1, 20, lookahead))) ADVANCE(99);
2400
2411
  END_STATE();
2401
2412
  case 162:
2402
2413
  ACCEPT_TOKEN(anon_sym_BQUOTE);
@@ -50,69 +50,104 @@ extern "C" {
50
50
  /// memory allocated for the array's contents.
51
51
  #define array_clear(self) ((self)->size = 0)
52
52
 
53
+ #ifdef __cplusplus
54
+ #define _array__cast(self, expr) (decltype((self)->contents))(expr)
55
+ #else
56
+ #define _array__cast(self, expr) (expr)
57
+ #endif
58
+
53
59
  /// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
54
60
  /// less than the array's current capacity, this function has no effect.
55
- #define array_reserve(self, new_capacity) \
56
- _array__reserve((Array *)(self), array_elem_size(self), new_capacity)
61
+ #define array_reserve(self, new_capacity) \
62
+ ((self)->contents = _array__cast(self, _array__reserve( \
63
+ (void *)(self)->contents, &(self)->capacity, \
64
+ array_elem_size(self), new_capacity)) \
65
+ )
57
66
 
58
67
  /// Free any memory allocated for this array. Note that this does not free any
59
68
  /// memory allocated for the array's contents.
60
- #define array_delete(self) _array__delete((Array *)(self))
69
+ #define array_delete(self) \
70
+ do { \
71
+ if ((self)->contents) ts_free((self)->contents); \
72
+ (self)->contents = NULL; \
73
+ (self)->size = 0; \
74
+ (self)->capacity = 0; \
75
+ } while (0)
61
76
 
62
77
  /// Push a new `element` onto the end of the array.
63
- #define array_push(self, element) \
64
- (_array__grow((Array *)(self), 1, array_elem_size(self)), \
65
- (self)->contents[(self)->size++] = (element))
78
+ #define array_push(self, element) \
79
+ do { \
80
+ (self)->contents = _array__cast(self, _array__grow( \
81
+ (void *)(self)->contents, (self)->size, &(self)->capacity, \
82
+ 1, array_elem_size(self) \
83
+ )); \
84
+ (self)->contents[(self)->size++] = (element); \
85
+ } while(0)
66
86
 
67
87
  /// Increase the array's size by `count` elements.
68
88
  /// New elements are zero-initialized.
69
- #define array_grow_by(self, count) \
70
- do { \
71
- if ((count) == 0) break; \
72
- _array__grow((Array *)(self), count, array_elem_size(self)); \
89
+ #define array_grow_by(self, count) \
90
+ do { \
91
+ if ((count) == 0) break; \
92
+ (self)->contents = _array__cast(self, _array__grow( \
93
+ (self)->contents, (self)->size, &(self)->capacity, \
94
+ count, array_elem_size(self) \
95
+ )); \
73
96
  memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
74
- (self)->size += (count); \
97
+ (self)->size += (count); \
75
98
  } while (0)
76
99
 
77
100
  /// Append all elements from one array to the end of another.
78
- #define array_push_all(self, other) \
101
+ #define array_push_all(self, other) \
79
102
  array_extend((self), (other)->size, (other)->contents)
80
103
 
81
104
  /// Append `count` elements to the end of the array, reading their values from the
82
105
  /// `contents` pointer.
83
- #define array_extend(self, count, contents) \
84
- _array__splice( \
85
- (Array *)(self), array_elem_size(self), (self)->size, \
86
- 0, count, contents \
87
- )
106
+ #define array_extend(self, count, other_contents) \
107
+ ((self)->contents = _array__cast(self, _array__splice( \
108
+ (void*)(self)->contents, &(self)->size, &(self)->capacity, \
109
+ array_elem_size(self), (self)->size, 0, count, other_contents \
110
+ )))
88
111
 
89
112
  /// Remove `old_count` elements from the array starting at the given `index`. At
90
113
  /// the same index, insert `new_count` new elements, reading their values from the
91
114
  /// `new_contents` pointer.
92
- #define array_splice(self, _index, old_count, new_count, new_contents) \
93
- _array__splice( \
94
- (Array *)(self), array_elem_size(self), _index, \
95
- old_count, new_count, new_contents \
96
- )
115
+ #define array_splice(self, _index, old_count, new_count, new_contents) \
116
+ ((self)->contents = _array__cast(self, _array__splice( \
117
+ (void *)(self)->contents, &(self)->size, &(self)->capacity, \
118
+ array_elem_size(self), _index, old_count, new_count, new_contents \
119
+ )))
97
120
 
98
121
  /// Insert one `element` into the array at the given `index`.
99
- #define array_insert(self, _index, element) \
100
- _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element))
122
+ #define array_insert(self, _index, element) \
123
+ ((self)->contents = _array__cast(self, _array__splice( \
124
+ (void *)(self)->contents, &(self)->size, &(self)->capacity, \
125
+ array_elem_size(self), _index, 0, 1, &(element) \
126
+ )))
101
127
 
102
128
  /// Remove one element from the array at the given `index`.
103
129
  #define array_erase(self, _index) \
104
- _array__erase((Array *)(self), array_elem_size(self), _index)
130
+ _array__erase((void *)(self)->contents, &(self)->size, array_elem_size(self), _index)
105
131
 
106
132
  /// Pop the last element off the array, returning the element by value.
107
133
  #define array_pop(self) ((self)->contents[--(self)->size])
108
134
 
109
135
  /// Assign the contents of one array to another, reallocating if necessary.
110
- #define array_assign(self, other) \
111
- _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self))
136
+ #define array_assign(self, other) \
137
+ ((self)->contents = _array__cast(self, _array__assign( \
138
+ (void *)(self)->contents, &(self)->size, &(self)->capacity, \
139
+ (const void *)(other)->contents, (other)->size, array_elem_size(self) \
140
+ )))
112
141
 
113
142
  /// Swap one array with another
114
- #define array_swap(self, other) \
115
- _array__swap((Array *)(self), (Array *)(other))
143
+ #define array_swap(self, other) \
144
+ do { \
145
+ void *_array_swap_tmp = (void *)(self)->contents; \
146
+ (self)->contents = (other)->contents; \
147
+ (other)->contents = _array__cast(other, _array_swap_tmp); \
148
+ _array__swap(&(self)->size, &(self)->capacity, \
149
+ &(other)->size, &(other)->capacity); \
150
+ } while (0)
116
151
 
117
152
  /// Get the size of the array contents
118
153
  #define array_elem_size(self) (sizeof *(self)->contents)
@@ -157,82 +192,90 @@ extern "C" {
157
192
 
158
193
  // Private
159
194
 
160
- typedef Array(void) Array;
161
-
162
- /// This is not what you're looking for, see `array_delete`.
163
- static inline void _array__delete(Array *self) {
164
- if (self->contents) {
165
- ts_free(self->contents);
166
- self->contents = NULL;
167
- self->size = 0;
168
- self->capacity = 0;
169
- }
170
- }
195
+ // Pointers to individual `Array` fields (rather than the entire `Array` itself)
196
+ // are passed to the various `_array__*` functions below to address strict aliasing
197
+ // violations that arises when the _entire_ `Array` struct is passed as `Array(void)*`.
198
+ //
199
+ // The `Array` type itself was not altered as a solution in order to avoid breakage
200
+ // with existing consumers (in particular, parsers with external scanners).
171
201
 
172
202
  /// This is not what you're looking for, see `array_erase`.
173
- static inline void _array__erase(Array *self, size_t element_size,
174
- uint32_t index) {
175
- assert(index < self->size);
176
- char *contents = (char *)self->contents;
203
+ static inline void _array__erase(void* self_contents, uint32_t *size,
204
+ size_t element_size, uint32_t index) {
205
+ assert(index < *size);
206
+ char *contents = (char *)self_contents;
177
207
  memmove(contents + index * element_size, contents + (index + 1) * element_size,
178
- (self->size - index - 1) * element_size);
179
- self->size--;
208
+ (*size - index - 1) * element_size);
209
+ (*size)--;
180
210
  }
181
211
 
182
212
  /// This is not what you're looking for, see `array_reserve`.
183
- static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) {
184
- if (new_capacity > self->capacity) {
185
- if (self->contents) {
186
- self->contents = ts_realloc(self->contents, new_capacity * element_size);
213
+ static inline void *_array__reserve(void *contents, uint32_t *capacity,
214
+ size_t element_size, uint32_t new_capacity) {
215
+ void *new_contents = contents;
216
+ if (new_capacity > *capacity) {
217
+ if (contents) {
218
+ new_contents = ts_realloc(contents, new_capacity * element_size);
187
219
  } else {
188
- self->contents = ts_malloc(new_capacity * element_size);
220
+ new_contents = ts_malloc(new_capacity * element_size);
189
221
  }
190
- self->capacity = new_capacity;
222
+ *capacity = new_capacity;
191
223
  }
224
+ return new_contents;
192
225
  }
193
226
 
194
227
  /// This is not what you're looking for, see `array_assign`.
195
- static inline void _array__assign(Array *self, const Array *other, size_t element_size) {
196
- _array__reserve(self, element_size, other->size);
197
- self->size = other->size;
198
- memcpy(self->contents, other->contents, self->size * element_size);
228
+ static inline void *_array__assign(void* self_contents, uint32_t *self_size, uint32_t *self_capacity,
229
+ const void *other_contents, uint32_t other_size, size_t element_size) {
230
+ void *new_contents = _array__reserve(self_contents, self_capacity, element_size, other_size);
231
+ *self_size = other_size;
232
+ memcpy(new_contents, other_contents, *self_size * element_size);
233
+ return new_contents;
199
234
  }
200
235
 
201
236
  /// This is not what you're looking for, see `array_swap`.
202
- static inline void _array__swap(Array *self, Array *other) {
203
- Array swap = *other;
204
- *other = *self;
205
- *self = swap;
237
+ static inline void _array__swap(uint32_t *self_size, uint32_t *self_capacity,
238
+ uint32_t *other_size, uint32_t *other_capacity) {
239
+ uint32_t tmp_size = *self_size;
240
+ uint32_t tmp_capacity = *self_capacity;
241
+ *self_size = *other_size;
242
+ *self_capacity = *other_capacity;
243
+ *other_size = tmp_size;
244
+ *other_capacity = tmp_capacity;
206
245
  }
207
246
 
208
247
  /// This is not what you're looking for, see `array_push` or `array_grow_by`.
209
- static inline void _array__grow(Array *self, uint32_t count, size_t element_size) {
210
- uint32_t new_size = self->size + count;
211
- if (new_size > self->capacity) {
212
- uint32_t new_capacity = self->capacity * 2;
248
+ static inline void *_array__grow(void *contents, uint32_t size, uint32_t *capacity,
249
+ uint32_t count, size_t element_size) {
250
+ void *new_contents = contents;
251
+ uint32_t new_size = size + count;
252
+ if (new_size > *capacity) {
253
+ uint32_t new_capacity = *capacity * 2;
213
254
  if (new_capacity < 8) new_capacity = 8;
214
255
  if (new_capacity < new_size) new_capacity = new_size;
215
- _array__reserve(self, element_size, new_capacity);
256
+ new_contents = _array__reserve(contents, capacity, element_size, new_capacity);
216
257
  }
258
+ return new_contents;
217
259
  }
218
260
 
219
261
  /// This is not what you're looking for, see `array_splice`.
220
- static inline void _array__splice(Array *self, size_t element_size,
262
+ static inline void *_array__splice(void *self_contents, uint32_t *size, uint32_t *capacity,
263
+ size_t element_size,
221
264
  uint32_t index, uint32_t old_count,
222
265
  uint32_t new_count, const void *elements) {
223
- uint32_t new_size = self->size + new_count - old_count;
266
+ uint32_t new_size = *size + new_count - old_count;
224
267
  uint32_t old_end = index + old_count;
225
268
  uint32_t new_end = index + new_count;
226
- assert(old_end <= self->size);
269
+ assert(old_end <= *size);
227
270
 
228
- _array__reserve(self, element_size, new_size);
271
+ void *new_contents = _array__reserve(self_contents, capacity, element_size, new_size);
229
272
 
230
- char *contents = (char *)self->contents;
231
- if (self->size > old_end) {
273
+ char *contents = (char *)new_contents;
274
+ if (*size > old_end) {
232
275
  memmove(
233
276
  contents + new_end * element_size,
234
277
  contents + old_end * element_size,
235
- (self->size - old_end) * element_size
278
+ (*size - old_end) * element_size
236
279
  );
237
280
  }
238
281
  if (new_count > 0) {
@@ -250,7 +293,9 @@ static inline void _array__splice(Array *self, size_t element_size,
250
293
  );
251
294
  }
252
295
  }
253
- self->size += new_count - old_count;
296
+ *size += new_count - old_count;
297
+
298
+ return new_contents;
254
299
  }
255
300
 
256
301
  /// A binary search routine, based on Rust's `std::slice::binary_search_by`.
Binary file
package/tree-sitter.json CHANGED
@@ -14,8 +14,8 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "0.2.5",
18
- "license": "CC0",
17
+ "version": "0.2.8",
18
+ "license": "CC0-1.0",
19
19
  "description": "Parser for Clojure files",
20
20
  "authors": [
21
21
  {
@@ -23,7 +23,8 @@
23
23
  }
24
24
  ],
25
25
  "links": {
26
- "repository": "https://codeberg.org/grammar-orchard/tree-sitter-clojure-orchard"
26
+ "repository": "https://codeberg.org/grammar-orchard/tree-sitter-clojure-orchard",
27
+ "upstream": "https://github.com/sogaiu/tree-sitter-clojure"
27
28
  }
28
29
  },
29
30
  "bindings": {