abap-parser 0.1.0__tar.gz → 0.3.0__tar.gz
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.
- {abap_parser-0.1.0 → abap_parser-0.3.0}/Cargo.lock +10 -9
- {abap_parser-0.1.0 → abap_parser-0.3.0}/Cargo.toml +1 -1
- {abap_parser-0.1.0 → abap_parser-0.3.0}/PKG-INFO +8 -3
- {abap_parser-0.1.0 → abap_parser-0.3.0}/README.md +7 -2
- {abap_parser-0.1.0 → abap_parser-0.3.0}/bindings/python/README.md +7 -2
- {abap_parser-0.1.0 → abap_parser-0.3.0}/bindings/python/src/lib.rs +23 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/bindings/python/tests/test_symbols.py +17 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/calls.rs +244 -46
- abap_parser-0.3.0/crates/abap-analysis/src/ddic.rs +202 -0
- abap_parser-0.3.0/crates/abap-analysis/src/enhance.rs +305 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/lib.rs +66 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/logic.rs +394 -15
- abap_parser-0.3.0/crates/abap-analysis/src/stores.rs +212 -0
- abap_parser-0.3.0/crates/abap-analysis/src/text.rs +814 -0
- abap_parser-0.3.0/crates/abap-analysis/src/workspace.rs +1658 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/logic_corpus.rs +16 -2
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-model/src/lib.rs +132 -4
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-source/Cargo.toml +1 -0
- abap_parser-0.3.0/crates/abap-source/src/adt.rs +1080 -0
- abap_parser-0.3.0/crates/abap-source/src/badi.rs +218 -0
- abap_parser-0.3.0/crates/abap-source/src/cache.rs +268 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-source/src/fs.rs +270 -35
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-source/src/lib.rs +229 -2
- abap_parser-0.3.0/crates/abap-sql/src/cds.rs +995 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-sql/src/lib.rs +1 -0
- abap_parser-0.3.0/crates/abap-sql/tests/cds_corpus.rs +59 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/python/abap_parser/__init__.py +40 -1
- {abap_parser-0.1.0 → abap_parser-0.3.0}/python/abap_parser/types.py +91 -6
- abap_parser-0.1.0/crates/abap-analysis/src/workspace.rs +0 -652
- abap_parser-0.1.0/crates/abap-source/src/adt.rs +0 -549
- abap_parser-0.1.0/crates/abap-source/src/cache.rs +0 -114
- {abap_parser-0.1.0 → abap_parser-0.3.0}/LICENSE +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/bindings/python/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/bindings/python/LICENSE +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/args.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/context.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/db.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/src/symbols.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/adt_mock.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/amdp_corpus.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/call_graph_corpus.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/corpus_smoke.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-analysis/tests/symbols_diff.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-lexer/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-lexer/src/lib.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-model/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-source/src/mock.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-source/src/options.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-sql/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-sql/src/hana.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-sql/src/tests.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-sql/tests/sql_diff.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/Cargo.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/classify.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/decl.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/expr.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/kind.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/lib.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/operands.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/src/structure.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/tests/abaplint_statements.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/tests/common/mod.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/tests/oracle_diff.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/crates/abap-syntax/tests/refs_diff.rs +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/pyproject.toml +0 -0
- {abap_parser-0.1.0 → abap_parser-0.3.0}/python/abap_parser/py.typed +0 -0
|
@@ -4,7 +4,7 @@ version = 4
|
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "abap-analysis"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"abap-model",
|
|
10
10
|
"abap-source",
|
|
@@ -16,7 +16,7 @@ dependencies = [
|
|
|
16
16
|
|
|
17
17
|
[[package]]
|
|
18
18
|
name = "abap-cli"
|
|
19
|
-
version = "0.
|
|
19
|
+
version = "0.3.0"
|
|
20
20
|
dependencies = [
|
|
21
21
|
"abap-analysis",
|
|
22
22
|
"abap-lexer",
|
|
@@ -28,14 +28,14 @@ dependencies = [
|
|
|
28
28
|
|
|
29
29
|
[[package]]
|
|
30
30
|
name = "abap-lexer"
|
|
31
|
-
version = "0.
|
|
31
|
+
version = "0.3.0"
|
|
32
32
|
dependencies = [
|
|
33
33
|
"serde",
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[[package]]
|
|
37
37
|
name = "abap-model"
|
|
38
|
-
version = "0.
|
|
38
|
+
version = "0.3.0"
|
|
39
39
|
dependencies = [
|
|
40
40
|
"schemars",
|
|
41
41
|
"serde",
|
|
@@ -44,7 +44,7 @@ dependencies = [
|
|
|
44
44
|
|
|
45
45
|
[[package]]
|
|
46
46
|
name = "abap-node"
|
|
47
|
-
version = "0.
|
|
47
|
+
version = "0.3.0"
|
|
48
48
|
dependencies = [
|
|
49
49
|
"abap-analysis",
|
|
50
50
|
"napi",
|
|
@@ -55,7 +55,7 @@ dependencies = [
|
|
|
55
55
|
|
|
56
56
|
[[package]]
|
|
57
57
|
name = "abap-python"
|
|
58
|
-
version = "0.
|
|
58
|
+
version = "0.3.0"
|
|
59
59
|
dependencies = [
|
|
60
60
|
"abap-analysis",
|
|
61
61
|
"pyo3",
|
|
@@ -63,16 +63,17 @@ dependencies = [
|
|
|
63
63
|
|
|
64
64
|
[[package]]
|
|
65
65
|
name = "abap-source"
|
|
66
|
-
version = "0.
|
|
66
|
+
version = "0.3.0"
|
|
67
67
|
dependencies = [
|
|
68
68
|
"base64 0.22.1",
|
|
69
69
|
"serde",
|
|
70
|
+
"serde_json",
|
|
70
71
|
"ureq",
|
|
71
72
|
]
|
|
72
73
|
|
|
73
74
|
[[package]]
|
|
74
75
|
name = "abap-sql"
|
|
75
|
-
version = "0.
|
|
76
|
+
version = "0.3.0"
|
|
76
77
|
dependencies = [
|
|
77
78
|
"abap-model",
|
|
78
79
|
"abap-syntax",
|
|
@@ -82,7 +83,7 @@ dependencies = [
|
|
|
82
83
|
|
|
83
84
|
[[package]]
|
|
84
85
|
name = "abap-syntax"
|
|
85
|
-
version = "0.
|
|
86
|
+
version = "0.3.0"
|
|
86
87
|
dependencies = [
|
|
87
88
|
"abap-lexer",
|
|
88
89
|
"serde",
|
|
@@ -3,7 +3,7 @@ resolver = "2"
|
|
|
3
3
|
members = ["crates/abap-lexer", "crates/abap-syntax", "crates/abap-model", "crates/abap-sql", "crates/abap-source", "crates/abap-analysis", "bindings/python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.3.0"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
license = "MIT"
|
|
9
9
|
repository = "https://github.com/albertlast/abapPaser"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abap-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -17,7 +17,7 @@ Project-URL: Repository, https://github.com/albertlast/abapPaser
|
|
|
17
17
|
|
|
18
18
|
# abap-parser
|
|
19
19
|
|
|
20
|
-
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API.
|
|
20
|
+
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end, also through SUBMIT, ABAP memory and files. CDS views tell their data sources and the fields of each element. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API, SAP standard code and dictionary types included.
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
pip install abap-parser
|
|
@@ -45,7 +45,12 @@ options = {
|
|
|
45
45
|
}
|
|
46
46
|
graph = abap_parser.call_graph(["CLAS:ZCL_ORDERS"], options, depth=2)
|
|
47
47
|
logic = await abap_parser.logic_object_async("PROG:ZREPORT", options)
|
|
48
|
+
# compact text, e.g. for a language model
|
|
49
|
+
prompt = abap_parser.text("logic", source)
|
|
50
|
+
outline = await abap_parser.object_text_async("symbols", ["CLAS:ZCL_ORDERS"], options)
|
|
51
|
+
# a CDS view: sources, joins, associations, the fields of each element
|
|
52
|
+
view = abap_parser.cds(open("zi_orders.ddls.asddls", encoding="utf-8").read())
|
|
48
53
|
```
|
|
49
54
|
|
|
50
|
-
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
55
|
+
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. `text` and `object_text` give a compact form instead: definitions written like ABAP, one line per call or database access, per procedure its effects with statements and conditions. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
51
56
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# abap-parser
|
|
2
2
|
|
|
3
|
-
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API.
|
|
3
|
+
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end, also through SUBMIT, ABAP memory and files. CDS views tell their data sources and the fields of each element. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API, SAP standard code and dictionary types included.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
pip install abap-parser
|
|
@@ -28,6 +28,11 @@ options = {
|
|
|
28
28
|
}
|
|
29
29
|
graph = abap_parser.call_graph(["CLAS:ZCL_ORDERS"], options, depth=2)
|
|
30
30
|
logic = await abap_parser.logic_object_async("PROG:ZREPORT", options)
|
|
31
|
+
# compact text, e.g. for a language model
|
|
32
|
+
prompt = abap_parser.text("logic", source)
|
|
33
|
+
outline = await abap_parser.object_text_async("symbols", ["CLAS:ZCL_ORDERS"], options)
|
|
34
|
+
# a CDS view: sources, joins, associations, the fields of each element
|
|
35
|
+
view = abap_parser.cds(open("zi_orders.ddls.asddls", encoding="utf-8").read())
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
38
|
+
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. `text` and `object_text` give a compact form instead: definitions written like ABAP, one line per call or database access, per procedure its effects with statements and conditions. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# abap-parser
|
|
2
2
|
|
|
3
|
-
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API.
|
|
3
|
+
Parses ABAP code and tells what it does: classes, methods, forms and declarations; which database tables a statement reads or writes; which methods, function modules and forms it calls; and the logic of each procedure, from conditions and data flow to what it writes in the end, also through SUBMIT, ABAP memory and files. CDS views tell their data sources and the fields of each element. Sources come from a folder (abapGit layout or plain `.abap` files) or from an SAP system through the ADT REST API, SAP standard code and dictionary types included.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
pip install abap-parser
|
|
@@ -28,6 +28,11 @@ options = {
|
|
|
28
28
|
}
|
|
29
29
|
graph = abap_parser.call_graph(["CLAS:ZCL_ORDERS"], options, depth=2)
|
|
30
30
|
logic = await abap_parser.logic_object_async("PROG:ZREPORT", options)
|
|
31
|
+
# compact text, e.g. for a language model
|
|
32
|
+
prompt = abap_parser.text("logic", source)
|
|
33
|
+
outline = await abap_parser.object_text_async("symbols", ["CLAS:ZCL_ORDERS"], options)
|
|
34
|
+
# a CDS view: sources, joins, associations, the fields of each element
|
|
35
|
+
view = abap_parser.cds(open("zi_orders.ddls.asddls", encoding="utf-8").read())
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
38
|
+
Every function has an `..._async` variant for asyncio; the native code releases the GIL. The results are dictionaries typed by the TypedDicts in `abap_parser.types`. `text` and `object_text` give a compact form instead: definitions written like ABAP, one line per call or database access, per procedure its effects with statements and conditions. See the [repository](https://github.com/albertlast/abapPaser) for what each result contains.
|
|
@@ -61,6 +61,29 @@ mod _native {
|
|
|
61
61
|
py.detach(|| abap_analysis::json::statements(source))
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
#[pyfunction]
|
|
65
|
+
fn cds_json(py: Python<'_>, source: &str) -> String {
|
|
66
|
+
py.detach(|| abap_analysis::json::cds(source))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#[pyfunction]
|
|
70
|
+
fn text(py: Python<'_>, analysis: &str, source: &str) -> PyResult<String> {
|
|
71
|
+
py.detach(|| abap_analysis::json::text(analysis, source))
|
|
72
|
+
.map_err(pyo3::exceptions::PyValueError::new_err)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#[pyfunction]
|
|
76
|
+
fn object_text(
|
|
77
|
+
py: Python<'_>,
|
|
78
|
+
analysis: &str,
|
|
79
|
+
objects: Vec<String>,
|
|
80
|
+
options: &str,
|
|
81
|
+
depth: u32,
|
|
82
|
+
) -> PyResult<String> {
|
|
83
|
+
py.detach(|| abap_analysis::json::object_text(analysis, &objects, options, depth))
|
|
84
|
+
.map_err(pyo3::exceptions::PyRuntimeError::new_err)
|
|
85
|
+
}
|
|
86
|
+
|
|
64
87
|
#[pyfunction]
|
|
65
88
|
fn version() -> &'static str {
|
|
66
89
|
env!("CARGO_PKG_VERSION")
|
|
@@ -102,6 +102,22 @@ class SymbolsTest(unittest.TestCase):
|
|
|
102
102
|
db = [e for e in fm["effects"] if e["scope"] == "database"]
|
|
103
103
|
self.assertTrue(db and all(e["via"] for e in db))
|
|
104
104
|
|
|
105
|
+
def test_cds(self):
|
|
106
|
+
d = abap_parser.cds("define view entity zi_c as select from t005 { key land1 as Country }")
|
|
107
|
+
self.assertEqual(d["kind"], "view entity")
|
|
108
|
+
self.assertEqual(d["elements"][0]["fields"], ["T005.LAND1"])
|
|
109
|
+
self.assertIn("key Country = T005.LAND1", abap_parser.text("cds", "define view entity zi_c as select from t005 { key land1 as Country }"))
|
|
110
|
+
|
|
111
|
+
def test_text(self):
|
|
112
|
+
t = abap_parser.text("symbols", SOURCE)
|
|
113
|
+
self.assertTrue(t.startswith('CLASS zcl_demo DEFINITION PUBLIC FINAL. " 2-7\n'), t)
|
|
114
|
+
self.assertIn(' METHODS run IMPORTING iv_id TYPE i RETURNING VALUE(rv_ok) TYPE abap_bool. " 4\n', t)
|
|
115
|
+
self.assertIn(" writes rv_ok (parameter) at 10", abap_parser.text("logic", SOURCE))
|
|
116
|
+
with self.assertRaises(ValueError):
|
|
117
|
+
abap_parser.text("nope", SOURCE)
|
|
118
|
+
with self.assertRaises(RuntimeError):
|
|
119
|
+
abap_parser.object_text("graph", ["CLAS:X"], {})
|
|
120
|
+
|
|
105
121
|
@unittest.skipUnless((CORPUS / "abapgit" / "src").exists(), "corpus submodule missing")
|
|
106
122
|
def test_real_class(self):
|
|
107
123
|
path = CORPUS / "abapgit" / "src" / "apack" / "zcl_abapgit_apack_migration.clas.abap"
|
|
@@ -119,6 +135,7 @@ class AsyncTest(unittest.IsolatedAsyncioTestCase):
|
|
|
119
135
|
self.assertEqual(await abap_parser.symbols_async(SOURCE), abap_parser.symbols(SOURCE))
|
|
120
136
|
self.assertEqual(await abap_parser.logic_async(SOURCE), abap_parser.logic(SOURCE))
|
|
121
137
|
self.assertEqual(await abap_parser.statements_async(SOURCE), abap_parser.statements(SOURCE))
|
|
138
|
+
self.assertEqual(await abap_parser.text_async("logic", SOURCE), abap_parser.text("logic", SOURCE))
|
|
122
139
|
with self.assertRaises(RuntimeError):
|
|
123
140
|
await abap_parser.call_graph_async(["CLAS:X"], {})
|
|
124
141
|
|