tree-sitter-kdl 1.0.0 → 1.0.2

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.
Files changed (40) hide show
  1. package/.gitattributes +4 -0
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/fuzz.yml +1 -1
  4. package/.github/workflows/{build.yml → publish.yml} +1 -1
  5. package/Cargo.toml +11 -6
  6. package/LICENSE +21 -0
  7. package/Package.swift +38 -0
  8. package/README.md +3 -0
  9. package/binding.gyp +0 -1
  10. package/bindings/node/binding.cc +7 -5
  11. package/bindings/node/index.js +4 -4
  12. package/bindings/rust/README.md +36 -0
  13. package/bindings/rust/build.rs +0 -19
  14. package/bindings/rust/lib.rs +22 -10
  15. package/bindings/swift/kdl.h +16 -0
  16. package/grammar.js +47 -40
  17. package/package.json +27 -13
  18. package/queries/folds.scm +6 -1
  19. package/queries/highlights.scm +1 -1
  20. package/queries/indents.scm +7 -0
  21. package/queries/injections.scm +4 -0
  22. package/queries/locals.scm +10 -0
  23. package/examples/01-basic.kdl +0 -1
  24. package/examples/02-multiple-values.kdl +0 -1
  25. package/examples/03-properties.kdl +0 -1
  26. package/examples/04-child-nodes.kdl +0 -6
  27. package/examples/05-node-terminators.kdl +0 -1
  28. package/examples/06-string-formats.kdl +0 -2
  29. package/examples/07-multiline-string.kdl +0 -3
  30. package/examples/08-raw-string.kdl +0 -1
  31. package/examples/09-number.kdl +0 -1
  32. package/examples/10-number-forms.kdl +0 -3
  33. package/examples/11-number-with-underscores.kdl +0 -1
  34. package/examples/12-comments.kdl +0 -11
  35. package/examples/13-slashdash-comments.kdl +0 -11
  36. package/examples/14-type-annotations.kdl +0 -4
  37. package/examples/15-rich-example.kdl +0 -21
  38. package/script/known_failures.txt +0 -0
  39. package/script/parse-examples +0 -40
  40. package/test/corpus/node.txt +0 -2784
@@ -0,0 +1,10 @@
1
+ (document) @scope
2
+ (node (node_children) @scope)
3
+ (node_children (node) @scope)
4
+
5
+ (identifier) @reference
6
+
7
+ (node_field) @definition.field
8
+
9
+ (node (identifier) @definition.type)
10
+ (type) @definition.type
@@ -1 +0,0 @@
1
- title "Hello, World"
@@ -1 +0,0 @@
1
- bookmarks 12 15 188 1234
@@ -1 +0,0 @@
1
- author "Alex Monad" email="alex@example.com" active=true
@@ -1,6 +0,0 @@
1
- contents {
2
- section "First section" {
3
- paragraph "This is the first paragraph"
4
- paragraph "This is the second paragraph"
5
- }
6
- }
@@ -1 +0,0 @@
1
- node1; node2; node3;
@@ -1,2 +0,0 @@
1
- node "this\nhas\tescapes"
2
- other r"C:\Users\zkat\"
@@ -1,3 +0,0 @@
1
- string "my
2
- multiline
3
- value"
@@ -1 +0,0 @@
1
- other-raw r#"hello"world"#
@@ -1 +0,0 @@
1
- num 1.234e-42
@@ -1,3 +0,0 @@
1
- my-hex 0xdeadbeef
2
- my-octal 0o755
3
- my-binary 0b10101101
@@ -1 +0,0 @@
1
- bignum 1_000_000
@@ -1,11 +0,0 @@
1
- // C style
2
-
3
- /*
4
- C style multiline
5
- */
6
-
7
- tag /*foo=true*/ bar=false
8
-
9
- /*/*
10
- hello
11
- */*/
@@ -1,11 +0,0 @@
1
- // This entire node and its children are all commented out.
2
- /-mynode "foo" key=1 {
3
- a
4
- b
5
- c
6
- }
7
-
8
- mynode /-"commented" "not commented" /-key="value" /-{
9
- a
10
- b
11
- }
@@ -1,4 +0,0 @@
1
- numbers (u8)10 (i32)20 myfloat=(f32)1.5 {
2
- strings (uuid)"123e4567-e89b-12d3-a456-426614174000" (date)"2021-02-03" filter=(regex)r"$\d+"
3
- (author)person name="Alex"
4
- }
@@ -1,21 +0,0 @@
1
- // Nodes can be separated into multiple lines
2
- title \
3
- "Some title"
4
-
5
-
6
- // Files must be utf8 encoded!
7
- smile "😁"
8
-
9
- // Instead of anonymous nodes, nodes and properties can be wrapped
10
- // in "" for arbitrary node names.
11
- "!@#$@$%Q#$%~@!40" "1.2.3" "!!!!!"=true
12
-
13
- // The following is a legal bare identifier:
14
- foo123~!@#$%^&*.:'|?+ "weeee"
15
-
16
- // And you can also use unicode!
17
- ノード お名前="☜(゚ヮ゚☜)"
18
-
19
- // kdl specifically allows properties and values to be
20
- // interspersed with each other, much like CLI commands.
21
- foo bar=true "baz" quux=false 1 2 3
File without changes
@@ -1,40 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- cd "$(dirname "$0")/.."
6
-
7
- function checkout() {
8
- repo=$1; url=$2; sha=$3
9
-
10
- if [ ! -d "$repo" ]; then
11
- git clone "https://github.com/$url" "$repo"
12
- fi
13
-
14
- pushd "$repo"
15
- git fetch && git reset --hard "$sha"
16
- popd
17
- }
18
-
19
- checkout examples/kdl kdl-org/kdl 6feeccc491808fe0b5425a18aa7ab4a8ac435e55
20
- checkout examples/kdl-rs kdl-org/kdl-rs 8c028e5ea189470f07c5c848ab778f3d63ba89ab
21
- checkout examples/kdl-js kdl-org/kdljs bb874a595e6f712950795ecaad62f24fd945f03d
22
- checkout examples/kdl-php kdl-org/kdl-php 390fdc5ab8e2749feb01a113e8feb028de0861b3
23
-
24
- known_failures="$(cat script/known_failures.txt)"
25
-
26
- # Remove input directories
27
- find examples -type d -name input -exec rm -rf {} +
28
-
29
- tree-sitter parse -q \
30
- 'examples/**/*.kdl' \
31
- "$(for file in $known_failures; do echo "!${file}"; done)"
32
-
33
- example_count=$(find examples -name '*.kdl' | wc -l)
34
- failure_count=$(wc -w <<< "$known_failures")
35
- success_count=$(( example_count - failure_count ))
36
- success_percent=$(bc -l <<< "100*${success_count}/${example_count}")
37
-
38
- printf \
39
- "Successfully parsed %d of %d example files (%.1f%%)\n" \
40
- $success_count "$example_count" "$success_percent"