@abaplint/core 2.91.31 → 2.91.34
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/abaplint.d.ts +6 -1
- package/build/src/abap/2_statements/combi.js +52 -17
- package/build/src/abap/2_statements/expressions/component_cond.js +1 -3
- package/build/src/abap/2_statements/expressions/component_cond_sub.js +14 -0
- package/build/src/abap/2_statements/expressions/index.js +1 -0
- package/build/src/abap/2_statements/expressions/sql_client.js +1 -2
- package/build/src/abap/2_statements/expressions/type_table.js +2 -0
- package/build/src/abap/2_statements/expressions/type_table_key.js +2 -1
- package/build/src/abap/2_statements/statements/insert_internal.js +4 -3
- package/build/src/abap/2_statements/statements/loop.js +1 -1
- package/build/src/abap/2_statements/statements/read_table.js +2 -1
- package/build/src/abap/5_syntax/expressions/component_cond.js +5 -2
- package/build/src/abap/5_syntax/expressions/type_table_key.js +1 -1
- package/build/src/abap/5_syntax/statements/append.js +2 -2
- package/build/src/abap/5_syntax/statements/insert_field_group.js +21 -0
- package/build/src/abap/5_syntax/syntax.js +2 -0
- package/build/src/cds/expressions/cds_condition.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +18 -6
- package/build/src/rules/many_parentheses.js +21 -7
- package/build/src/rules/parser_missing_space.js +25 -9
- package/package.json +3 -3
package/build/abaplint.d.ts
CHANGED
|
@@ -975,6 +975,10 @@ declare class ComponentCond extends Expression {
|
|
|
975
975
|
getRunnable(): IStatementRunnable;
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
+
declare class ComponentCondSub extends Expression {
|
|
979
|
+
getRunnable(): IStatementRunnable;
|
|
980
|
+
}
|
|
981
|
+
|
|
978
982
|
declare class ComponentName extends Expression {
|
|
979
983
|
getRunnable(): IStatementRunnable;
|
|
980
984
|
}
|
|
@@ -1815,6 +1819,7 @@ declare namespace Expressions {
|
|
|
1815
1819
|
ComponentCompareSimple,
|
|
1816
1820
|
ComponentCompare,
|
|
1817
1821
|
ComponentCond,
|
|
1822
|
+
ComponentCondSub,
|
|
1818
1823
|
ComponentName,
|
|
1819
1824
|
ConcatenatedConstant,
|
|
1820
1825
|
CondBody,
|
|
@@ -2623,7 +2628,7 @@ export declare interface IConfig {
|
|
|
2623
2628
|
rules: any;
|
|
2624
2629
|
}
|
|
2625
2630
|
|
|
2626
|
-
declare interface IConfiguration {
|
|
2631
|
+
export declare interface IConfiguration {
|
|
2627
2632
|
getEnabledRules(): IRule[];
|
|
2628
2633
|
get(): IConfig;
|
|
2629
2634
|
getGlobal(): IGlobalConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.failStar = exports.failCombinator = exports.verNot = exports.ver = exports.plusPrio = exports.plus = exports.starPrio = exports.star = exports.per = exports.optPrio = exports.opt = exports.altPrio = exports.alt = exports.seq = exports.tok = exports.regex = exports.str = exports.Combi = exports.Expression = void 0;
|
|
4
4
|
const Tokens = require("../1_lexer/tokens");
|
|
5
5
|
const nodes_1 = require("../nodes");
|
|
6
6
|
const version_1 = require("../../version");
|
|
@@ -270,15 +270,23 @@ class Star {
|
|
|
270
270
|
}
|
|
271
271
|
run(r) {
|
|
272
272
|
const result = r;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
273
|
+
try {
|
|
274
|
+
let res = r;
|
|
275
|
+
let input = [];
|
|
276
|
+
for (;;) {
|
|
277
|
+
input = res;
|
|
278
|
+
res = this.sta.run(input);
|
|
279
|
+
if (res.length === 0) {
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
result.push(...res);
|
|
280
283
|
}
|
|
281
|
-
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
if (err instanceof FailStarError) {
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
throw err;
|
|
282
290
|
}
|
|
283
291
|
// console.dir(result);
|
|
284
292
|
return result;
|
|
@@ -572,9 +580,32 @@ class Permutation {
|
|
|
572
580
|
return [""];
|
|
573
581
|
}
|
|
574
582
|
}
|
|
575
|
-
class
|
|
583
|
+
class FailCombinatorError extends Error {
|
|
584
|
+
}
|
|
585
|
+
class FailStarError extends Error {
|
|
586
|
+
}
|
|
587
|
+
class FailCombinator {
|
|
588
|
+
listKeywords() {
|
|
589
|
+
return [];
|
|
590
|
+
}
|
|
591
|
+
getUsing() {
|
|
592
|
+
return [];
|
|
593
|
+
}
|
|
594
|
+
run(_r) {
|
|
595
|
+
throw new FailCombinatorError();
|
|
596
|
+
}
|
|
597
|
+
railroad() {
|
|
598
|
+
return "Railroad.Terminal('!FailCombinator')";
|
|
599
|
+
}
|
|
600
|
+
toStr() {
|
|
601
|
+
return "fail()";
|
|
602
|
+
}
|
|
603
|
+
first() {
|
|
604
|
+
return [];
|
|
605
|
+
}
|
|
576
606
|
}
|
|
577
|
-
|
|
607
|
+
// Note that Plus is implemented with Star
|
|
608
|
+
class FailStar {
|
|
578
609
|
listKeywords() {
|
|
579
610
|
return [];
|
|
580
611
|
}
|
|
@@ -582,10 +613,10 @@ class Fail {
|
|
|
582
613
|
return [];
|
|
583
614
|
}
|
|
584
615
|
run(_r) {
|
|
585
|
-
throw new
|
|
616
|
+
throw new FailStarError();
|
|
586
617
|
}
|
|
587
618
|
railroad() {
|
|
588
|
-
return "Railroad.Terminal('!
|
|
619
|
+
return "Railroad.Terminal('!FailStar')";
|
|
589
620
|
}
|
|
590
621
|
toStr() {
|
|
591
622
|
return "fail()";
|
|
@@ -749,7 +780,7 @@ class Combi {
|
|
|
749
780
|
}
|
|
750
781
|
}
|
|
751
782
|
catch (err) {
|
|
752
|
-
if (err instanceof
|
|
783
|
+
if (err instanceof FailCombinatorError) {
|
|
753
784
|
return undefined;
|
|
754
785
|
}
|
|
755
786
|
throw err;
|
|
@@ -854,8 +885,12 @@ function verNot(version, first) {
|
|
|
854
885
|
return new VersNot(version, map(first));
|
|
855
886
|
}
|
|
856
887
|
exports.verNot = verNot;
|
|
857
|
-
function
|
|
858
|
-
return new
|
|
888
|
+
function failCombinator() {
|
|
889
|
+
return new FailCombinator();
|
|
890
|
+
}
|
|
891
|
+
exports.failCombinator = failCombinator;
|
|
892
|
+
function failStar() {
|
|
893
|
+
return new FailStar();
|
|
859
894
|
}
|
|
860
|
-
exports.
|
|
895
|
+
exports.failStar = failStar;
|
|
861
896
|
//# sourceMappingURL=combi.js.map
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentCond = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
|
-
const tokens_1 = require("../../1_lexer/tokens");
|
|
6
5
|
const _1 = require(".");
|
|
7
6
|
class ComponentCond extends combi_1.Expression {
|
|
8
7
|
getRunnable() {
|
|
9
8
|
const operator = (0, combi_1.alt)("AND", "OR");
|
|
10
|
-
const
|
|
11
|
-
const cnd = (0, combi_1.alt)(_1.ComponentCompare, another);
|
|
9
|
+
const cnd = (0, combi_1.alt)(_1.ComponentCompare, _1.ComponentCondSub);
|
|
12
10
|
const ret = (0, combi_1.seq)(cnd, (0, combi_1.star)((0, combi_1.seq)(operator, cnd)));
|
|
13
11
|
return ret;
|
|
14
12
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentCondSub = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const tokens_1 = require("../../1_lexer/tokens");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
class ComponentCondSub extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const another = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.ComponentCond, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
|
|
10
|
+
return another;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ComponentCondSub = ComponentCondSub;
|
|
14
|
+
//# sourceMappingURL=component_cond_sub.js.map
|
|
@@ -40,6 +40,7 @@ __exportStar(require("./component_chain"), exports);
|
|
|
40
40
|
__exportStar(require("./component_compare_simple"), exports);
|
|
41
41
|
__exportStar(require("./component_compare"), exports);
|
|
42
42
|
__exportStar(require("./component_cond"), exports);
|
|
43
|
+
__exportStar(require("./component_cond_sub"), exports);
|
|
43
44
|
__exportStar(require("./component_name"), exports);
|
|
44
45
|
__exportStar(require("./concatenated_constant"), exports);
|
|
45
46
|
__exportStar(require("./cond_body"), exports);
|
|
@@ -6,8 +6,7 @@ const combi_1 = require("../combi");
|
|
|
6
6
|
const sql_source_simple_1 = require("./sql_source_simple");
|
|
7
7
|
class SQLClient extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
|
-
|
|
10
|
-
const client = (0, combi_1.alt)("CLIENT SPECIFIED", (0, combi_1.seq)("USING", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CLIENT", sql_source_simple_1.SQLSourceSimple)), (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("CLIENTS IN", (0, combi_1.alt)(sql_source_simple_1.SQLSourceSimple, "T000"))), (0, combi_1.ver)(version_1.Version.v754, "ALL CLIENTS"))));
|
|
9
|
+
const client = (0, combi_1.alt)((0, combi_1.verNot)(version_1.Version.Cloud, "CLIENT SPECIFIED"), (0, combi_1.seq)("USING", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CLIENT", sql_source_simple_1.SQLSourceSimple)), (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("CLIENTS IN", (0, combi_1.alt)(sql_source_simple_1.SQLSourceSimple, "T000"))), (0, combi_1.ver)(version_1.Version.v754, "ALL CLIENTS"))));
|
|
11
10
|
return client;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
@@ -14,6 +14,8 @@ class TypeTable extends combi_1.Expression {
|
|
|
14
14
|
const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE OF", (0, combi_1.optPrio)("REF TO"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));
|
|
15
15
|
const rangeType = (0, combi_1.seq)("RANGE OF", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
|
|
16
16
|
const rangeLike = (0, combi_1.seq)("RANGE OF", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
|
|
17
|
+
// a maximum of 15 secondary table keys can be defined
|
|
18
|
+
// "WITH" is not allowed as a field name in keys
|
|
17
19
|
const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));
|
|
18
20
|
const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
|
|
19
21
|
const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("CREATE", "FAILED", "LOCK", "ACTION IMPORT", "UPDATE", "READ RESULT", "ACTION RESULT"), _1.TypeName));
|
|
@@ -9,7 +9,8 @@ class TypeTableKey extends combi_1.Expression {
|
|
|
9
9
|
const uniqueness = (0, combi_1.alt)("NON-UNIQUE", "UNIQUE");
|
|
10
10
|
const defaultKey = "DEFAULT KEY";
|
|
11
11
|
const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
|
|
12
|
-
const
|
|
12
|
+
const components = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)("WITH", (0, combi_1.failStar)()), _1.FieldSub));
|
|
13
|
+
const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", components), components))), (0, combi_1.optPrio)("READ-ONLY"));
|
|
13
14
|
return key;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -11,11 +11,12 @@ class InsertInternal {
|
|
|
11
11
|
const ref = (0, combi_1.seq)("REFERENCE INTO", expressions_1.Target);
|
|
12
12
|
const index = (0, combi_1.seq)("INDEX", expressions_1.Source);
|
|
13
13
|
const initial = (0, combi_1.str)("INITIAL LINE");
|
|
14
|
-
const into = (0, combi_1.seq)("INTO",
|
|
14
|
+
const into = (0, combi_1.seq)("INTO", expressions_1.Target);
|
|
15
|
+
const intoTable = (0, combi_1.seq)("INTO TABLE", expressions_1.Target, (0, combi_1.opt)((0, combi_1.alt)(ref, assigning)));
|
|
15
16
|
const to = (0, combi_1.seq)("TO", expressions_1.Source);
|
|
16
17
|
const from = (0, combi_1.seq)("FROM", expressions_1.Source);
|
|
17
|
-
const fromTo = (0, combi_1.
|
|
18
|
-
const foo = (0, combi_1.
|
|
18
|
+
const fromTo = (0, combi_1.opt)((0, combi_1.per)(from, to));
|
|
19
|
+
const foo = (0, combi_1.alt)(intoTable, (0, combi_1.seq)(into, (0, combi_1.opt)((0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)))), (0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)));
|
|
19
20
|
const lines = (0, combi_1.seq)("LINES OF", target, (0, combi_1.opt)(fromTo));
|
|
20
21
|
const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source));
|
|
21
22
|
const tab = (0, combi_1.seq)("TABLE", expressions_1.Source);
|
|
@@ -14,7 +14,7 @@ class Loop {
|
|
|
14
14
|
const to = (0, combi_1.seq)("TO", expressions_1.Source);
|
|
15
15
|
const usingKey = (0, combi_1.seq)("USING KEY", (0, combi_1.altPrio)(expressions_1.SimpleName, expressions_1.Dynamic));
|
|
16
16
|
const options = (0, combi_1.per)(expressions_1.LoopTarget, from, to, where, usingKey, group);
|
|
17
|
-
const at = (0, combi_1.seq)("AT", (0, combi_1.opt)((0, combi_1.seq)("SCREEN", (0, combi_1.
|
|
17
|
+
const at = (0, combi_1.seq)("AT", (0, combi_1.opt)((0, combi_1.seq)("SCREEN", (0, combi_1.failCombinator)())), (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp08, "GROUP")), (0, combi_1.alt)(simple_source2_1.SimpleSource2, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source)), (0, combi_1.opt)(options));
|
|
18
18
|
return (0, combi_1.seq)("LOOP", (0, combi_1.opt)(at));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -12,7 +12,8 @@ class ReadTable {
|
|
|
12
12
|
const key = (0, combi_1.seq)((0, combi_1.altPrio)("WITH KEY", "WITH TABLE KEY"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)("="), expressions_1.Source)));
|
|
13
13
|
const using = (0, combi_1.seq)("USING KEY", (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic));
|
|
14
14
|
const from = (0, combi_1.seq)("FROM", expressions_1.Source);
|
|
15
|
-
const
|
|
15
|
+
const fields = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)("INTO", (0, combi_1.failStar)()), expressions_1.FieldSub));
|
|
16
|
+
const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, "CASTING", "TRANSPORTING ALL FIELDS", (0, combi_1.seq)("TRANSPORTING", (0, combi_1.altPrio)(expressions_1.Dynamic, fields)), "BINARY SEARCH");
|
|
16
17
|
return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource2), (0, combi_1.opt)(perm));
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -5,8 +5,11 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const component_compare_1 = require("./component_compare");
|
|
6
6
|
class ComponentCond {
|
|
7
7
|
runSyntax(node, scope, filename) {
|
|
8
|
-
for (const t of node.findDirectExpressions(Expressions.
|
|
9
|
-
|
|
8
|
+
for (const t of node.findDirectExpressions(Expressions.ComponentCondSub)) {
|
|
9
|
+
const c = t.findDirectExpression(Expressions.ComponentCond);
|
|
10
|
+
if (c) {
|
|
11
|
+
new ComponentCond().runSyntax(c, scope, filename);
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
|
|
12
15
|
new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
|
|
@@ -9,7 +9,7 @@ class TypeTableKey {
|
|
|
9
9
|
const rowType = type.getRowType();
|
|
10
10
|
if (rowType instanceof basic_1.StructureType) {
|
|
11
11
|
for (const c of node.findAllExpressions(Expressions.FieldSub)) {
|
|
12
|
-
const concat = c.concatTokens();
|
|
12
|
+
const concat = c.concatTokens().replace(/^!/, "");
|
|
13
13
|
if (concat.includes("-") === false // todo, properly check sub fields
|
|
14
14
|
&& rowType.getComponentByName(concat) === undefined
|
|
15
15
|
&& concat.toUpperCase() !== "TABLE_LINE") {
|
|
@@ -30,9 +30,9 @@ class Append {
|
|
|
30
30
|
const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
|
|
31
31
|
new inline_data_1.InlineData().runSyntax(dataTarget, scope, filename, new basic_1.DataReference(rowType));
|
|
32
32
|
}
|
|
33
|
-
let source = node.findDirectExpression(Expressions.
|
|
33
|
+
let source = node.findDirectExpression(Expressions.SimpleSource4);
|
|
34
34
|
if (source === undefined) {
|
|
35
|
-
source = node.findDirectExpression(Expressions.
|
|
35
|
+
source = node.findDirectExpression(Expressions.Source);
|
|
36
36
|
}
|
|
37
37
|
if (source) {
|
|
38
38
|
if (targetType !== undefined
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsertFieldGroup = void 0;
|
|
4
|
+
const Expressions = require("../../2_statements/expressions");
|
|
5
|
+
const source_1 = require("../expressions/source");
|
|
6
|
+
const target_1 = require("../expressions/target");
|
|
7
|
+
class InsertFieldGroup {
|
|
8
|
+
runSyntax(node, scope, filename) {
|
|
9
|
+
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
10
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
11
|
+
}
|
|
12
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource1)) {
|
|
13
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
14
|
+
}
|
|
15
|
+
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
16
|
+
new target_1.Target().runSyntax(t, scope, filename);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InsertFieldGroup = InsertFieldGroup;
|
|
21
|
+
//# sourceMappingURL=insert_field_group.js.map
|
|
@@ -131,6 +131,7 @@ const unassign_1 = require("./statements/unassign");
|
|
|
131
131
|
const insert_textpool_1 = require("./statements/insert_textpool");
|
|
132
132
|
const get_cursor_1 = require("./statements/get_cursor");
|
|
133
133
|
const loop_at_screen_1 = require("./statements/loop_at_screen");
|
|
134
|
+
const insert_field_group_1 = require("./statements/insert_field_group");
|
|
134
135
|
// -----------------------------------
|
|
135
136
|
const map = {};
|
|
136
137
|
function addToMap(handler) {
|
|
@@ -203,6 +204,7 @@ if (Object.keys(map).length === 0) {
|
|
|
203
204
|
addToMap(new find_1.Find());
|
|
204
205
|
addToMap(new message_1.Message());
|
|
205
206
|
addToMap(new system_call_1.SystemCall());
|
|
207
|
+
addToMap(new insert_field_group_1.InsertFieldGroup());
|
|
206
208
|
addToMap(new get_time_1.GetTime());
|
|
207
209
|
addToMap(new unassign_1.Unassign());
|
|
208
210
|
addToMap(new get_parameter_1.GetParameter());
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
class CDSCondition 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)(".", (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));
|
|
9
|
+
const eq = (0, combi_1.seq)(name, (0, combi_1.alt)("=", "<>", "<", ">", ">=", "<=", "LIKE", "NOT LIKE"), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));
|
|
10
10
|
const isInitial = (0, combi_1.seq)(name, "IS INITIAL");
|
|
11
11
|
const isNotInitial = (0, combi_1.seq)(name, "IS NOT INITIAL");
|
|
12
12
|
const isNull = (0, combi_1.seq)(name, "IS NULL");
|
package/build/src/registry.js
CHANGED
|
@@ -970,8 +970,10 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
970
970
|
}
|
|
971
971
|
assignWithTable(high, lowFile) {
|
|
972
972
|
var _a, _b;
|
|
973
|
-
if (!(high.get() instanceof Statements.Assign)
|
|
974
|
-
|
|
973
|
+
if (!(high.get() instanceof Statements.Assign)) {
|
|
974
|
+
return undefined;
|
|
975
|
+
}
|
|
976
|
+
else if (high.getChildren().length !== 5) {
|
|
975
977
|
return undefined;
|
|
976
978
|
}
|
|
977
979
|
const fieldChain = (_b = (_a = high.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);
|
|
@@ -983,12 +985,22 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
983
985
|
|| !(tableExpression instanceof nodes_1.ExpressionNode)) {
|
|
984
986
|
return undefined;
|
|
985
987
|
}
|
|
986
|
-
|
|
987
|
-
if (
|
|
988
|
-
|
|
988
|
+
let condition = "";
|
|
989
|
+
if (tableExpression.getChildren().length === 3) {
|
|
990
|
+
const index = tableExpression.findDirectExpression(Expressions.Source);
|
|
991
|
+
if (index === undefined) {
|
|
992
|
+
return undefined;
|
|
993
|
+
}
|
|
994
|
+
condition = `INDEX ${index.concatTokens()}`;
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
let concat = tableExpression.concatTokens();
|
|
998
|
+
concat = concat.substring(2);
|
|
999
|
+
concat = concat.substring(0, concat.length - 2);
|
|
1000
|
+
condition = `WITH KEY ${concat}`;
|
|
989
1001
|
}
|
|
990
1002
|
const fsTarget = high.findDirectExpression(Expressions.FSTarget);
|
|
991
|
-
const code = `READ TABLE ${fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()[0].concatTokens()}
|
|
1003
|
+
const code = `READ TABLE ${fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()[0].concatTokens()} ${condition} ASSIGNING ${fsTarget === null || fsTarget === void 0 ? void 0 : fsTarget.concatTokens()}.`;
|
|
992
1004
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
993
1005
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
|
|
994
1006
|
}
|
|
@@ -49,11 +49,17 @@ ENDIF.
|
|
|
49
49
|
if (structure === undefined) {
|
|
50
50
|
return [];
|
|
51
51
|
}
|
|
52
|
-
for (const cond of structure.
|
|
52
|
+
for (const cond of structure.findAllExpressionsMulti([Expressions.Cond, Expressions.ComponentCond])) {
|
|
53
53
|
issues.push(...this.analyze(file, cond));
|
|
54
54
|
}
|
|
55
|
-
for (const sub of structure.
|
|
56
|
-
|
|
55
|
+
for (const sub of structure.findAllExpressionsMulti([Expressions.CondSub, Expressions.ComponentCondSub])) {
|
|
56
|
+
let cond = [];
|
|
57
|
+
if (sub.get() instanceof Expressions.CondSub) {
|
|
58
|
+
cond = sub.findDirectExpressions(Expressions.Cond);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
cond = sub.findDirectExpressions(Expressions.ComponentCond);
|
|
62
|
+
}
|
|
57
63
|
if (cond.length !== 1) {
|
|
58
64
|
continue;
|
|
59
65
|
}
|
|
@@ -106,29 +112,37 @@ ENDIF.
|
|
|
106
112
|
analyze(file, cond) {
|
|
107
113
|
const issues = [];
|
|
108
114
|
let comparator = "";
|
|
115
|
+
let found = false;
|
|
109
116
|
for (const c of cond.getChildren()) {
|
|
110
117
|
let current = "";
|
|
111
118
|
if (c instanceof nodes_1.TokenNode) {
|
|
112
119
|
current = c.get().getStr().toUpperCase();
|
|
113
120
|
}
|
|
114
|
-
else if (c instanceof nodes_1.ExpressionNode
|
|
121
|
+
else if (c instanceof nodes_1.ExpressionNode
|
|
122
|
+
&& (c.get() instanceof Expressions.CondSub || c.get() instanceof Expressions.ComponentCondSub)) {
|
|
115
123
|
if (c.getFirstToken().getStr().toUpperCase() === "NOT") {
|
|
116
124
|
return [];
|
|
117
125
|
}
|
|
118
|
-
|
|
126
|
+
let i = c.findDirectExpression(Expressions.Cond);
|
|
127
|
+
if (i === undefined) {
|
|
128
|
+
i = c.findDirectExpression(Expressions.ComponentCond);
|
|
129
|
+
}
|
|
119
130
|
if (i === undefined) {
|
|
120
131
|
return [];
|
|
121
132
|
}
|
|
122
133
|
current = this.findComparator(i);
|
|
134
|
+
if (current !== "") {
|
|
135
|
+
found = true; // dont report for the simple case that contains quick fixes
|
|
136
|
+
}
|
|
123
137
|
}
|
|
124
138
|
if (comparator === "") {
|
|
125
139
|
comparator = current;
|
|
126
140
|
}
|
|
127
|
-
else if (comparator !== current) {
|
|
141
|
+
else if (comparator !== "" && current !== "" && comparator !== current) {
|
|
128
142
|
return [];
|
|
129
143
|
}
|
|
130
144
|
}
|
|
131
|
-
if (comparator !== "" && comparator !== "MIXED") {
|
|
145
|
+
if (comparator !== "" && comparator !== "MIXED" && found === true) {
|
|
132
146
|
const message = "Too many parentheses, complex";
|
|
133
147
|
const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
|
|
134
148
|
issues.push(issue);
|
|
@@ -51,25 +51,28 @@ This rule makes sure the spaces are consistently required across the language.`,
|
|
|
51
51
|
missingSpace(statement) {
|
|
52
52
|
const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,
|
|
53
53
|
Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,
|
|
54
|
-
Expressions.ComponentCond, Expressions.MethodCallParam], true);
|
|
54
|
+
Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);
|
|
55
55
|
let pos = undefined;
|
|
56
56
|
for (const f of found) {
|
|
57
57
|
const type = f.get();
|
|
58
|
-
if (type instanceof Expressions.
|
|
59
|
-
pos = this.checkCondSub(f);
|
|
60
|
-
}
|
|
61
|
-
else if (type instanceof Expressions.ValueBody) {
|
|
62
|
-
pos = this.checkValueBody(f);
|
|
63
|
-
}
|
|
64
|
-
else if (type instanceof Expressions.Cond) {
|
|
58
|
+
if (type instanceof Expressions.Cond) {
|
|
65
59
|
pos = this.checkCond(f);
|
|
66
60
|
}
|
|
61
|
+
else if (type instanceof Expressions.CondSub) {
|
|
62
|
+
pos = this.checkCondSub(f);
|
|
63
|
+
}
|
|
67
64
|
else if (type instanceof Expressions.ComponentCond) {
|
|
68
65
|
pos = this.checkComponentCond(f);
|
|
69
66
|
}
|
|
67
|
+
else if (type instanceof Expressions.ComponentCondSub) {
|
|
68
|
+
pos = this.checkComponentCondSub(f);
|
|
69
|
+
}
|
|
70
70
|
else if (type instanceof Expressions.SQLCond) {
|
|
71
71
|
pos = this.checkSQLCond(f);
|
|
72
72
|
}
|
|
73
|
+
else if (type instanceof Expressions.ValueBody) {
|
|
74
|
+
pos = this.checkValueBody(f);
|
|
75
|
+
}
|
|
73
76
|
else if (type instanceof Expressions.NewObject) {
|
|
74
77
|
pos = this.checkNewObject(f);
|
|
75
78
|
}
|
|
@@ -136,7 +139,7 @@ This rule makes sure the spaces are consistently required across the language.`,
|
|
|
136
139
|
}
|
|
137
140
|
return undefined;
|
|
138
141
|
}
|
|
139
|
-
|
|
142
|
+
checkComponentCondSub(cond) {
|
|
140
143
|
const children = cond.getChildren();
|
|
141
144
|
for (let i = 0; i < children.length; i++) {
|
|
142
145
|
if (children[i].get() instanceof Expressions.ComponentCond) {
|
|
@@ -157,6 +160,19 @@ This rule makes sure the spaces are consistently required across the language.`,
|
|
|
157
160
|
}
|
|
158
161
|
return undefined;
|
|
159
162
|
}
|
|
163
|
+
checkComponentCond(cond) {
|
|
164
|
+
const children = cond.getAllTokens();
|
|
165
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
166
|
+
const current = children[i];
|
|
167
|
+
const next = children[i + 1];
|
|
168
|
+
if (next.getStr().startsWith("'")
|
|
169
|
+
&& next.getRow() === current.getRow()
|
|
170
|
+
&& next.getCol() === current.getEnd().getCol()) {
|
|
171
|
+
return current.getEnd();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
160
176
|
checkValueBody(vb) {
|
|
161
177
|
var _a, _b;
|
|
162
178
|
const children = vb.getChildren();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.91.
|
|
3
|
+
"version": "2.91.34",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://abaplint.org",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.29.
|
|
48
|
+
"@microsoft/api-extractor": "^7.29.3",
|
|
49
49
|
"@types/chai": "^4.3.3",
|
|
50
50
|
"@types/mocha": "^9.1.1",
|
|
51
|
-
"@types/node": "^18.7.
|
|
51
|
+
"@types/node": "^18.7.9",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.22.0",
|
|
54
54
|
"mocha": "^10.0.0",
|