@abaplint/core 2.83.3 → 2.83.7
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/build/src/abap/types/method_parameters.js +4 -1
- package/build/src/cds/cds_lexer.js +22 -2
- package/build/src/cds/cds_parser.js +4 -1
- package/build/src/cds/expressions/cds_aggregate.js +13 -0
- package/build/src/cds/expressions/cds_annotation.js +2 -5
- package/build/src/cds/expressions/cds_annotation_array.js +15 -0
- package/build/src/cds/expressions/cds_annotation_object.js +16 -0
- package/build/src/cds/expressions/cds_annotation_simple.js +13 -0
- package/build/src/cds/expressions/cds_arithmetics.js +15 -0
- package/build/src/cds/expressions/cds_association.js +2 -6
- package/build/src/cds/expressions/cds_cardinality.js +12 -0
- package/build/src/cds/expressions/cds_case.js +16 -0
- package/build/src/cds/expressions/cds_cast.js +1 -1
- package/build/src/cds/expressions/cds_composition.js +13 -0
- package/build/src/cds/expressions/cds_condition.js +20 -0
- package/build/src/cds/expressions/cds_define_abstract.js +14 -0
- package/build/src/cds/expressions/cds_define_view.js +3 -1
- package/build/src/cds/expressions/cds_element.js +1 -1
- package/build/src/cds/expressions/cds_function.js +19 -2
- package/build/src/cds/expressions/cds_group_by.js +13 -0
- package/build/src/cds/expressions/cds_join.js +2 -2
- package/build/src/cds/expressions/cds_name.js +1 -1
- package/build/src/cds/expressions/cds_parameters.js +14 -0
- package/build/src/cds/expressions/cds_select.js +1 -1
- package/build/src/cds/expressions/cds_string.js +11 -0
- package/build/src/cds/expressions/cds_type.js +12 -0
- package/build/src/cds/expressions/cds_where.js +1 -4
- package/build/src/cds/expressions/cds_with_parameters.js +13 -0
- package/build/src/cds/expressions/index.js +16 -0
- package/build/src/ddl/ddl_lexer.js +1 -1
- package/build/src/objects/data_definition.js +5 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +5 -2
- package/package.json +1 -1
|
@@ -105,10 +105,13 @@ class MethodParameters {
|
|
|
105
105
|
const nameToken = (_a = node.findFirstExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
106
106
|
const ooName = nameToken === null || nameToken === void 0 ? void 0 : nameToken.getStr();
|
|
107
107
|
const def = scope.findObjectDefinition(ooName);
|
|
108
|
+
const doVoid = def ? false : !scope.getDDIC().inErrorNamespace(ooName);
|
|
108
109
|
if (def) {
|
|
109
110
|
scope.addReference(nameToken, def, _reference_1.ReferenceType.ObjectOrientedReference, filename);
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
else if (doVoid && ooName) {
|
|
113
|
+
scope.addReference(nameToken, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: ooName.toUpperCase() });
|
|
114
|
+
}
|
|
112
115
|
const eventName = (_b = node.findFirstExpression(Expressions.Field)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
113
116
|
const event = new _object_oriented_1.ObjectOriented(scope).searchEvent(def, eventName);
|
|
114
117
|
for (const p of handler.findAllExpressions(Expressions.MethodParamName)) {
|
|
@@ -50,11 +50,14 @@ class CDSLexer {
|
|
|
50
50
|
let row = 1;
|
|
51
51
|
let col = 1;
|
|
52
52
|
let build = "";
|
|
53
|
-
const stream = new Stream(file.getRaw());
|
|
53
|
+
const stream = new Stream(file.getRaw().replace(/\r/g, "").replace(/\u00a0/g, " "));
|
|
54
|
+
let next = "";
|
|
54
55
|
while (stream.length() > 0) {
|
|
55
|
-
const
|
|
56
|
+
const prev = next;
|
|
57
|
+
next = stream.takeNext();
|
|
56
58
|
const nextNext = stream.peekNext();
|
|
57
59
|
col++;
|
|
60
|
+
// string handling
|
|
58
61
|
if (mode === Mode.String) {
|
|
59
62
|
build += next;
|
|
60
63
|
if (next === "'") {
|
|
@@ -63,6 +66,7 @@ class CDSLexer {
|
|
|
63
66
|
}
|
|
64
67
|
continue;
|
|
65
68
|
}
|
|
69
|
+
// single line comment handling
|
|
66
70
|
if (mode === Mode.SingleLineComment) {
|
|
67
71
|
if (next === "\n") {
|
|
68
72
|
mode = Mode.Default;
|
|
@@ -74,6 +78,18 @@ class CDSLexer {
|
|
|
74
78
|
build = result.add(build, row, col);
|
|
75
79
|
continue;
|
|
76
80
|
}
|
|
81
|
+
// multi line comment handling
|
|
82
|
+
if (mode === Mode.MultiLineComment) {
|
|
83
|
+
if (prev === "*" && next === "/") {
|
|
84
|
+
mode = Mode.Default;
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
else if (mode === Mode.Default && next === "/" && nextNext === "*") {
|
|
89
|
+
mode = Mode.MultiLineComment;
|
|
90
|
+
build = result.add(build, row, col);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
77
93
|
switch (next) {
|
|
78
94
|
case "'":
|
|
79
95
|
mode = Mode.String;
|
|
@@ -97,6 +113,10 @@ class CDSLexer {
|
|
|
97
113
|
case ")":
|
|
98
114
|
case "[":
|
|
99
115
|
case "]":
|
|
116
|
+
case "+":
|
|
117
|
+
case "-":
|
|
118
|
+
case "*":
|
|
119
|
+
case "/":
|
|
100
120
|
build = result.add(build, row, col);
|
|
101
121
|
result.add(next, row, col);
|
|
102
122
|
break;
|
|
@@ -14,7 +14,10 @@ class CDSParser {
|
|
|
14
14
|
}
|
|
15
15
|
const tokens = cds_lexer_1.CDSLexer.run(file);
|
|
16
16
|
// console.dir(tokens);
|
|
17
|
-
|
|
17
|
+
let res = combi_1.Combi.run(new Expressions.CDSDefineView(), tokens, version_1.defaultVersion);
|
|
18
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
19
|
+
res = combi_1.Combi.run(new Expressions.CDSDefineAbstract(), tokens, version_1.defaultVersion);
|
|
20
|
+
}
|
|
18
21
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
19
22
|
return undefined;
|
|
20
23
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAggregate = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSAggregate extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const value = (0, combi_1.alt)(_1.CDSName, _1.CDSCast, _1.CDSCase);
|
|
9
|
+
return (0, combi_1.seq)((0, combi_1.alt)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.opt)("DISTINCT"), value, ")");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSAggregate = CDSAggregate;
|
|
13
|
+
//# sourceMappingURL=cds_aggregate.js.map
|
|
@@ -3,13 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSAnnotation = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_annotation_array_1 = require("./cds_annotation_array");
|
|
6
7
|
class CDSAnnotation extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
|
-
|
|
9
|
-
const value = (0, combi_1.alt)((0, combi_1.regex)(/^'[\w ]+'$/), "true", "false", (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^#\w+$/));
|
|
10
|
-
const valueList = (0, combi_1.seq)("[", value, (0, combi_1.star)((0, combi_1.seq)(",", value)), "]");
|
|
11
|
-
const valueNested = (0, combi_1.seq)("{", _1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)), ":", value, "}");
|
|
12
|
-
return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.star)((0, combi_1.seq)(".", (0, combi_1.regex)(/^\w+$/))), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(valueList, valueNested, value)));
|
|
9
|
+
return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.star)((0, combi_1.seq)(".", (0, combi_1.regex)(/^\w+$/))), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(cds_annotation_array_1.CDSAnnotationArray, _1.CDSAnnotationObject, _1.CDSAnnotationSimple)));
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
12
|
exports.CDSAnnotation = CDSAnnotation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAnnotationArray = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_annotation_simple_1 = require("./cds_annotation_simple");
|
|
7
|
+
class CDSAnnotationArray extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const value = (0, combi_1.alt)(cds_annotation_simple_1.CDSAnnotationSimple, _1.CDSAnnotationObject, CDSAnnotationArray);
|
|
10
|
+
const valueList = (0, combi_1.seq)("[", value, (0, combi_1.star)((0, combi_1.seq)(",", value)), "]");
|
|
11
|
+
return valueList;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CDSAnnotationArray = CDSAnnotationArray;
|
|
15
|
+
//# sourceMappingURL=cds_annotation_array.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAnnotationObject = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_annotation_simple_1 = require("./cds_annotation_simple");
|
|
7
|
+
class CDSAnnotationObject extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const value = (0, combi_1.alt)(CDSAnnotationObject, _1.CDSAnnotationArray, cds_annotation_simple_1.CDSAnnotationSimple);
|
|
10
|
+
const namedot = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
|
|
11
|
+
const valueNested = (0, combi_1.seq)("{", namedot, ":", value, (0, combi_1.star)((0, combi_1.seq)(",", namedot, ":", value)), "}");
|
|
12
|
+
return valueNested;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CDSAnnotationObject = CDSAnnotationObject;
|
|
16
|
+
//# sourceMappingURL=cds_annotation_object.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAnnotationSimple = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSAnnotationSimple extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const value = (0, combi_1.alt)(_1.CDSString, "true", "false", (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^#[\w_]+$/));
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSAnnotationSimple = CDSAnnotationSimple;
|
|
13
|
+
//# sourceMappingURL=cds_annotation_simple.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSArithmetics = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSArithmetics extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
+
const val = (0, combi_1.alt)((0, combi_1.regex)(/\d+/), name, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString);
|
|
10
|
+
const operator = (0, combi_1.alt)("+", "-", "*", "/");
|
|
11
|
+
return (0, combi_1.seq)(val, operator, val);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CDSArithmetics = CDSArithmetics;
|
|
15
|
+
//# sourceMappingURL=cds_arithmetics.js.map
|
|
@@ -3,14 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSAssociation = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_cardinality_1 = require("./cds_cardinality");
|
|
6
7
|
class CDSAssociation extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
|
-
|
|
9
|
-
const as = (0, combi_1.seq)("AS", _1.CDSName);
|
|
10
|
-
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.plus)((0, combi_1.seq)(".", _1.CDSName)));
|
|
11
|
-
const cond = (0, combi_1.seq)(name, "=", name);
|
|
12
|
-
const and = (0, combi_1.seq)("AND", cond);
|
|
13
|
-
return (0, combi_1.seq)("ASSOCIATION", cardinality, "TO", _1.CDSName, (0, combi_1.opt)(as), "ON", cond, (0, combi_1.star)(and));
|
|
9
|
+
return (0, combi_1.seq)("ASSOCIATION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "TO", (0, combi_1.opt)("PARENT"), _1.CDSName, (0, combi_1.opt)(_1.CDSAs), "ON", _1.CDSCondition);
|
|
14
10
|
}
|
|
15
11
|
}
|
|
16
12
|
exports.CDSAssociation = CDSAssociation;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSCardinality = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
class CDSCardinality extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
const cardinality = (0, combi_1.seq)("[", (0, combi_1.alt)("0", "1"), (0, combi_1.opt)((0, combi_1.seq)(".", ".", (0, combi_1.alt)("0", "1", "*"))), "]");
|
|
8
|
+
return cardinality;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSCardinality = CDSCardinality;
|
|
12
|
+
//# sourceMappingURL=cds_cardinality.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSCase = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSCase extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
+
const value = (0, combi_1.alt)(name, _1.CDSString, _1.CDSFunction, CDSCase, _1.CDSCast, _1.CDSArithmetics);
|
|
10
|
+
const simple = (0, combi_1.seq)("CASE", name, (0, combi_1.plus)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value, "END");
|
|
11
|
+
const complex = (0, combi_1.seq)("CASE", (0, combi_1.plus)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.opt)((0, combi_1.seq)("ELSE", value)), "END");
|
|
12
|
+
return (0, combi_1.alt)(simple, complex);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CDSCase = CDSCase;
|
|
16
|
+
//# sourceMappingURL=cds_case.js.map
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
class CDSCast extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
-
return (0, combi_1.seq)("CAST", "(", (0, combi_1.alt)(name, _1.CDSFunction), "AS", _1.
|
|
9
|
+
return (0, combi_1.seq)("CAST", "(", (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSCase, CDSCast, _1.CDSString, _1.CDSArithmetics), "AS", _1.CDSType, (0, combi_1.opt)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.CDSCast = CDSCast;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSComposition = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_cardinality_1 = require("./cds_cardinality");
|
|
7
|
+
class CDSComposition extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
return (0, combi_1.seq)("COMPOSITION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "OF", _1.CDSName, (0, combi_1.opt)(_1.CDSAs));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSComposition = CDSComposition;
|
|
13
|
+
//# sourceMappingURL=cds_composition.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSCondition = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSCondition extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", (0, combi_1.alt)(_1.CDSName, _1.CDSString))));
|
|
9
|
+
const eq = (0, combi_1.seq)(name, (0, combi_1.alt)("=", "<>", "<", ">", ">=", "<=", "LIKE"), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));
|
|
10
|
+
const isInitial = (0, combi_1.seq)(name, "IS INITIAL");
|
|
11
|
+
const isNotInitial = (0, combi_1.seq)(name, "IS NOT INITIAL");
|
|
12
|
+
const isNull = (0, combi_1.seq)(name, "IS NULL");
|
|
13
|
+
const isNotNull = (0, combi_1.seq)(name, "IS NOT NULL");
|
|
14
|
+
const condition = (0, combi_1.alt)(eq, isNull, isNotNull, isInitial, isNotInitial);
|
|
15
|
+
const paren = (0, combi_1.seq)("(", CDSCondition, ")");
|
|
16
|
+
return (0, combi_1.seq)((0, combi_1.alt)(condition, paren), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.alt)("AND", "OR"), (0, combi_1.alt)(condition, paren))));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CDSCondition = CDSCondition;
|
|
20
|
+
//# sourceMappingURL=cds_condition.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDefineAbstract = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_name_1 = require("./cds_name");
|
|
7
|
+
class CDSDefineAbstract extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("KEY"), cds_name_1.CDSName, ":", cds_name_1.CDSName, ";");
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE ABSTRACT ENTITY"), cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)(field), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CDSDefineAbstract = CDSDefineAbstract;
|
|
14
|
+
//# sourceMappingURL=cds_define_abstract.js.map
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CDSDefineView = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
|
+
const __1 = require("../..");
|
|
5
6
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
7
|
const cds_name_1 = require("./cds_name");
|
|
7
8
|
const cds_select_1 = require("./cds_select");
|
|
9
|
+
const cds_with_parameters_1 = require("./cds_with_parameters");
|
|
8
10
|
class CDSDefineView extends combi_1.Expression {
|
|
9
11
|
getRunnable() {
|
|
10
|
-
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.
|
|
12
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "VIEW", (0, combi_1.ver)(__1.Version.v755, (0, combi_1.opt)("ENTITY")), cds_name_1.CDSName, (0, combi_1.opt)(cds_with_parameters_1.CDSWithParameters), "AS", cds_select_1.CDSSelect, (0, combi_1.opt)(";"));
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
exports.CDSDefineView = CDSDefineView;
|
|
@@ -7,7 +7,7 @@ const cds_as_1 = require("./cds_as");
|
|
|
7
7
|
const cds_cast_1 = require("./cds_cast");
|
|
8
8
|
class CDSElement extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
|
-
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.alt)(_1.CDSName, cds_cast_1.CDSCast), (0, combi_1.
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.alt)((0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters)))), cds_cast_1.CDSCast, _1.CDSAggregate, _1.CDSString, _1.CDSFunction, (0, combi_1.regex)(/^\d+$/), _1.CDSArithmetics, _1.CDSCase), (0, combi_1.opt)(cds_as_1.CDSAs));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.CDSElement = CDSElement;
|
|
@@ -5,12 +5,29 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSFunction extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
const
|
|
8
|
+
const qualified = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters))));
|
|
9
|
+
const input = (0, combi_1.alt)(qualified, (0, combi_1.regex)(/^\d+$/), _1.CDSCast, CDSFunction, _1.CDSArithmetics, _1.CDSCase, _1.CDSString);
|
|
9
10
|
const coalesce = (0, combi_1.seq)("COALESCE", "(", input, ",", input, ")");
|
|
10
11
|
const concat = (0, combi_1.seq)("CONCAT", "(", input, ",", input, ")");
|
|
11
12
|
const concat_with_space = (0, combi_1.seq)("CONCAT_WITH_SPACE", "(", input, ",", input, ",", input, ")");
|
|
13
|
+
const dats_add_days = (0, combi_1.seq)("DATS_ADD_DAYS", "(", input, ",", input, ",", input, ")");
|
|
14
|
+
const dats_add_months = (0, combi_1.seq)("DATS_ADD_MONTHS", "(", input, ",", input, ",", input, ")");
|
|
15
|
+
const dats_days_between = (0, combi_1.seq)("DATS_DAYS_BETWEEN", "(", input, ",", input, ")");
|
|
16
|
+
const dats_is_valid = (0, combi_1.seq)("DATS_IS_VALID", "(", input, ")");
|
|
12
17
|
const substring = (0, combi_1.seq)("SUBSTRING", "(", input, ",", input, ",", input, ")");
|
|
13
|
-
|
|
18
|
+
const bintohex = (0, combi_1.seq)("BINTOHEX", "(", input, ")");
|
|
19
|
+
const hextobin = (0, combi_1.seq)("HEXTOBIN", "(", input, ")");
|
|
20
|
+
const tstmp_to_dats = (0, combi_1.seq)("TSTMP_TO_DATS", "(", input, ",", input, ",", input, ",", input, ")");
|
|
21
|
+
const tstmp_to_tims = (0, combi_1.seq)("TSTMP_TO_TIMS", "(", input, ",", input, ",", input, ",", input, ")");
|
|
22
|
+
const tstmp_to_dst = (0, combi_1.seq)("TSTMP_TO_DST", "(", input, ",", input, ",", input, ",", input, ")");
|
|
23
|
+
const dats_tims_to_tstmp = (0, combi_1.seq)("DATS_TIMS_TO_TSTMP", "(", input, ",", input, ",", input, ",", input, ",", input, ")");
|
|
24
|
+
const tstmp_is_valid = (0, combi_1.seq)("TSTMP_IS_VALID", "(", input, ")");
|
|
25
|
+
const tstmp_current_utctimestamp = (0, combi_1.seq)("TSTMP_CURRENT_UTCTIMESTAMP", "(", ")");
|
|
26
|
+
const tstmp_seconds_between = (0, combi_1.seq)("TSTMP_SECONDS_BETWEEN", "(", input, ",", input, ",", input, ")");
|
|
27
|
+
const tstmp_add_seconds = (0, combi_1.seq)("TSTMP_ADD_SECONDS", "(", input, ",", input, ",", input, ")");
|
|
28
|
+
const abap_system_timezone = (0, combi_1.seq)("ABAP_SYSTEM_TIMEZONE", "(", input, ",", input, ")");
|
|
29
|
+
const abap_user_timezone = (0, combi_1.seq)("ABAP_USER_TIMEZONE", "(", input, ",", input, ",", input, ")");
|
|
30
|
+
return (0, combi_1.alt)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp);
|
|
14
31
|
}
|
|
15
32
|
}
|
|
16
33
|
exports.CDSFunction = CDSFunction;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSGroupBy = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSGroupBy extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
+
return (0, combi_1.seq)("GROUP BY", name, (0, combi_1.star)((0, combi_1.seq)(",", name)));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSGroupBy = CDSGroupBy;
|
|
13
|
+
//# sourceMappingURL=cds_group_by.js.map
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSJoin = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_condition_1 = require("./cds_condition");
|
|
6
7
|
class CDSJoin extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
|
-
|
|
9
|
-
return (0, combi_1.seq)("INNER JOIN", _1.CDSSource, "ON", name, "=", name);
|
|
9
|
+
return (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("INNER", "LEFT OUTER", "LEFT OUTER TO ONE")), "JOIN", _1.CDSSource, "ON", cds_condition_1.CDSCondition);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.CDSJoin = CDSJoin;
|
|
@@ -4,7 +4,7 @@ exports.CDSName = void 0;
|
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
class CDSName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
7
|
+
return (0, combi_1.seq)((0, combi_1.opt)(":"), (0, combi_1.regex)(/^\$?#?[\w_]+$/));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.CDSName = CDSName;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSParameters = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSParameters extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
+
const value = (0, combi_1.alt)(name, _1.CDSString);
|
|
10
|
+
return (0, combi_1.seq)("[", (0, combi_1.regex)(/\d+/), ":", name, "=", value, (0, combi_1.star)((0, combi_1.seq)("AND", name, "=", value)), "]");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CDSParameters = CDSParameters;
|
|
14
|
+
//# sourceMappingURL=cds_parameters.js.map
|
|
@@ -8,7 +8,7 @@ const cds_element_1 = require("./cds_element");
|
|
|
8
8
|
const cds_join_1 = require("./cds_join");
|
|
9
9
|
class CDSSelect extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
|
-
return (0, combi_1.seq)((0, combi_1.
|
|
11
|
+
return (0, combi_1.seq)("SELECT", (0, combi_1.opt)("DISTINCT"), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.star)(cds_association_1.CDSAssociation), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.str)("{"), (0, combi_1.plus)(cds_element_1.CDSElement), (0, combi_1.star)((0, combi_1.seq)(",", cds_element_1.CDSElement)), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSGroupBy), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), CDSSelect)));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.CDSSelect = CDSSelect;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSString = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
class CDSString extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
return (0, combi_1.regex)(/^'[\w: -_]*'$/);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CDSString = CDSString;
|
|
11
|
+
//# sourceMappingURL=cds_string.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSType = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSType extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("(", (0, combi_1.regex)(/\d+/), ")")));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSType = CDSType;
|
|
12
|
+
//# sourceMappingURL=cds_type.js.map
|
|
@@ -5,10 +5,7 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSWhere extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
|
|
9
|
-
const field = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
|
|
10
|
-
const condition = (0, combi_1.seq)(field, "=", (0, combi_1.alt)(constant, field));
|
|
11
|
-
return (0, combi_1.seq)("WHERE", condition, (0, combi_1.star)((0, combi_1.seq)("AND", condition)));
|
|
8
|
+
return (0, combi_1.seq)("WHERE", _1.CDSCondition);
|
|
12
9
|
}
|
|
13
10
|
}
|
|
14
11
|
exports.CDSWhere = CDSWhere;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSWithParameters = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSWithParameters extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const param = (0, combi_1.seq)(_1.CDSName, ":", _1.CDSType);
|
|
9
|
+
return (0, combi_1.seq)("wITH PARAMETERS", param, (0, combi_1.star)((0, combi_1.seq)(",", param)));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSWithParameters = CDSWithParameters;
|
|
13
|
+
//# sourceMappingURL=cds_with_parameters.js.map
|
|
@@ -10,16 +10,32 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./cds_aggregate"), exports);
|
|
14
|
+
__exportStar(require("./cds_aggregate"), exports);
|
|
15
|
+
__exportStar(require("./cds_annotation_array"), exports);
|
|
16
|
+
__exportStar(require("./cds_annotation_object"), exports);
|
|
17
|
+
__exportStar(require("./cds_annotation_simple"), exports);
|
|
13
18
|
__exportStar(require("./cds_annotation"), exports);
|
|
19
|
+
__exportStar(require("./cds_arithmetics"), exports);
|
|
14
20
|
__exportStar(require("./cds_as"), exports);
|
|
15
21
|
__exportStar(require("./cds_association"), exports);
|
|
22
|
+
__exportStar(require("./cds_cardinality"), exports);
|
|
23
|
+
__exportStar(require("./cds_case"), exports);
|
|
16
24
|
__exportStar(require("./cds_cast"), exports);
|
|
25
|
+
__exportStar(require("./cds_composition"), exports);
|
|
26
|
+
__exportStar(require("./cds_condition"), exports);
|
|
27
|
+
__exportStar(require("./cds_define_abstract"), exports);
|
|
17
28
|
__exportStar(require("./cds_define_view"), exports);
|
|
18
29
|
__exportStar(require("./cds_element"), exports);
|
|
19
30
|
__exportStar(require("./cds_function"), exports);
|
|
31
|
+
__exportStar(require("./cds_group_by"), exports);
|
|
20
32
|
__exportStar(require("./cds_join"), exports);
|
|
21
33
|
__exportStar(require("./cds_name"), exports);
|
|
34
|
+
__exportStar(require("./cds_parameters"), exports);
|
|
22
35
|
__exportStar(require("./cds_select"), exports);
|
|
23
36
|
__exportStar(require("./cds_source"), exports);
|
|
37
|
+
__exportStar(require("./cds_string"), exports);
|
|
38
|
+
__exportStar(require("./cds_type"), exports);
|
|
24
39
|
__exportStar(require("./cds_where"), exports);
|
|
40
|
+
__exportStar(require("./cds_with_parameters"), exports);
|
|
25
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,7 @@ const position_1 = require("../position");
|
|
|
6
6
|
class DDLLexer {
|
|
7
7
|
static run(file) {
|
|
8
8
|
const step1 = [];
|
|
9
|
-
const lines = file.getRaw().replace(/\
|
|
9
|
+
const lines = file.getRaw().replace(/\r/g, "").split("\n");
|
|
10
10
|
for (const l of lines) {
|
|
11
11
|
if (l.startsWith("@")) {
|
|
12
12
|
continue; // skip annotations for now
|
|
@@ -66,6 +66,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
66
66
|
if (this.isDirty() === false) {
|
|
67
67
|
return { updated: false, runtime: 0 };
|
|
68
68
|
}
|
|
69
|
+
const start = Date.now();
|
|
69
70
|
this.sqlViewName = undefined;
|
|
70
71
|
const match = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw().match(/@AbapCatalog\.sqlViewName: '(\w+)'/);
|
|
71
72
|
if (match) {
|
|
@@ -79,8 +80,9 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
79
80
|
else {
|
|
80
81
|
this.parserError = true;
|
|
81
82
|
}
|
|
83
|
+
const end = Date.now();
|
|
82
84
|
this.dirty = false;
|
|
83
|
-
return { updated: true, runtime:
|
|
85
|
+
return { updated: true, runtime: end - start };
|
|
84
86
|
}
|
|
85
87
|
findFieldNames(tree) {
|
|
86
88
|
var _a;
|
|
@@ -88,7 +90,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
88
90
|
for (const e of tree.findAllExpressions(expressions_1.CDSElement)) {
|
|
89
91
|
let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
|
|
90
92
|
if (found === undefined) {
|
|
91
|
-
|
|
93
|
+
const list = e.findDirectExpressions(expressions_1.CDSName);
|
|
94
|
+
found = list[list.length - 1];
|
|
92
95
|
}
|
|
93
96
|
if (found === undefined) {
|
|
94
97
|
continue;
|
package/build/src/registry.js
CHANGED
|
@@ -17,7 +17,9 @@ class SevenBitAscii {
|
|
|
17
17
|
key: "7bit_ascii",
|
|
18
18
|
title: "Check for 7bit ascii",
|
|
19
19
|
shortDescription: `Only allow characters from the 7bit ASCII set.`,
|
|
20
|
-
extendedInformation: `https://docs.abapopenchecks.org/checks/05
|
|
20
|
+
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
|
+
|
|
22
|
+
Checkes files with extension ".abap" and ".asddls"`,
|
|
21
23
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -33,7 +35,8 @@ class SevenBitAscii {
|
|
|
33
35
|
run(obj) {
|
|
34
36
|
const output = [];
|
|
35
37
|
for (const file of obj.getFiles()) {
|
|
36
|
-
|
|
38
|
+
const filename = file.getFilename();
|
|
39
|
+
if (filename.endsWith(".abap") || filename.endsWith(".asddls")) {
|
|
37
40
|
const rows = file.getRawRows();
|
|
38
41
|
for (let i = 0; i < rows.length; i++) {
|
|
39
42
|
const found = /[\u007f-\uffff]/.exec(rows[i]);
|