@konomanoasa/tree-sitter-toml 0.3.0 → 0.4.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/Cargo.toml CHANGED
@@ -1,10 +1,23 @@
1
1
  [package]
2
- name = "tree-sitter-toml"
3
- version = "0.3.0"
2
+ name = "konomanoasa-tree-sitter-toml"
3
+ version = "0.4.0"
4
4
  edition = "2024"
5
+ description = "Tree-sitter grammar for TOML."
6
+ readme = "README.md"
7
+ repository = "https://github.com/konomanoasa/tree-sitter-toml"
8
+ license = "MIT"
5
9
  build = "bindings/rust/build.rs"
6
10
  links = "tree-sitter-toml"
7
- publish = false
11
+ include = [
12
+ "/LICENSE",
13
+ "/README.md",
14
+ "/bindings/rust/*.rs",
15
+ "/queries/*.scm",
16
+ "/src/*.c",
17
+ "/src/node-types.json",
18
+ "/src/tree_sitter/*.h",
19
+ "/test/bindings.test.rs",
20
+ ]
8
21
 
9
22
  [lib]
10
23
  path = "bindings/rust/lib.rs"
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # tree-sitter-toml
2
2
 
3
3
  [![CI](https://github.com/konomanoasa/tree-sitter-toml/actions/workflows/ci.yaml/badge.svg)](https://github.com/konomanoasa/tree-sitter-toml/actions/workflows/ci.yaml)
4
+ [![crates.io](https://img.shields.io/crates/v/konomanoasa-tree-sitter-toml)](https://crates.io/crates/konomanoasa-tree-sitter-toml)
4
5
  [![npm](https://img.shields.io/npm/v/@konomanoasa/tree-sitter-toml)](https://www.npmjs.com/package/@konomanoasa/tree-sitter-toml)
5
6
 
6
7
  [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for
@@ -12,15 +13,9 @@ Tom's Obvious Minimal Language 1.1.0.
12
13
  npm install @konomanoasa/tree-sitter-toml
13
14
  ```
14
15
 
15
- ## Grammar
16
-
17
- | Grammar | Description | Rust constant |
18
- | --- | --- | --- |
19
- | `toml` | TOML 1.1.0 | `LANGUAGE` |
20
-
21
16
  ## Development
22
17
 
23
- Development requires Node.js 24.2.0 or later.
18
+ Development uses Node.js 24 or later.
24
19
 
25
20
  ```sh
26
21
  npm install
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konomanoasa/tree-sitter-toml",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Tree-sitter grammar for TOML.",
6
6
  "license": "MIT",
package/src/parser.c CHANGED
@@ -9753,7 +9753,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_toml(void) {
9753
9753
  .max_reserved_word_set_size = 0,
9754
9754
  .metadata = {
9755
9755
  .major_version = 0,
9756
- .minor_version = 3,
9756
+ .minor_version = 4,
9757
9757
  .patch_version = 0,
9758
9758
  },
9759
9759
  };
package/src/scanner.c CHANGED
@@ -33,14 +33,13 @@ bool tree_sitter_toml_external_scanner_scan(
33
33
  const bool *valid_symbols
34
34
  ) {
35
35
  (void)payload;
36
- // Only error recovery marks both quote tokens valid at once.
37
- if (valid_symbols[MLB_QUOTE] == valid_symbols[MLL_QUOTE]) {
36
+ const int32_t quote = lexer->lookahead;
37
+ if (quote != '"' && quote != '\'') {
38
38
  return false;
39
39
  }
40
- const enum TokenType symbol =
41
- valid_symbols[MLB_QUOTE] ? MLB_QUOTE : MLL_QUOTE;
42
- const int32_t quote = symbol == MLB_QUOTE ? '"' : '\'';
43
- if (lexer->lookahead != quote) {
40
+ // Error recovery marks both quote tokens valid; the delimiter selects one.
41
+ const enum TokenType symbol = quote == '"' ? MLB_QUOTE : MLL_QUOTE;
42
+ if (!valid_symbols[symbol]) {
44
43
  return false;
45
44
  }
46
45
  lexer->advance(lexer, false);
@@ -1,16 +1,19 @@
1
+ use konomanoasa_tree_sitter_toml as grammar;
1
2
  use tree_sitter::{Parser, Query};
2
- use tree_sitter_toml as grammar;
3
3
 
4
4
  #[test]
5
5
  fn parses_valid_source() {
6
6
  let source = "answer = 42\n";
7
+ let language = grammar::LANGUAGE.into();
7
8
  let mut parser = Parser::new();
8
- parser.set_language(&grammar::LANGUAGE.into()).unwrap();
9
+ parser.set_language(&language).unwrap();
9
10
  let tree = parser.parse(source, None).unwrap();
10
11
  let root = tree.root_node();
11
12
  assert_eq!(root.kind(), "toml");
12
13
  assert_eq!(root.byte_range(), 0..source.len());
13
14
  assert!(!root.has_error());
15
+ assert!(grammar::NODE_TYPES.contains("\"toml\""));
16
+ Query::new(&language, grammar::HIGHLIGHTS_QUERY).unwrap();
14
17
  }
15
18
 
16
19
  #[test]
@@ -25,5 +28,4 @@ fn linked_scanner_preserves_quotes_in_multiline_strings() {
25
28
  assert_eq!(root.byte_range(), 0..source.len());
26
29
  assert!(!root.has_error(), "{source}");
27
30
  }
28
- Query::new(&language, grammar::HIGHLIGHTS_QUERY).unwrap();
29
31
  }
package/tree-sitter.json CHANGED
@@ -12,7 +12,7 @@
12
12
  }
13
13
  ],
14
14
  "metadata": {
15
- "version": "0.3.0",
15
+ "version": "0.4.0",
16
16
  "license": "MIT",
17
17
  "description": "Tree-sitter grammar for TOML.",
18
18
  "links": {