@abaplint/core 2.85.8 → 2.85.9
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/2_statements/combi.js +20 -4
- package/build/src/abap/2_statements/expressions/simple_source3.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_cds_parameters.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_compare.js +7 -7
- package/build/src/abap/2_statements/expressions/sql_from_source.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_source.js +2 -3
- package/build/src/abap/2_statements/expressions/sql_source_simple.js +3 -3
- package/build/src/abap/5_syntax/expressions/select.js +3 -0
- package/build/src/abap/5_syntax/expressions/sql_for_all_entries.js +4 -1
- package/build/src/abap/5_syntax/statements/create_data.js +5 -0
- package/build/src/abap/5_syntax/statements/delete_database.js +3 -0
- package/build/src/abap/5_syntax/statements/insert_database.js +3 -0
- package/build/src/abap/5_syntax/statements/modify_database.js +7 -0
- package/build/src/abap/5_syntax/statements/update_database.js +3 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/sql_escape_host_variables.js +2 -1
- package/package.json +1 -1
|
@@ -313,13 +313,19 @@ class StarPrioroity {
|
|
|
313
313
|
res = this.sta.run(res);
|
|
314
314
|
if (res.length === 0) {
|
|
315
315
|
if (prev !== undefined) {
|
|
316
|
-
|
|
316
|
+
// console.log("star length: " + prev.length);
|
|
317
|
+
let best = Number.MAX_SAFE_INTEGER;
|
|
318
|
+
for (const p of prev) {
|
|
319
|
+
if (p.remainingLength() < best) {
|
|
320
|
+
result = [p];
|
|
321
|
+
best = p.remainingLength();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
317
324
|
}
|
|
318
325
|
break;
|
|
319
326
|
}
|
|
320
327
|
prev = res;
|
|
321
328
|
}
|
|
322
|
-
// console.dir(result);
|
|
323
329
|
return result;
|
|
324
330
|
}
|
|
325
331
|
railroad() {
|
|
@@ -401,13 +407,17 @@ class Sequence {
|
|
|
401
407
|
const result = [];
|
|
402
408
|
for (const input of r) {
|
|
403
409
|
let temp = [input];
|
|
410
|
+
let match = true;
|
|
404
411
|
for (const sequence of this.list) {
|
|
405
412
|
temp = sequence.run(temp);
|
|
406
413
|
if (temp.length === 0) {
|
|
414
|
+
match = false;
|
|
407
415
|
break;
|
|
408
416
|
}
|
|
409
417
|
}
|
|
410
|
-
|
|
418
|
+
if (match === true) {
|
|
419
|
+
result.push(...temp);
|
|
420
|
+
}
|
|
411
421
|
}
|
|
412
422
|
return result;
|
|
413
423
|
}
|
|
@@ -702,7 +712,13 @@ class Combi {
|
|
|
702
712
|
this.ver = version;
|
|
703
713
|
const input = new result_1.Result(tokens, 0);
|
|
704
714
|
const result = runnable.run([input]);
|
|
705
|
-
|
|
715
|
+
/*
|
|
716
|
+
console.log("res: " + result.length);
|
|
717
|
+
for (const res of result) {
|
|
718
|
+
console.dir(res.getNodes().map(n => n.get().constructor.name));
|
|
719
|
+
console.dir(res.getNodes().map(n => n.concatTokens()));
|
|
720
|
+
}
|
|
721
|
+
*/
|
|
706
722
|
for (const res of result) {
|
|
707
723
|
if (res.remainingLength() === 0) {
|
|
708
724
|
return res.getNodes();
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class SimpleSource3 extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
return (0, combi_1.
|
|
8
|
+
return (0, combi_1.altPrio)(_1.Constant, _1.TextElement, _1.FieldChain);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SimpleSource3 = SimpleSource3;
|
|
@@ -8,7 +8,7 @@ const field_chain_1 = require("./field_chain");
|
|
|
8
8
|
class SQLCDSParameters extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const param = (0, combi_1.seq)(_1.Field, "=", (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), field_chain_1.FieldChain), _1.Constant));
|
|
11
|
-
return (0, combi_1.seq)("(", param, (0, combi_1.
|
|
11
|
+
return (0, combi_1.seq)("(", param, (0, combi_1.starPrio)((0, combi_1.seq)(",", param)), ")");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.SQLCDSParameters = SQLCDSParameters;
|
|
@@ -10,15 +10,15 @@ class SQLCompare extends combi_1.Expression {
|
|
|
10
10
|
const val = new _1.SQLSource();
|
|
11
11
|
const list = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeft), (0, combi_1.tok)(tokens_1.WParenLeftW)), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), ")");
|
|
12
12
|
const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
|
|
13
|
-
const inn = (0, combi_1.seq)(
|
|
14
|
-
const between = (0, combi_1.seq)(
|
|
15
|
-
const like = (0, combi_1.seq)(
|
|
16
|
-
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.
|
|
13
|
+
const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
|
|
14
|
+
const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
|
|
15
|
+
const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
|
|
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.
|
|
20
|
-
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.
|
|
21
|
-
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(builtin,
|
|
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
|
+
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)(builtin, (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
22
|
const exists = (0, combi_1.seq)("EXISTS", subSelect);
|
|
23
23
|
return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
|
|
24
24
|
}
|
|
@@ -11,7 +11,7 @@ class SQLFromSource extends combi_1.Expression {
|
|
|
11
11
|
// https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-752-open_sql.htm#!ABAP_MODIFICATION_1@1@
|
|
12
12
|
const tab = (0, combi_1.ver)(version_1.Version.v752, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.FieldChain));
|
|
13
13
|
const aas = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
|
-
return (0, combi_1.seq)((0, combi_1.altPrio)(
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)(with_name_1.WithName, (0, combi_1.seq)(_1.DatabaseTable, (0, combi_1.optPrio)(_1.SQLCDSParameters)), tab), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v752, "WITH PRIVILEGED ACCESS")), (0, combi_1.optPrio)(aas));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.SQLFromSource = SQLFromSource;
|
|
@@ -8,9 +8,8 @@ const _1 = require(".");
|
|
|
8
8
|
class SQLSource extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (0, combi_1.alt)(_1.SQLAliasField, _1.Source, at);
|
|
11
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)));
|
|
12
|
+
return (0, combi_1.alt)(_1.SQLAliasField, _1.SimpleSource3, at);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
exports.SQLSource = SQLSource;
|
|
@@ -5,12 +5,12 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const version_1 = require("../../../version");
|
|
6
6
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
7
7
|
const _1 = require(".");
|
|
8
|
-
|
|
8
|
+
// todo, delete this expression, its the same as SQLSource?
|
|
9
9
|
class SQLSourceSimple extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
11
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
12
|
-
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)(_1.
|
|
13
|
-
return (0, combi_1.alt)(_1.
|
|
12
|
+
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)(_1.SimpleSource3, paren)));
|
|
13
|
+
return (0, combi_1.alt)(_1.SimpleSource3, at);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.SQLSourceSimple = SQLSourceSimple;
|
|
@@ -45,6 +45,9 @@ class Select {
|
|
|
45
45
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
46
46
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
47
47
|
}
|
|
48
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
49
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
50
|
+
}
|
|
48
51
|
if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
|
|
49
52
|
scope.pop(node.getLastToken().getEnd());
|
|
50
53
|
}
|
|
@@ -6,7 +6,10 @@ const source_1 = require("./source");
|
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
class SQLForAllEntries {
|
|
8
8
|
runSyntax(node, scope, filename) {
|
|
9
|
-
|
|
9
|
+
let s = node.findFirstExpression(Expressions.Source);
|
|
10
|
+
if (s === undefined) {
|
|
11
|
+
s = node.findFirstExpression(Expressions.SimpleSource3);
|
|
12
|
+
}
|
|
10
13
|
if (s) {
|
|
11
14
|
const type = new source_1.Source().runSyntax(s, scope, filename);
|
|
12
15
|
if (type instanceof basic_1.VoidType) {
|
|
@@ -5,6 +5,7 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const target_1 = require("../expressions/target");
|
|
6
6
|
const source_1 = require("../expressions/source");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
|
+
const basic_types_1 = require("../basic_types");
|
|
8
9
|
class CreateData {
|
|
9
10
|
runSyntax(node, scope, filename) {
|
|
10
11
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -16,6 +17,10 @@ class CreateData {
|
|
|
16
17
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
17
18
|
new dynamic_1.Dynamic().runSyntax(t, scope, filename);
|
|
18
19
|
}
|
|
20
|
+
const type = node.findDirectExpression(Expressions.TypeName);
|
|
21
|
+
if (type) {
|
|
22
|
+
new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
exports.CreateData = CreateData;
|
|
@@ -10,6 +10,9 @@ class DeleteDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -10,6 +10,9 @@ class InsertDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -4,6 +4,7 @@ exports.ModifyDatabase = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const dynamic_1 = require("../expressions/dynamic");
|
|
6
6
|
const database_table_1 = require("../expressions/database_table");
|
|
7
|
+
const source_1 = require("../expressions/source");
|
|
7
8
|
class ModifyDatabase {
|
|
8
9
|
runSyntax(node, scope, filename) {
|
|
9
10
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
@@ -13,6 +14,12 @@ class ModifyDatabase {
|
|
|
13
14
|
if (dbtab !== undefined) {
|
|
14
15
|
new database_table_1.DatabaseTable().runSyntax(dbtab, scope, filename);
|
|
15
16
|
}
|
|
17
|
+
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
18
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
19
|
+
}
|
|
20
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
21
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
}
|
|
18
25
|
exports.ModifyDatabase = ModifyDatabase;
|
|
@@ -32,6 +32,9 @@ class UpdateDatabase {
|
|
|
32
32
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
33
33
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
34
34
|
}
|
|
35
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
36
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
37
|
+
}
|
|
35
38
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
36
39
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
37
40
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -73,7 +73,8 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
|
|
|
73
73
|
}
|
|
74
74
|
for (const o of s.findAllExpressions(Expressions.SQLSource)) {
|
|
75
75
|
const first = o.getFirstChild();
|
|
76
|
-
if ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
|
|
76
|
+
if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
|
|
77
|
+
|| ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {
|
|
77
78
|
const message = "Escape SQL host variables";
|
|
78
79
|
const issue = issue_1.Issue.atToken(file, first.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
|
|
79
80
|
issues.push(issue);
|