tree-sitter-abl 0.0.47 → 0.0.48

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/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  MIT License
2
2
 
3
+ Copyright (c) 2025 Eglė Kazbaraitė
3
4
  Copyright (c) Kamil Jakubus, Jason Chrosrova and contributors
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  OpenEdge Advanced Business Language (ABL) grammar for tree-sitter.
4
4
 
5
- To see syntax tree output see `test/corpus`.
5
+ Forked from [@usagi-coffee/tree-sitter-abl](https://github.com/usagi-coffee/tree-sitter-abl)
6
6
 
7
- Check out [tree-sitter-df](https://github.com/usagi-coffee/tree-sitter-df) for progress data definitions parser.
7
+
8
+ To see syntax tree output see files in `test/corpus`.
8
9
 
9
10
  ## Usage
10
11
 
@@ -15,7 +16,7 @@ For the grammar usage in your project look at tree-sitter documentation on how t
15
16
  ### Node
16
17
 
17
18
  ```bash
18
- npm install @usagi-coffee/tree-sitter-abl
19
+ npm install tree-sitter-abl
19
20
  ```
20
21
 
21
22
  ### WASM
@@ -26,7 +27,7 @@ Follow [web-tree-sitter](https://github.com/tree-sitter/tree-sitter/tree/master/
26
27
  ```
27
28
  // Getting wasm binary from the npm package
28
29
  const fs = require('node:fs');
29
- const mod = fs.readFileSync('node_modules/@usagi-coffee/tree-sitter-abl/tree-sitter-abl.wasm');
30
+ const mod = fs.readFileSync('node_modules/tree-sitter-abl/tree-sitter-abl.wasm');
30
31
  ```
31
32
 
32
33
  ### Shared library (.so)
@@ -49,28 +50,3 @@ npm run test
49
50
  npm run parse your_file.p
50
51
  ```
51
52
 
52
- ## License
53
-
54
- ```LICENSE
55
- MIT License
56
-
57
- Copyright (c) Kamil Jakubus, Jason Chrosrova and contributors
58
-
59
- Permission is hereby granted, free of charge, to any person obtaining a copy
60
- of this software and associated documentation files (the "Software"), to deal
61
- in the Software without restriction, including without limitation the rights
62
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63
- copies of the Software, and to permit persons to whom the Software is
64
- furnished to do so, subject to the following conditions:
65
-
66
- The above copyright notice and this permission notice shall be included in all
67
- copies or substantial portions of the Software.
68
-
69
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
70
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
71
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
72
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
74
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
75
- SOFTWARE.
76
- ```
@@ -1,28 +1,28 @@
1
- #include "tree_sitter/parser.h"
2
- #include <node.h>
3
- #include "nan.h"
4
-
5
- using namespace v8;
6
-
7
- extern "C" TSLanguage * tree_sitter_abl();
8
-
9
- namespace {
10
-
11
- NAN_METHOD(New) {}
12
-
13
- void Init(Local<Object> exports, Local<Object> module) {
14
- Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
15
- tpl->SetClassName(Nan::New("Language").ToLocalChecked());
16
- tpl->InstanceTemplate()->SetInternalFieldCount(1);
17
-
18
- Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
19
- Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
20
- Nan::SetInternalFieldPointer(instance, 0, tree_sitter_abl());
21
-
22
- Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("abl").ToLocalChecked());
23
- Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
24
- }
25
-
26
- NODE_MODULE(tree_sitter_abl_binding, Init)
27
-
28
- } // namespace
1
+ #include "tree_sitter/parser.h"
2
+ #include <node.h>
3
+ #include "nan.h"
4
+
5
+ using namespace v8;
6
+
7
+ extern "C" TSLanguage * tree_sitter_abl();
8
+
9
+ namespace {
10
+
11
+ NAN_METHOD(New) {}
12
+
13
+ void Init(Local<Object> exports, Local<Object> module) {
14
+ Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
15
+ tpl->SetClassName(Nan::New("Language").ToLocalChecked());
16
+ tpl->InstanceTemplate()->SetInternalFieldCount(1);
17
+
18
+ Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
19
+ Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
20
+ Nan::SetInternalFieldPointer(instance, 0, tree_sitter_abl());
21
+
22
+ Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("abl").ToLocalChecked());
23
+ Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
24
+ }
25
+
26
+ NODE_MODULE(tree_sitter_abl_binding, Init)
27
+
28
+ } // namespace
@@ -1,19 +1,19 @@
1
- try {
2
- module.exports = require("../../build/Release/tree_sitter_abl_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_abl_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 (_) {}
1
+ try {
2
+ module.exports = require("../../build/Release/tree_sitter_abl_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_abl_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 (_) {}
@@ -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
+ }
@@ -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
+ }
package/example1.cls CHANGED
@@ -1,11 +1,9 @@
1
- CLASS TestFormatting:
1
+ BLOCK-LEVEL ON ERROR UNDO, THROW.
2
2
 
3
- define TEMP-TABLE ttFormatting NO-UNDO
4
- FIELD uid AS INT64
5
- FIELD textInfo AS CHARACTER
6
- FIELD NotifyPropertyChanged AS LOGICAL
7
- FIELD NotifyOnSourceUpdate AS Progress.Lang.Object
8
- INDEX idx1 IS PRIMARY UNIQUE uid
9
- INDEX idx2 textInfo NotifyOnSourceUpdate NotifyPropertyChanged.
3
+ USING Domains.Vacation.Vacation.
4
+ USING Progress.Collections.*.
10
5
 
6
+ CLASS Domains.Vacation.VacationRepository:
7
+ METHOD PUBLIC List<Vacation> GetByEmpNum(pcEmpNum AS INTEGER):
8
+ END METHOD.
11
9
  END CLASS.