Skip to content

Commit 9d002ee

Browse files
committed
Bump tree-sitter-cli to 0.19
1 parent 1be73c2 commit 9d002ee

File tree

12 files changed

+5705
-366
lines changed

12 files changed

+5705
-366
lines changed

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ corpus
22
build
33
script
44
examples
5-
5+
target

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tree-sitter-rust"
33
description = "Rust grammar for the tree-sitter parsing library"
4-
version = "0.16.0"
4+
version = "0.19.0"
55
authors = ["Max Brunsfeld <[email protected]>"]
66
license = "MIT"
77
readme = "bindings/rust/README.md"
@@ -23,7 +23,7 @@ autoexamples = false
2323
path = "bindings/rust/lib.rs"
2424

2525
[dependencies]
26-
tree-sitter = "0.17"
26+
tree-sitter = "0.19"
2727

2828
[build-dependencies]
2929
cc = "1.0"

binding.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"sources": [
1010
"src/parser.c",
1111
"src/scanner.c",
12-
"src/binding.cc"
12+
"bindings/node/binding.cc"
1313
],
1414
"cflags_c": [
1515
"-std=c99",
File renamed without changes.

bindings/node/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
try {
2+
module.exports = require("../../build/Release/tree_sitter_rust_binding");
3+
} catch (error1) {
4+
if (error1.code !== 'MODULE_NOT_FOUND') {
5+
throw error1;
6+
}
7+
try {
8+
module.exports = require("../../build/Debug/tree_sitter_rust_binding");
9+
} catch (error2) {
10+
if (error2.code !== 'MODULE_NOT_FOUND') {
11+
throw error2;
12+
}
13+
throw error1
14+
}
15+
}
16+
17+
try {
18+
module.exports.nodeTypeInfo = require("../../src/node-types.json");
19+
} catch (_) {}

bindings/rust/build.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
use std::path::Path;
2-
extern crate cc;
3-
41
fn main() {
5-
let src_dir = Path::new("src");
6-
7-
let mut c_config = cc::Build::new();
8-
c_config.include(&src_dir);
9-
c_config
2+
let src_dir = std::path::Path::new("src");
3+
let mut config = cc::Build::new();
4+
config.include(&src_dir);
5+
config
106
.flag_if_supported("-Wno-unused-parameter")
117
.flag_if_supported("-Wno-unused-but-set-variable")
128
.flag_if_supported("-Wno-trigraphs");
139
let parser_path = src_dir.join("parser.c");
14-
c_config.file(&parser_path);
1510
let scanner_path = src_dir.join("scanner.c");
16-
c_config.file(&scanner_path);
1711
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
18-
c_config.compile("parser-scanner");
12+
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
13+
config.file(&parser_path);
14+
config.file(&scanner_path);
15+
config.compile("parser-scanner");
1916
}

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ module.exports = grammar({
14321432
$.scoped_identifier
14331433
),
14341434

1435-
identifier: $ => /(r#)?[a-zA-Zα-ωΑ-Ωµ_][a-zA-Zα-ωΑ-Ωµ\d_]*/,
1435+
identifier: $ => /(r#)?[_\p{XID_Start}][_\p{XID_Continue}]*/,
14361436

14371437
_reserved_identifier: $ => alias(choice(
14381438
'default',

index.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "tree-sitter-rust",
33
"version": "0.17.0",
44
"description": "Rust grammar for tree-sitter",
5-
"main": "index.js",
5+
"main": "bindings/node",
66
"keywords": [
77
"parser",
88
"rust"
99
],
1010
"author": "Maxim Sokolov <[email protected]> (https://github.com/MaximSokolov)",
1111
"license": "MIT",
1212
"dependencies": {
13-
"nan": "^2.8.0"
13+
"nan": "^2.14.0"
1414
},
1515
"devDependencies": {
16-
"tree-sitter-cli": "^0.17.3"
16+
"tree-sitter-cli": "^0.19.1"
1717
},
1818
"scripts": {
1919
"test": "tree-sitter test && script/parse-examples",

src/grammar.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8218,7 +8218,7 @@
82188218
},
82198219
"identifier": {
82208220
"type": "PATTERN",
8221-
"value": "(r#)?[a-zA-Zα-ωΑ-Ωµ_][a-zA-Zα-ωΑ-Ωµ\\d_]*"
8221+
"value": "(r#)?[_\\p{XID_Start}][_\\p{XID_Continue}]*"
82228222
},
82238223
"_reserved_identifier": {
82248224
"type": "ALIAS",
@@ -8313,6 +8313,7 @@
83138313
"for_lifetimes"
83148314
]
83158315
],
8316+
"precedences": [],
83168317
"externals": [
83178318
{
83188319
"type": "SYMBOL",

0 commit comments

Comments
 (0)