@abaplint/core 2.85.25 → 2.85.28
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 +1 -0
- package/build/src/abap/2_statements/expressions/sql_compare.js +1 -2
- package/build/src/abap/2_statements/expressions/sql_function.js +8 -2
- package/build/src/abap/5_syntax/_builtin.js +1 -0
- package/build/src/abap/5_syntax/statements/find.js +9 -4
- package/build/src/abap/nodes/statement_node.js +14 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +9 -1
- package/build/src/rules/many_parentheses.js +17 -0
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -4996,6 +4996,7 @@ declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
|
|
|
4996
4996
|
*/
|
|
4997
4997
|
findTokenSequencePosition(first: string, second: string): Position | undefined;
|
|
4998
4998
|
findExpressionAfterToken(text: string): ExpressionNode | undefined;
|
|
4999
|
+
findExpressionsAfterToken(text: string): ExpressionNode[];
|
|
4999
5000
|
private toTokens;
|
|
5000
5001
|
private toTokenNodess;
|
|
5001
5002
|
}
|
|
@@ -16,9 +16,8 @@ class SQLCompare extends combi_1.Expression {
|
|
|
16
16
|
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
|
|
17
17
|
const source = new _1.SQLSource();
|
|
18
18
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
|
|
19
|
-
const builtin = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.altPrio)("lower", "upper"), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
20
19
|
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
|
|
21
|
-
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(
|
|
20
|
+
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, (0, combi_1.seq)(_1.SQLFieldName, (0, combi_1.optPrio)(arith))), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(inn, like, between)), nul));
|
|
22
21
|
const exists = (0, combi_1.seq)("EXISTS", subSelect);
|
|
23
22
|
return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
|
|
24
23
|
}
|
|
@@ -8,9 +8,13 @@ const combi_1 = require("../combi");
|
|
|
8
8
|
const integer_1 = require("./integer");
|
|
9
9
|
const sql_alias_field_1 = require("./sql_alias_field");
|
|
10
10
|
const sql_field_name_1 = require("./sql_field_name");
|
|
11
|
+
const simple_source3_1 = require("./simple_source3");
|
|
12
|
+
const source_1 = require("./source");
|
|
11
13
|
class SQLFunction extends combi_1.Expression {
|
|
12
14
|
getRunnable() {
|
|
13
|
-
const
|
|
15
|
+
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), source_1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
16
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.alt)(simple_source3_1.SimpleSource3, paren)));
|
|
17
|
+
const param = (0, combi_1.alt)(sql_field_name_1.SQLFieldName, sql_alias_field_1.SQLAliasField, SQLFunction, constant_1.Constant, at);
|
|
14
18
|
const castTypes = (0, combi_1.altPrio)((0, combi_1.seq)("CHAR", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), "FLTP");
|
|
15
19
|
const abs = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("abs", (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
16
20
|
const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("cast", (0, combi_1.tok)(tokens_1.ParenLeftW), param, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
@@ -20,10 +24,12 @@ class SQLFunction extends combi_1.Expression {
|
|
|
20
24
|
const div = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("div", (0, combi_1.tok)(tokens_1.ParenLeftW), param, ",", param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
21
25
|
const floor = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("floor", (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
22
26
|
const length = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("length", (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
27
|
+
const lower = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("lower", (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
23
28
|
const mod = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("mod", (0, combi_1.tok)(tokens_1.ParenLeftW), param, ",", param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
24
29
|
const replace = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("replace", (0, combi_1.tok)(tokens_1.ParenLeftW), param, ",", param, ",", param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
30
|
+
const upper = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("upper", (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
25
31
|
const uuid = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("uuid", (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
26
|
-
return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length);
|
|
32
|
+
return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length, lower, upper);
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
exports.SQLFunction = SQLFunction;
|
|
@@ -131,6 +131,7 @@ class BuiltIn {
|
|
|
131
131
|
ret.push(this.buildConstant("col_heading", new basic_1.IntegerType(), "1"));
|
|
132
132
|
ret.push(this.buildConstant("col_key", new basic_1.IntegerType(), "4"));
|
|
133
133
|
ret.push(this.buildConstant("col_negative", new basic_1.IntegerType(), "6"));
|
|
134
|
+
ret.push(this.buildConstant("col_group", new basic_1.IntegerType(), "7"));
|
|
134
135
|
ret.push(this.buildConstant("col_normal", new basic_1.IntegerType(), "2"));
|
|
135
136
|
ret.push(this.buildConstant("col_positive", new basic_1.IntegerType(), "5"));
|
|
136
137
|
ret.push(this.buildConstant("col_total", new basic_1.IntegerType(), "3"));
|
|
@@ -26,9 +26,11 @@ class Find {
|
|
|
26
26
|
this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false }));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const ofound = node.
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const ofound = node.findExpressionsAfterToken("OFFSET");
|
|
30
|
+
for (const o of ofound) {
|
|
31
|
+
if (o.get() instanceof Expressions.Target) {
|
|
32
|
+
this.inline(o, scope, filename, new basic_1.IntegerType());
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
const lfound = node.findExpressionAfterToken("LINE");
|
|
34
36
|
if (lfound && lfound.get() instanceof Expressions.Target) {
|
|
@@ -44,7 +46,10 @@ class Find {
|
|
|
44
46
|
}
|
|
45
47
|
if (node.findDirectTokenByText("SUBMATCHES")) {
|
|
46
48
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
47
|
-
if (t === rfound || t ===
|
|
49
|
+
if (t === rfound || t === lfound || t === cfound || t === lnfound) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
else if (ofound.indexOf(t) >= 0) {
|
|
48
53
|
continue;
|
|
49
54
|
}
|
|
50
55
|
const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
|
|
@@ -255,6 +255,20 @@ class StatementNode extends _abstract_node_1.AbstractNode {
|
|
|
255
255
|
}
|
|
256
256
|
return undefined;
|
|
257
257
|
}
|
|
258
|
+
findExpressionsAfterToken(text) {
|
|
259
|
+
const children = this.getChildren();
|
|
260
|
+
const ret = [];
|
|
261
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
262
|
+
const c = children[i];
|
|
263
|
+
const next = children[i + 1];
|
|
264
|
+
if (c instanceof token_node_1.TokenNode
|
|
265
|
+
&& c.get().getStr().toUpperCase() === text.toUpperCase()
|
|
266
|
+
&& next instanceof expression_node_1.ExpressionNode) {
|
|
267
|
+
ret.push(next);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return ret;
|
|
271
|
+
}
|
|
258
272
|
////////////////////////////////
|
|
259
273
|
toTokens(b) {
|
|
260
274
|
const tokens = [];
|
package/build/src/registry.js
CHANGED
|
@@ -335,6 +335,9 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
335
335
|
if (fields.length === 1) {
|
|
336
336
|
fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;
|
|
337
337
|
}
|
|
338
|
+
else if (fieldList.concatTokens() === "*") {
|
|
339
|
+
fieldDefinition = `DATA ${name} TYPE ${tableName}.`;
|
|
340
|
+
}
|
|
338
341
|
else {
|
|
339
342
|
for (const f of fields) {
|
|
340
343
|
const fieldName = f.concatTokens();
|
|
@@ -487,6 +490,9 @@ ${indentation}`);
|
|
|
487
490
|
else if (source.findFirstExpression(Expressions.FieldLength)) {
|
|
488
491
|
return undefined;
|
|
489
492
|
}
|
|
493
|
+
else if (source.findFirstExpression(Expressions.TableExpression)) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
490
496
|
const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
491
497
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
492
498
|
const firstToken = node.getFirstToken();
|
|
@@ -1144,7 +1150,9 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1144
1150
|
uniqueName(position, filename, highSyntax) {
|
|
1145
1151
|
const spag = highSyntax.spaghetti.lookupPosition(position, filename);
|
|
1146
1152
|
if (spag === undefined) {
|
|
1147
|
-
|
|
1153
|
+
const name = "temprr" + this.counter;
|
|
1154
|
+
this.counter++;
|
|
1155
|
+
return name;
|
|
1148
1156
|
}
|
|
1149
1157
|
while (true) {
|
|
1150
1158
|
const name = "temp" + this.counter;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ManyParentheses = exports.ManyParenthesesConf = void 0;
|
|
4
4
|
const Expressions = require("../abap/2_statements/expressions");
|
|
5
|
+
const Statements = require("../abap/2_statements/statements");
|
|
5
6
|
const issue_1 = require("../issue");
|
|
6
7
|
const _abap_rule_1 = require("./_abap_rule");
|
|
7
8
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
@@ -64,9 +65,25 @@ ENDIF.
|
|
|
64
65
|
issues.push(issue);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
for (const m of structure.findAllStatements(Statements.Move)) {
|
|
69
|
+
issues.push(...this.analyzeMove(file, m));
|
|
70
|
+
}
|
|
67
71
|
return issues;
|
|
68
72
|
}
|
|
69
73
|
////////////////////
|
|
74
|
+
analyzeMove(file, m) {
|
|
75
|
+
const issues = [];
|
|
76
|
+
const children = m.getChildren();
|
|
77
|
+
const last = children[children.length - 2];
|
|
78
|
+
const lastChildren = last.getChildren();
|
|
79
|
+
if (lastChildren.length === 3
|
|
80
|
+
&& lastChildren[0].getFirstToken().getStr() === "("
|
|
81
|
+
&& lastChildren[2].getFirstToken().getStr() === ")") {
|
|
82
|
+
const issue = issue_1.Issue.atToken(file, last.getFirstToken(), "Too many parentheses", this.getMetadata().key, this.conf.severity);
|
|
83
|
+
issues.push(issue);
|
|
84
|
+
}
|
|
85
|
+
return issues;
|
|
86
|
+
}
|
|
70
87
|
analyze(file, cond) {
|
|
71
88
|
const issues = [];
|
|
72
89
|
let comparator = "";
|