tree-sitter-abl 0.0.50 → 0.1.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/.vscode/settings.json +2 -2
- package/binding.gyp +19 -19
- package/bindings/node/binding_test.js +9 -0
- package/bindings/node/index.d.ts +28 -0
- package/bindings/rust/build.rs +40 -40
- package/bindings/rust/lib.rs +52 -52
- package/grammar.js +385 -115
- package/package.json +2 -1
- package/parser.exp +0 -0
- package/parser.lib +0 -0
- package/parser.obj +0 -0
- package/scanner.obj +0 -0
- package/src/grammar.json +5056 -1899
- package/src/node-types.json +915 -38
- package/src/parser.c +272994 -185199
- package/src/scanner.c +27 -4
- package/tree-sitter-abl.wasm +0 -0
- package/example1.cls +0 -1
package/.vscode/settings.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AblFormatter.variableAssignmentFormatting": true
|
|
1
|
+
{
|
|
2
|
+
"AblFormatter.variableAssignmentFormatting": true
|
|
3
3
|
}
|
package/binding.gyp
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"targets": [
|
|
3
|
-
{
|
|
4
|
-
"target_name": "tree_sitter_abl_binding",
|
|
5
|
-
"include_dirs": [
|
|
6
|
-
"<!(node -e \"require('nan')\")",
|
|
7
|
-
"src"
|
|
8
|
-
],
|
|
9
|
-
"sources": [
|
|
10
|
-
"bindings/node/binding.cc",
|
|
11
|
-
"src/parser.c",
|
|
12
|
-
"src/scanner.c",
|
|
13
|
-
],
|
|
14
|
-
"cflags_c": [
|
|
15
|
-
"-std=c99",
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "tree_sitter_abl_binding",
|
|
5
|
+
"include_dirs": [
|
|
6
|
+
"<!(node -e \"require('nan')\")",
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"sources": [
|
|
10
|
+
"bindings/node/binding.cc",
|
|
11
|
+
"src/parser.c",
|
|
12
|
+
"src/scanner.c",
|
|
13
|
+
],
|
|
14
|
+
"cflags_c": [
|
|
15
|
+
"-std=c99",
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type BaseNode = {
|
|
2
|
+
type: string;
|
|
3
|
+
named: boolean;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type ChildNode = {
|
|
7
|
+
multiple: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
types: BaseNode[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type NodeInfo =
|
|
13
|
+
| (BaseNode & {
|
|
14
|
+
subtypes: BaseNode[];
|
|
15
|
+
})
|
|
16
|
+
| (BaseNode & {
|
|
17
|
+
fields: { [name: string]: ChildNode };
|
|
18
|
+
children: ChildNode[];
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
type Language = {
|
|
22
|
+
name: string;
|
|
23
|
+
language: unknown;
|
|
24
|
+
nodeTypeInfo: NodeInfo[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare const language: Language;
|
|
28
|
+
export = language;
|
package/bindings/rust/build.rs
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
fn main() {
|
|
2
|
-
let src_dir = std::path::Path::new("src");
|
|
3
|
-
|
|
4
|
-
let mut c_config = cc::Build::new();
|
|
5
|
-
c_config.include(&src_dir);
|
|
6
|
-
c_config
|
|
7
|
-
.flag_if_supported("-Wno-unused-parameter")
|
|
8
|
-
.flag_if_supported("-Wno-unused-but-set-variable")
|
|
9
|
-
.flag_if_supported("-Wno-trigraphs");
|
|
10
|
-
let parser_path = src_dir.join("parser.c");
|
|
11
|
-
c_config.file(&parser_path);
|
|
12
|
-
|
|
13
|
-
// If your language uses an external scanner written in C,
|
|
14
|
-
// then include this block of code:
|
|
15
|
-
|
|
16
|
-
/*
|
|
17
|
-
let scanner_path = src_dir.join("scanner.c");
|
|
18
|
-
c_config.file(&scanner_path);
|
|
19
|
-
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
c_config.compile("parser");
|
|
23
|
-
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
|
24
|
-
|
|
25
|
-
// If your language uses an external scanner written in C++,
|
|
26
|
-
// then include this block of code:
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
let mut cpp_config = cc::Build::new();
|
|
30
|
-
cpp_config.cpp(true);
|
|
31
|
-
cpp_config.include(&src_dir);
|
|
32
|
-
cpp_config
|
|
33
|
-
.flag_if_supported("-Wno-unused-parameter")
|
|
34
|
-
.flag_if_supported("-Wno-unused-but-set-variable");
|
|
35
|
-
let scanner_path = src_dir.join("scanner.cc");
|
|
36
|
-
cpp_config.file(&scanner_path);
|
|
37
|
-
cpp_config.compile("scanner");
|
|
38
|
-
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
39
|
-
*/
|
|
40
|
-
}
|
|
1
|
+
fn main() {
|
|
2
|
+
let src_dir = std::path::Path::new("src");
|
|
3
|
+
|
|
4
|
+
let mut c_config = cc::Build::new();
|
|
5
|
+
c_config.include(&src_dir);
|
|
6
|
+
c_config
|
|
7
|
+
.flag_if_supported("-Wno-unused-parameter")
|
|
8
|
+
.flag_if_supported("-Wno-unused-but-set-variable")
|
|
9
|
+
.flag_if_supported("-Wno-trigraphs");
|
|
10
|
+
let parser_path = src_dir.join("parser.c");
|
|
11
|
+
c_config.file(&parser_path);
|
|
12
|
+
|
|
13
|
+
// If your language uses an external scanner written in C,
|
|
14
|
+
// then include this block of code:
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
let scanner_path = src_dir.join("scanner.c");
|
|
18
|
+
c_config.file(&scanner_path);
|
|
19
|
+
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
c_config.compile("parser");
|
|
23
|
+
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
|
24
|
+
|
|
25
|
+
// If your language uses an external scanner written in C++,
|
|
26
|
+
// then include this block of code:
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
let mut cpp_config = cc::Build::new();
|
|
30
|
+
cpp_config.cpp(true);
|
|
31
|
+
cpp_config.include(&src_dir);
|
|
32
|
+
cpp_config
|
|
33
|
+
.flag_if_supported("-Wno-unused-parameter")
|
|
34
|
+
.flag_if_supported("-Wno-unused-but-set-variable");
|
|
35
|
+
let scanner_path = src_dir.join("scanner.cc");
|
|
36
|
+
cpp_config.file(&scanner_path);
|
|
37
|
+
cpp_config.compile("scanner");
|
|
38
|
+
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
39
|
+
*/
|
|
40
|
+
}
|
package/bindings/rust/lib.rs
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
//! This crate provides abl language support for the [tree-sitter][] parsing library.
|
|
2
|
-
//!
|
|
3
|
-
//! Typically, you will use the [language][language func] function to add this language to a
|
|
4
|
-
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
|
5
|
-
//!
|
|
6
|
-
//! ```
|
|
7
|
-
//! let code = "";
|
|
8
|
-
//! let mut parser = tree_sitter::Parser::new();
|
|
9
|
-
//! parser.set_language(tree_sitter_abl::language()).expect("Error loading abl grammar");
|
|
10
|
-
//! let tree = parser.parse(code, None).unwrap();
|
|
11
|
-
//! ```
|
|
12
|
-
//!
|
|
13
|
-
//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
14
|
-
//! [language func]: fn.language.html
|
|
15
|
-
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
|
16
|
-
//! [tree-sitter]: https://tree-sitter.github.io/
|
|
17
|
-
|
|
18
|
-
use tree_sitter::Language;
|
|
19
|
-
|
|
20
|
-
extern "C" {
|
|
21
|
-
fn tree_sitter_abl() -> Language;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/// Get the tree-sitter [Language][] for this grammar.
|
|
25
|
-
///
|
|
26
|
-
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
27
|
-
pub fn language() -> Language {
|
|
28
|
-
unsafe { tree_sitter_abl() }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// The content of the [`node-types.json`][] file for this grammar.
|
|
32
|
-
///
|
|
33
|
-
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
|
34
|
-
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
|
|
35
|
-
|
|
36
|
-
// Uncomment these to include any queries that this grammar contains
|
|
37
|
-
|
|
38
|
-
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
|
39
|
-
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
|
|
40
|
-
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
|
|
41
|
-
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
|
|
42
|
-
|
|
43
|
-
#[cfg(test)]
|
|
44
|
-
mod tests {
|
|
45
|
-
#[test]
|
|
46
|
-
fn test_can_load_grammar() {
|
|
47
|
-
let mut parser = tree_sitter::Parser::new();
|
|
48
|
-
parser
|
|
49
|
-
.set_language(super::language())
|
|
50
|
-
.expect("Error loading abl language");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
//! This crate provides abl language support for the [tree-sitter][] parsing library.
|
|
2
|
+
//!
|
|
3
|
+
//! Typically, you will use the [language][language func] function to add this language to a
|
|
4
|
+
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
|
5
|
+
//!
|
|
6
|
+
//! ```
|
|
7
|
+
//! let code = "";
|
|
8
|
+
//! let mut parser = tree_sitter::Parser::new();
|
|
9
|
+
//! parser.set_language(tree_sitter_abl::language()).expect("Error loading abl grammar");
|
|
10
|
+
//! let tree = parser.parse(code, None).unwrap();
|
|
11
|
+
//! ```
|
|
12
|
+
//!
|
|
13
|
+
//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
14
|
+
//! [language func]: fn.language.html
|
|
15
|
+
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
|
16
|
+
//! [tree-sitter]: https://tree-sitter.github.io/
|
|
17
|
+
|
|
18
|
+
use tree_sitter::Language;
|
|
19
|
+
|
|
20
|
+
extern "C" {
|
|
21
|
+
fn tree_sitter_abl() -> Language;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Get the tree-sitter [Language][] for this grammar.
|
|
25
|
+
///
|
|
26
|
+
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
27
|
+
pub fn language() -> Language {
|
|
28
|
+
unsafe { tree_sitter_abl() }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// The content of the [`node-types.json`][] file for this grammar.
|
|
32
|
+
///
|
|
33
|
+
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
|
34
|
+
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
|
|
35
|
+
|
|
36
|
+
// Uncomment these to include any queries that this grammar contains
|
|
37
|
+
|
|
38
|
+
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
|
39
|
+
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
|
|
40
|
+
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
|
|
41
|
+
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
|
|
42
|
+
|
|
43
|
+
#[cfg(test)]
|
|
44
|
+
mod tests {
|
|
45
|
+
#[test]
|
|
46
|
+
fn test_can_load_grammar() {
|
|
47
|
+
let mut parser = tree_sitter::Parser::new();
|
|
48
|
+
parser
|
|
49
|
+
.set_language(super::language())
|
|
50
|
+
.expect("Error loading abl language");
|
|
51
|
+
}
|
|
52
|
+
}
|