@abaplint/core 2.119.29 → 2.119.30
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 +16 -5
- package/build/src/abap/2_statements/_select_reclassify.js +163 -0
- package/build/src/abap/2_statements/combi.js +31 -0
- package/build/src/abap/2_statements/expressions/_select_core.js +43 -0
- package/build/src/abap/2_statements/expressions/index.js +3 -1
- package/build/src/abap/2_statements/expressions/select.js +3 -3
- package/build/src/abap/2_statements/expressions/select_cte.js +35 -0
- package/build/src/abap/2_statements/expressions/sql_compare.js +2 -2
- package/build/src/abap/2_statements/expressions/sql_field.js +7 -3
- package/build/src/abap/2_statements/expressions/sql_field_list.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_field_list_loop_greedy.js +20 -0
- package/build/src/abap/2_statements/expressions/sql_field_name.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_fields_loop.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_function.js +2 -2
- package/build/src/abap/2_statements/expressions/sql_join.js +3 -1
- package/build/src/abap/2_statements/expressions/sql_package_size.js +12 -0
- package/build/src/abap/2_statements/expressions/sql_set_op.js +2 -2
- package/build/src/abap/2_statements/expressions/sql_set_op_group.js +2 -2
- package/build/src/abap/2_statements/expressions/with_name.js +4 -1
- package/build/src/abap/2_statements/result.js +3 -0
- package/build/src/abap/2_statements/statement_parser.js +6 -3
- package/build/src/abap/2_statements/statements/select_loop.js +1 -1
- package/build/src/abap/2_statements/statements/with.js +2 -2
- package/build/src/abap/2_statements/statements/with_loop.js +2 -6
- package/build/src/abap/5_syntax/expressions/select.js +1 -9
- package/build/src/abap/5_syntax/statements/read_dataset.js +51 -0
- package/build/src/abap/5_syntax/statements/select_loop.js +3 -3
- package/build/src/abap/5_syntax/statements/with.js +0 -4
- package/build/src/abap/5_syntax/statements/with_loop.js +0 -4
- package/build/src/abap/5_syntax/syntax.js +2 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +3 -0
- package/build/src/rules/prefix_is_current_class.js +65 -2
- package/package.json +1 -1
- package/build/src/abap/2_statements/expressions/select_core.js +0 -30
- package/build/src/abap/2_statements/expressions/select_loop.js +0 -33
- package/build/src/abap/5_syntax/expressions/select_loop.js +0 -12
package/build/abaplint.d.ts
CHANGED
|
@@ -2546,7 +2546,7 @@ declare namespace Expressions {
|
|
|
2546
2546
|
ReduceBody,
|
|
2547
2547
|
ReduceNext,
|
|
2548
2548
|
ReportName,
|
|
2549
|
-
|
|
2549
|
+
SelectCTE,
|
|
2550
2550
|
Select_3 as Select,
|
|
2551
2551
|
SimpleFieldChain,
|
|
2552
2552
|
SimpleFieldChain2,
|
|
@@ -2590,9 +2590,11 @@ declare namespace Expressions {
|
|
|
2590
2590
|
SQLIn,
|
|
2591
2591
|
SQLIntoList,
|
|
2592
2592
|
SQLIntoStructure,
|
|
2593
|
+
SQLFieldListLoopGreedy,
|
|
2593
2594
|
SQLIntoTable,
|
|
2594
2595
|
SQLJoin,
|
|
2595
2596
|
SQLOptions,
|
|
2597
|
+
SQLPackageSize,
|
|
2596
2598
|
SQLOrderBy,
|
|
2597
2599
|
SQLOver,
|
|
2598
2600
|
SQLPath,
|
|
@@ -5902,6 +5904,7 @@ declare class Result {
|
|
|
5902
5904
|
private nodes;
|
|
5903
5905
|
constructor(tokens: readonly Token[], tokenIndex: number, nodes?: (ExpressionNode | TokenNode)[]);
|
|
5904
5906
|
peek(): Token;
|
|
5907
|
+
peekAt(offset: number): Token | undefined;
|
|
5905
5908
|
shift(node: ExpressionNode | TokenNode): Result;
|
|
5906
5909
|
popNode(): ExpressionNode | TokenNode | undefined;
|
|
5907
5910
|
getNodes(): (ExpressionNode | TokenNode)[];
|
|
@@ -6066,6 +6069,10 @@ declare class Select_3 extends Expression {
|
|
|
6066
6069
|
getRunnable(): IStatementRunnable;
|
|
6067
6070
|
}
|
|
6068
6071
|
|
|
6072
|
+
declare class SelectCTE extends Expression {
|
|
6073
|
+
getRunnable(): IStatementRunnable;
|
|
6074
|
+
}
|
|
6075
|
+
|
|
6069
6076
|
declare class SelectionScreen implements IStatement {
|
|
6070
6077
|
getMatcher(): IStatementRunnable;
|
|
6071
6078
|
}
|
|
@@ -6074,10 +6081,6 @@ declare class SelectLoop implements IStatement {
|
|
|
6074
6081
|
getMatcher(): IStatementRunnable;
|
|
6075
6082
|
}
|
|
6076
6083
|
|
|
6077
|
-
declare class SelectLoop_2 extends Expression {
|
|
6078
|
-
getRunnable(): IStatementRunnable;
|
|
6079
|
-
}
|
|
6080
|
-
|
|
6081
6084
|
declare class SelectOption implements IStatement {
|
|
6082
6085
|
getMatcher(): IStatementRunnable;
|
|
6083
6086
|
}
|
|
@@ -6414,6 +6417,10 @@ declare class SQLFieldListLoop extends Expression {
|
|
|
6414
6417
|
getRunnable(): IStatementRunnable;
|
|
6415
6418
|
}
|
|
6416
6419
|
|
|
6420
|
+
declare class SQLFieldListLoopGreedy extends Expression {
|
|
6421
|
+
getRunnable(): IStatementRunnable;
|
|
6422
|
+
}
|
|
6423
|
+
|
|
6417
6424
|
declare class SQLFieldName extends Expression {
|
|
6418
6425
|
getRunnable(): IStatementRunnable;
|
|
6419
6426
|
}
|
|
@@ -6490,6 +6497,10 @@ declare class SQLOver extends Expression {
|
|
|
6490
6497
|
getRunnable(): IStatementRunnable;
|
|
6491
6498
|
}
|
|
6492
6499
|
|
|
6500
|
+
declare class SQLPackageSize extends Expression {
|
|
6501
|
+
getRunnable(): IStatementRunnable;
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6493
6504
|
declare class SQLPath extends Expression {
|
|
6494
6505
|
getRunnable(): IStatementRunnable;
|
|
6495
6506
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.reclassifySelect = reclassifySelect;
|
|
37
|
+
const Statements = __importStar(require("./statements"));
|
|
38
|
+
const Expressions = __importStar(require("./expressions"));
|
|
39
|
+
const nodes_1 = require("../nodes");
|
|
40
|
+
const nodes_2 = require("../nodes");
|
|
41
|
+
const expression_node_1 = require("../nodes/expression_node");
|
|
42
|
+
function containsAggregation(children) {
|
|
43
|
+
for (const child of children) {
|
|
44
|
+
if (!(child instanceof expression_node_1.ExpressionNode)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (child.get() instanceof Expressions.SQLAggregation) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (child.get() instanceof Expressions.SQLSetOpGroup) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (containsAggregation(child.getChildren())) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function isCountAllPattern(children) {
|
|
60
|
+
for (const child of children) {
|
|
61
|
+
if (!(child instanceof expression_node_1.ExpressionNode)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const e = child.get();
|
|
65
|
+
if (e instanceof Expressions.SQLGroupBy ||
|
|
66
|
+
e instanceof Expressions.SQLHaving ||
|
|
67
|
+
e instanceof Expressions.SQLOrderBy) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return containsAggregation(children);
|
|
72
|
+
}
|
|
73
|
+
function scanForExprTypes(children, found, targets) {
|
|
74
|
+
for (const child of children) {
|
|
75
|
+
if (found.size === targets.length) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!(child instanceof expression_node_1.ExpressionNode)) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const e = child.get();
|
|
82
|
+
if (e instanceof Expressions.SQLSetOpGroup) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
for (const t of targets) {
|
|
86
|
+
if (e instanceof t) {
|
|
87
|
+
found.add(t);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
scanForExprTypes(child.getChildren(), found, targets);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function isSelectLoop(node) {
|
|
95
|
+
const selectExpr = node.findDirectExpression(Expressions.Select);
|
|
96
|
+
const top = selectExpr ? selectExpr.getChildren() : [];
|
|
97
|
+
if (top.some(c => c instanceof nodes_2.TokenNode && c.get().getStr().toUpperCase() === "SINGLE")) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const targets = [
|
|
101
|
+
Expressions.SQLSetOp, Expressions.SQLPackageSize, Expressions.SQLIntoTable,
|
|
102
|
+
Expressions.SQLIntoStructure, Expressions.SQLIntoList, Expressions.SQLGroupBy,
|
|
103
|
+
];
|
|
104
|
+
const found = new Set();
|
|
105
|
+
scanForExprTypes(top, found, targets);
|
|
106
|
+
const has = (t) => found.has(t);
|
|
107
|
+
if (has(Expressions.SQLPackageSize)) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (has(Expressions.SQLIntoTable)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const hasInto = has(Expressions.SQLIntoTable) || has(Expressions.SQLIntoStructure) || has(Expressions.SQLIntoList);
|
|
114
|
+
if (!hasInto && isCountAllPattern(top)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (has(Expressions.SQLSetOp)) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (!has(Expressions.SQLGroupBy) && containsAggregation(top)) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
function isWithLoop(node) {
|
|
126
|
+
const selectExpr = node.findDirectExpression(Expressions.Select);
|
|
127
|
+
if (!selectExpr) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const targets = [Expressions.SQLPackageSize, Expressions.SQLIntoTable];
|
|
131
|
+
const found = new Set();
|
|
132
|
+
scanForExprTypes(selectExpr.getChildren(), found, targets);
|
|
133
|
+
if (found.has(Expressions.SQLPackageSize)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (found.has(Expressions.SQLIntoTable)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
function reclassifySelect(node, stmt, pragmas) {
|
|
142
|
+
const children = [...node.getChildren()];
|
|
143
|
+
if (stmt instanceof Statements.Select || stmt instanceof Statements.SelectLoop) {
|
|
144
|
+
const loop = isSelectLoop(node);
|
|
145
|
+
if (loop && stmt instanceof Statements.Select) {
|
|
146
|
+
return new nodes_1.StatementNode(new Statements.SelectLoop(), node.getColon(), pragmas).setChildren(children);
|
|
147
|
+
}
|
|
148
|
+
else if (!loop && stmt instanceof Statements.SelectLoop) {
|
|
149
|
+
return new nodes_1.StatementNode(new Statements.Select(), node.getColon(), pragmas).setChildren(children);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (stmt instanceof Statements.With || stmt instanceof Statements.WithLoop) {
|
|
153
|
+
const loop = isWithLoop(node);
|
|
154
|
+
if (loop && stmt instanceof Statements.With) {
|
|
155
|
+
return new nodes_1.StatementNode(new Statements.WithLoop(), node.getColon(), pragmas).setChildren(children);
|
|
156
|
+
}
|
|
157
|
+
else if (!loop && stmt instanceof Statements.WithLoop) {
|
|
158
|
+
return new nodes_1.StatementNode(new Statements.With(), node.getColon(), pragmas).setChildren(children);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return node;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=_select_reclassify.js.map
|
|
@@ -51,6 +51,7 @@ exports.ver = ver;
|
|
|
51
51
|
exports.verNot = verNot;
|
|
52
52
|
exports.failCombinator = failCombinator;
|
|
53
53
|
exports.failStar = failStar;
|
|
54
|
+
exports.stopBefore = stopBefore;
|
|
54
55
|
const Tokens = __importStar(require("../1_lexer/tokens"));
|
|
55
56
|
const nodes_1 = require("../nodes");
|
|
56
57
|
const version_1 = require("../../version");
|
|
@@ -943,4 +944,34 @@ function failCombinator() {
|
|
|
943
944
|
function failStar() {
|
|
944
945
|
return new FailStar();
|
|
945
946
|
}
|
|
947
|
+
// Passes through results where the next two tokens do NOT match t1 followed by t2.
|
|
948
|
+
class StopBefore2 {
|
|
949
|
+
constructor(t1, t2) {
|
|
950
|
+
this.t1 = t1.toUpperCase();
|
|
951
|
+
this.t2 = t2.toUpperCase();
|
|
952
|
+
}
|
|
953
|
+
listKeywords() { return []; }
|
|
954
|
+
getUsing() { return []; }
|
|
955
|
+
run(r) {
|
|
956
|
+
var _a;
|
|
957
|
+
const result = [];
|
|
958
|
+
for (const input of r) {
|
|
959
|
+
const next = input.peek();
|
|
960
|
+
if (next === undefined) {
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
if (next.getUpperStr() === this.t1 && ((_a = input.peekAt(1)) === null || _a === void 0 ? void 0 : _a.getUpperStr()) === this.t2) {
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
result.push(input);
|
|
967
|
+
}
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
970
|
+
railroad() { return "Railroad.Terminal('stopBefore(" + this.t1 + " " + this.t2 + ")')"; }
|
|
971
|
+
toStr() { return "stopBefore(" + this.t1 + "," + this.t2 + ")"; }
|
|
972
|
+
first() { return [""]; }
|
|
973
|
+
}
|
|
974
|
+
function stopBefore(t1, t2) {
|
|
975
|
+
return new StopBefore2(t1, t2);
|
|
976
|
+
}
|
|
946
977
|
//# sourceMappingURL=combi.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSelectCore = buildSelectCore;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const sql_group_by_1 = require("./sql_group_by");
|
|
8
|
+
const sql_into_structure_1 = require("./sql_into_structure");
|
|
9
|
+
const sql_up_to_1 = require("./sql_up_to");
|
|
10
|
+
function buildSelectCore(into, allowOrderBy = true) {
|
|
11
|
+
const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
|
|
12
|
+
const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
|
|
13
|
+
const sqlFields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields, version_1.Version.OpenABAP);
|
|
14
|
+
const privileged = (0, combi_1.ver)(version_1.Version.v758, _1.SQLPrivilegedAccess);
|
|
15
|
+
const fieldList = (0, combi_1.optPrio)(_1.SQLFieldList);
|
|
16
|
+
const client = (0, combi_1.optPrio)(_1.SQLClient);
|
|
17
|
+
const byp = (0, combi_1.optPrio)(_1.SQLBypassingBuffer);
|
|
18
|
+
const fae = (0, combi_1.optPrio)(_1.SQLForAllEntries);
|
|
19
|
+
const whereClause = (0, combi_1.optPrio)(where);
|
|
20
|
+
const groupHaving = (0, combi_1.seq)((0, combi_1.optPrio)(sql_group_by_1.SQLGroupBy), (0, combi_1.optPrio)(_1.SQLHaving));
|
|
21
|
+
const orderUpOff = allowOrderBy
|
|
22
|
+
? [(0, combi_1.optPrio)((0, combi_1.seq)(_1.SQLOrderBy, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), (0, combi_1.optPrio)(offset)))]
|
|
23
|
+
: [];
|
|
24
|
+
const trailingOpts = (0, combi_1.seq)((0, combi_1.optPrio)(_1.DatabaseConnection), (0, combi_1.optPrio)(_1.SQLHints), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(_1.SQLOptions));
|
|
25
|
+
const intoSingle = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
|
|
26
|
+
const intoAny = into ? (0, combi_1.altPrio)(into, intoSingle) : intoSingle;
|
|
27
|
+
const intoForPackSize = _1.SQLIntoTable;
|
|
28
|
+
if (!into) {
|
|
29
|
+
const afterFromNoInto = (0, combi_1.seq)(_1.SQLFrom, client, byp, (0, combi_1.altPrio)((0, combi_1.seq)(sqlFields, fae, whereClause, groupHaving, ...orderUpOff, trailingOpts), (0, combi_1.seq)(fae, whereClause, groupHaving, ...orderUpOff, trailingOpts)));
|
|
30
|
+
const singleBody = (0, combi_1.seq)(_1.SQLFrom, client, byp, whereClause, groupHaving, trailingOpts);
|
|
31
|
+
return (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, singleBody), (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, byp, afterFromNoInto)));
|
|
32
|
+
}
|
|
33
|
+
const fromPackSize = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLPackageSize), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(_1.DatabaseConnection));
|
|
34
|
+
const trailingInto = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(_1.SQLOrderBy), (0, combi_1.optPrio)(_1.SQLOptions))), (0, combi_1.optPrio)((0, combi_1.seq)(intoSingle, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(_1.SQLOptions))));
|
|
35
|
+
const afterFromWithInto = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLFrom), client, byp, fromPackSize, (0, combi_1.altPrio)((0, combi_1.seq)(sqlFields, fae, whereClause, groupHaving, ...orderUpOff, trailingOpts, trailingInto), (0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, fae, whereClause, groupHaving, ...orderUpOff, trailingOpts, (0, combi_1.optPrio)(_1.SQLOptions)), (0, combi_1.seq)(intoSingle, byp, fae, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, whereClause, groupHaving, ...orderUpOff, trailingOpts, (0, combi_1.optPrio)(_1.SQLOptions)), (0, combi_1.seq)(fae, whereClause, groupHaving, ...orderUpOff, trailingOpts, trailingInto)));
|
|
36
|
+
const selectTableIntoThenFrom = (0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), afterFromWithInto);
|
|
37
|
+
const selectOtherIntoThenFrom = (0, combi_1.seq)(intoAny, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, afterFromWithInto);
|
|
38
|
+
const nonSingleBody = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.altPrio)(selectTableIntoThenFrom, selectOtherIntoThenFrom, afterFromWithInto));
|
|
39
|
+
const singleAfterFrom = (0, combi_1.seq)(_1.SQLFrom, client, byp, (0, combi_1.altPrio)((0, combi_1.seq)(sqlFields, whereClause, groupHaving, trailingOpts, (0, combi_1.optPrio)(intoSingle)), (0, combi_1.seq)(intoSingle, byp, whereClause, groupHaving, trailingOpts), (0, combi_1.seq)(whereClause, groupHaving, trailingOpts, (0, combi_1.optPrio)(intoSingle))));
|
|
40
|
+
const singleIntoBeforeFrom = (0, combi_1.seq)(intoSingle, _1.SQLFrom, client, byp, whereClause, groupHaving, trailingOpts);
|
|
41
|
+
return (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, byp, (0, combi_1.altPrio)(singleIntoBeforeFrom, singleAfterFrom)), nonSingleBody));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=_select_core.js.map
|
|
@@ -159,7 +159,7 @@ __exportStar(require("./redefinition"), exports);
|
|
|
159
159
|
__exportStar(require("./reduce_body"), exports);
|
|
160
160
|
__exportStar(require("./reduce_next"), exports);
|
|
161
161
|
__exportStar(require("./report_name"), exports);
|
|
162
|
-
__exportStar(require("./
|
|
162
|
+
__exportStar(require("./select_cte"), exports);
|
|
163
163
|
__exportStar(require("./select"), exports);
|
|
164
164
|
__exportStar(require("./simple_field_chain"), exports);
|
|
165
165
|
__exportStar(require("./simple_field_chain2"), exports);
|
|
@@ -203,9 +203,11 @@ __exportStar(require("./sql_hints"), exports);
|
|
|
203
203
|
__exportStar(require("./sql_in"), exports);
|
|
204
204
|
__exportStar(require("./sql_into_list"), exports);
|
|
205
205
|
__exportStar(require("./sql_into_structure"), exports);
|
|
206
|
+
__exportStar(require("./sql_field_list_loop_greedy"), exports);
|
|
206
207
|
__exportStar(require("./sql_into_table"), exports);
|
|
207
208
|
__exportStar(require("./sql_join"), exports);
|
|
208
209
|
__exportStar(require("./sql_options"), exports);
|
|
210
|
+
__exportStar(require("./sql_package_size"), exports);
|
|
209
211
|
__exportStar(require("./sql_order_by"), exports);
|
|
210
212
|
__exportStar(require("./sql_over"), exports);
|
|
211
213
|
__exportStar(require("./sql_over"), exports);
|
|
@@ -5,13 +5,13 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
7
|
const sql_into_structure_1 = require("./sql_into_structure");
|
|
8
|
-
const
|
|
8
|
+
const _select_core_1 = require("./_select_core");
|
|
9
9
|
class Select extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
11
|
const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
|
|
12
|
-
const standalone = (0,
|
|
12
|
+
const standalone = (0, _select_core_1.buildSelectCore)(into);
|
|
13
13
|
const unionTail = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)(_1.SQLSetOp), version_1.Version.OpenABAP);
|
|
14
|
-
const chained = (0, combi_1.seq)((0,
|
|
14
|
+
const chained = (0, combi_1.seq)((0, _select_core_1.buildSelectCore)(undefined, false), unionTail, (0, combi_1.optPrio)(_1.SQLOrderBy), (0, combi_1.optPrio)(into));
|
|
15
15
|
return (0, combi_1.altPrio)(chained, standalone);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectCTE = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const sql_field_list_loop_greedy_1 = require("./sql_field_list_loop_greedy");
|
|
8
|
+
const sql_fields_loop_1 = require("./sql_fields_loop");
|
|
9
|
+
const sql_up_to_1 = require("./sql_up_to");
|
|
10
|
+
const sql_source_1 = require("./sql_source");
|
|
11
|
+
const sql_set_op_group_1 = require("./sql_set_op_group");
|
|
12
|
+
class SelectCTE extends combi_1.Expression {
|
|
13
|
+
getRunnable() {
|
|
14
|
+
const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
|
|
15
|
+
const bypass = "BYPASSING BUFFER";
|
|
16
|
+
const privileged = (0, combi_1.ver)(version_1.Version.v758, _1.SQLPrivilegedAccess);
|
|
17
|
+
const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", sql_source_1.SQLSource));
|
|
18
|
+
const groupHaving = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLGroupBy), (0, combi_1.optPrio)(_1.SQLHaving));
|
|
19
|
+
const tail = (0, combi_1.seq)(groupHaving, (0, combi_1.optPrio)((0, combi_1.seq)(_1.SQLOrderBy, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), (0, combi_1.optPrio)(offset))), (0, combi_1.optPrio)(_1.SQLHints), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(_1.SQLOptions), (0, combi_1.optPrio)(_1.DatabaseConnection));
|
|
20
|
+
const sqlStyle = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(bypass), (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop, version_1.Version.OpenABAP), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)(where), tail);
|
|
21
|
+
const abapStyle = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_greedy_1.SQLFieldListLoopGreedy, _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(bypass), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)(where), tail);
|
|
22
|
+
const union = (0, combi_1.seq)("UNION", (0, combi_1.optPrio)((0, combi_1.altPrio)("DISTINCT", "ALL")));
|
|
23
|
+
const intersectExcept = (0, combi_1.altPrio)((0, combi_1.seq)("INTERSECT", (0, combi_1.optPrio)("DISTINCT")), (0, combi_1.seq)("EXCEPT", (0, combi_1.optPrio)("DISTINCT")));
|
|
24
|
+
const setOp = (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v750, union, version_1.Version.OpenABAP), (0, combi_1.ver)(version_1.Version.v756, intersectExcept));
|
|
25
|
+
const operandSql = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(bypass), (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop, version_1.Version.OpenABAP), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)(where), groupHaving);
|
|
26
|
+
const operandAbap = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_greedy_1.SQLFieldListLoopGreedy, _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(bypass), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)(where), groupHaving);
|
|
27
|
+
const operandCore = (0, combi_1.altPrio)(operandSql, operandAbap);
|
|
28
|
+
const unionOperand = (0, combi_1.altPrio)(sql_set_op_group_1.SQLSetOpGroup, (0, combi_1.seq)("SELECT", operandCore));
|
|
29
|
+
const unionTail = (0, combi_1.starPrio)((0, combi_1.seq)(setOp, unionOperand));
|
|
30
|
+
const selectBody = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)(sqlStyle, abapStyle));
|
|
31
|
+
return (0, combi_1.seq)(selectBody, unionTail);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.SelectCTE = SelectCTE;
|
|
35
|
+
//# sourceMappingURL=select_cte.js.map
|
|
@@ -12,12 +12,12 @@ class SQLCompare extends combi_1.Expression {
|
|
|
12
12
|
const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
|
|
13
13
|
const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
|
|
14
14
|
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")));
|
|
15
|
-
const source = new _1.SQLSource();
|
|
16
15
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
|
|
16
|
+
const source = new _1.SQLSource();
|
|
17
17
|
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP);
|
|
18
18
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
19
19
|
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)), version_1.Version.OpenABAP);
|
|
20
|
-
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLAggregation, _1.SQLFunction, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
|
|
20
|
+
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLCase, _1.SQLAggregation, _1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(source, (0, combi_1.optPrio)(arith)))), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
|
|
21
21
|
const exists = (0, combi_1.seq)("EXISTS", subSelect);
|
|
22
22
|
return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
|
|
23
23
|
}
|
|
@@ -17,16 +17,20 @@ class SQLField extends combi_1.Expression {
|
|
|
17
17
|
const field = (0, combi_1.altPrio)(_1.SQLAggregation, fieldNoAgg);
|
|
18
18
|
const parenField = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), field, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
19
19
|
const parenFieldNoAgg = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), fieldNoAgg, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
20
|
-
//
|
|
20
|
+
// without aggregates: from v740sp05
|
|
21
21
|
const subNoAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenFieldNoAgg, fieldNoAgg)));
|
|
22
22
|
const arithNoAgg = (0, combi_1.ver)(version_1.Version.v740sp05, subNoAgg);
|
|
23
|
-
//
|
|
23
|
+
// with aggregates: from v754
|
|
24
24
|
const subWithAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenField, field)));
|
|
25
25
|
const arithWithAgg = (0, combi_1.ver)(version_1.Version.v754, subWithAgg);
|
|
26
26
|
const arith = (0, combi_1.altPrio)(arithWithAgg, arithNoAgg);
|
|
27
27
|
const arithSequence = (0, combi_1.seq)(field, (0, combi_1.optPrio)(arith));
|
|
28
28
|
const parenArithSequence = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), arithSequence, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
29
|
-
|
|
29
|
+
// allows (a-b)*(c-d) — paren groups as operands, defined after parenArithSequence
|
|
30
|
+
const subExtWithAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenArithSequence, parenField, field)));
|
|
31
|
+
const subExtNoAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenArithSequence, parenFieldNoAgg, fieldNoAgg)));
|
|
32
|
+
const arithExt = (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v754, subExtWithAgg), (0, combi_1.ver)(version_1.Version.v740sp05, subExtNoAgg));
|
|
33
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.seq)(parenArithSequence, (0, combi_1.optPrio)(arithExt)), arithSequence), (0, combi_1.optPrio)(as));
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
exports.SQLField = SQLField;
|
|
@@ -10,7 +10,7 @@ class SQLFieldList extends combi_1.Expression {
|
|
|
10
10
|
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
11
11
|
const commaParenField = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)), (0, combi_1.optPrio)(as));
|
|
12
12
|
const nev = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.starPrio)((0, combi_1.seq)(",", (0, combi_1.altPrio)(_1.SQLField, commaParenField))), version_1.Version.OpenABAP);
|
|
13
|
-
const old = (0, combi_1.starPrio)(_1.SQLField);
|
|
13
|
+
const old = (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.stopBefore)("UP", "TO"), _1.SQLField));
|
|
14
14
|
return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.seq)(_1.SQLField, (0, combi_1.alt)(nev, old)));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLFieldListLoopGreedy = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const sql_path_1 = require("./sql_path");
|
|
8
|
+
const tokens_1 = require("../../1_lexer/tokens");
|
|
9
|
+
class SQLFieldListLoopGreedy extends combi_1.Expression {
|
|
10
|
+
getRunnable() {
|
|
11
|
+
const comma = (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp05, ",", version_1.Version.OpenABAP));
|
|
12
|
+
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
13
|
+
const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2), version_1.Version.OpenABAP);
|
|
14
|
+
const entry = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLField, abap, sql_path_1.SQLPath, _1.SQLFieldName, _1.Constant), (0, combi_1.optPrio)(as), comma);
|
|
15
|
+
const fieldList = (0, combi_1.plusPrio)(entry);
|
|
16
|
+
return (0, combi_1.altPrio)("*", _1.Dynamic, fieldList);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.SQLFieldListLoopGreedy = SQLFieldListLoopGreedy;
|
|
20
|
+
//# sourceMappingURL=sql_field_list_loop_greedy.js.map
|
|
@@ -4,7 +4,7 @@ exports.SQLFieldName = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class SQLFieldName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(/^(?!(?:
|
|
7
|
+
return (0, combi_1.regex)(/^(?!(?:FROM|INTO|HAVING|FOR|DISTINCT|UNION|INTERSECT|EXCEPT|NOT|WHEN|CASE|AS|APPENDING|WHERE|CONNECTION|EXISTS|INSERT|MODIFY)$)(\/\w+\/)?(\*?\w+~(\/\w+\/)?(\w+|\*)|\w+)$/i);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.SQLFieldName = SQLFieldName;
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class SQLFieldsLoop extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
return (0, combi_1.seq)("FIELDS", (0, combi_1.opt)("DISTINCT"), _1.
|
|
8
|
+
return (0, combi_1.seq)("FIELDS", (0, combi_1.opt)("DISTINCT"), _1.SQLFieldListLoopGreedy);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SQLFieldsLoop = SQLFieldsLoop;
|
|
@@ -9,7 +9,7 @@ const sql_function_input_1 = require("./sql_function_input");
|
|
|
9
9
|
const sql_case_1 = require("./sql_case");
|
|
10
10
|
class SQLFunction extends combi_1.Expression {
|
|
11
11
|
getRunnable() {
|
|
12
|
-
const castTypes = (0, combi_1.altPrio)((0, combi_1.seq)("CHAR", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), (0, combi_1.seq)("DEC", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, ",", integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.seq)("NUMC", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), "DATS", "FLTP", "INT2", "INT4", "INT8");
|
|
12
|
+
const castTypes = (0, combi_1.altPrio)((0, combi_1.seq)("CHAR", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), (0, combi_1.seq)("DEC", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, ",", integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.seq)("NUMC", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)))), "DATS", "FLTP", "INT1", "INT2", "INT4", "INT8");
|
|
13
13
|
const commaParam = (0, combi_1.seq)(",", sql_function_input_1.SQLFunctionInput);
|
|
14
14
|
// note: the function names are not keywords, they are usually in lower case
|
|
15
15
|
const abs = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^abs$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
@@ -17,7 +17,7 @@ class SQLFunction extends combi_1.Expression {
|
|
|
17
17
|
const castInput = (0, combi_1.altPrio)(sql_case_1.SQLCase, sql_function_input_1.SQLFunctionInput);
|
|
18
18
|
const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), castInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
19
19
|
const ceil = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^ceil$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
20
|
-
const coalesce = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^coalesce$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput,
|
|
20
|
+
const coalesce = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^coalesce$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.starPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
21
21
|
const concat = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^concat$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
22
22
|
const div = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^div$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
23
23
|
const floor = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^floor$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SQLJoin = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
6
7
|
class SQLJoin extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
9
|
const joinType = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("INNER", "LEFT OUTER", "LEFT", "RIGHT OUTER", "RIGHT")), "JOIN");
|
|
9
10
|
const join = (0, combi_1.seq)(joinType, _1.SQLFromSource, "ON", _1.SQLCond);
|
|
10
|
-
|
|
11
|
+
const crossJoin = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("CROSS JOIN", _1.SQLFromSource), version_1.Version.OpenABAP);
|
|
12
|
+
return (0, combi_1.altPrio)(crossJoin, join);
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
exports.SQLJoin = SQLJoin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLPackageSize = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
class SQLPackageSize extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)("PACKAGE SIZE", _1.SQLSource);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SQLPackageSize = SQLPackageSize;
|
|
12
|
+
//# sourceMappingURL=sql_package_size.js.map
|
|
@@ -4,10 +4,10 @@ exports.SQLSetOp = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const version_1 = require("../../../version");
|
|
6
6
|
const sql_set_op_group_1 = require("./sql_set_op_group");
|
|
7
|
-
const
|
|
7
|
+
const _select_core_1 = require("./_select_core");
|
|
8
8
|
class SQLSetOp extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
|
-
const operand = (0, combi_1.altPrio)(sql_set_op_group_1.SQLSetOpGroup, (0,
|
|
10
|
+
const operand = (0, combi_1.altPrio)(sql_set_op_group_1.SQLSetOpGroup, (0, _select_core_1.buildSelectCore)(undefined, false));
|
|
11
11
|
const union = (0, combi_1.seq)("UNION", (0, combi_1.optPrio)((0, combi_1.altPrio)("DISTINCT", "ALL")));
|
|
12
12
|
const intersectExcept = (0, combi_1.altPrio)((0, combi_1.seq)("INTERSECT", (0, combi_1.optPrio)("DISTINCT")), (0, combi_1.seq)("EXCEPT", (0, combi_1.optPrio)("DISTINCT")));
|
|
13
13
|
const op = (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v750, union, version_1.Version.OpenABAP), (0, combi_1.ver)(version_1.Version.v756, intersectExcept));
|
|
@@ -4,10 +4,10 @@ exports.SQLSetOpGroup = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
|
-
const
|
|
7
|
+
const _select_core_1 = require("./_select_core");
|
|
8
8
|
class SQLSetOpGroup extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
|
-
const operand = (0, combi_1.altPrio)(SQLSetOpGroup, (0,
|
|
10
|
+
const operand = (0, combi_1.altPrio)(SQLSetOpGroup, (0, _select_core_1.buildSelectCore)(undefined, false));
|
|
11
11
|
const chain = (0, combi_1.seq)(operand, (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)(_1.SQLSetOp), version_1.Version.OpenABAP), (0, combi_1.optPrio)(_1.SQLOrderBy))));
|
|
12
12
|
return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("(", chain, ")"), version_1.Version.OpenABAP);
|
|
13
13
|
}
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WithName = void 0;
|
|
4
4
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
5
5
|
const combi_1 = require("../combi");
|
|
6
|
+
const sql_field_name_1 = require("./sql_field_name");
|
|
6
7
|
class WithName extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
|
-
|
|
9
|
+
// ( has no leading space, ) has leading space
|
|
10
|
+
const colList = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.star)((0, combi_1.seq)(",", sql_field_name_1.SQLFieldName)), (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WPlus), (0, combi_1.regex)(/^\w+$/), (0, combi_1.optPrio)(colList));
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
exports.WithName = WithName;
|
|
@@ -43,7 +43,8 @@ const combi_1 = require("./combi");
|
|
|
43
43
|
const _statement_1 = require("./statements/_statement");
|
|
44
44
|
const expand_macros_1 = require("./expand_macros");
|
|
45
45
|
const tokens_1 = require("../1_lexer/tokens");
|
|
46
|
-
|
|
46
|
+
const _select_reclassify_1 = require("./_select_reclassify");
|
|
47
|
+
exports.STATEMENT_MAX_TOKENS = 20000;
|
|
47
48
|
class StatementMap {
|
|
48
49
|
constructor() {
|
|
49
50
|
this.map = {};
|
|
@@ -266,7 +267,8 @@ class StatementParser {
|
|
|
266
267
|
if (match) {
|
|
267
268
|
const last = tokens[tokens.length - 1];
|
|
268
269
|
match.push(new nodes_1.TokenNode(last));
|
|
269
|
-
|
|
270
|
+
const matched = new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
|
|
271
|
+
return (0, _select_reclassify_1.reclassifySelect)(matched, st.statement, pragmas);
|
|
270
272
|
}
|
|
271
273
|
}
|
|
272
274
|
// next try the statements without specific keywords
|
|
@@ -275,7 +277,8 @@ class StatementParser {
|
|
|
275
277
|
if (match) {
|
|
276
278
|
const last = tokens[tokens.length - 1];
|
|
277
279
|
match.push(new nodes_1.TokenNode(last));
|
|
278
|
-
|
|
280
|
+
const matched = new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
|
|
281
|
+
return (0, _select_reclassify_1.reclassifySelect)(matched, st.statement, pragmas);
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
return statement;
|
|
@@ -7,8 +7,8 @@ const expressions_1 = require("../expressions");
|
|
|
7
7
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
8
8
|
class With {
|
|
9
9
|
getMatcher() {
|
|
10
|
-
const
|
|
11
|
-
return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("WITH", (0, combi_1.
|
|
10
|
+
const cte = (0, combi_1.seq)(expressions_1.WithName, "AS", (0, combi_1.tok)(tokens_1.WParenLeftW), expressions_1.SelectCTE, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
11
|
+
return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("WITH", cte, (0, combi_1.star)((0, combi_1.seq)(",", cte)), expressions_1.Select));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.With = With;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WithLoop = void 0;
|
|
4
|
-
const
|
|
5
|
-
const version_1 = require("../../../version");
|
|
6
|
-
const tokens_1 = require("../../1_lexer/tokens");
|
|
7
|
-
const expressions_1 = require("../expressions");
|
|
4
|
+
const with_1 = require("./with");
|
|
8
5
|
class WithLoop {
|
|
9
6
|
getMatcher() {
|
|
10
|
-
|
|
11
|
-
return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("WITH", (0, combi_1.plus)(as), expressions_1.SelectLoop));
|
|
7
|
+
return new with_1.With().getMatcher();
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
10
|
exports.WithLoop = WithLoop;
|
|
@@ -385,15 +385,7 @@ class Select {
|
|
|
385
385
|
var _a, _b;
|
|
386
386
|
let expr = undefined;
|
|
387
387
|
const ret = [];
|
|
388
|
-
|
|
389
|
-
expr = node.findFirstExpression(Expressions.SQLFieldListLoop);
|
|
390
|
-
if (expr === undefined) {
|
|
391
|
-
expr = node;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
expr = node.findFirstExpression(Expressions.SQLFieldList);
|
|
396
|
-
}
|
|
388
|
+
expr = node.findFirstExpression(Expressions.SQLFieldList);
|
|
397
389
|
if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
398
390
|
dynamic_1.Dynamic.runSyntax(expr.getFirstChild(), input);
|
|
399
391
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ReadDataset = void 0;
|
|
37
|
+
const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
38
|
+
const source_1 = require("../expressions/source");
|
|
39
|
+
const target_1 = require("../expressions/target");
|
|
40
|
+
class ReadDataset {
|
|
41
|
+
runSyntax(node, input) {
|
|
42
|
+
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
43
|
+
source_1.Source.runSyntax(s, input);
|
|
44
|
+
}
|
|
45
|
+
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
46
|
+
target_1.Target.runSyntax(t, input);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ReadDataset = ReadDataset;
|
|
51
|
+
//# sourceMappingURL=read_dataset.js.map
|
|
@@ -35,12 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.SelectLoop = void 0;
|
|
37
37
|
const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
38
|
-
const
|
|
38
|
+
const select_1 = require("../expressions/select");
|
|
39
39
|
class SelectLoop {
|
|
40
40
|
runSyntax(node, input) {
|
|
41
|
-
const s = node.findDirectExpression(Expressions.
|
|
41
|
+
const s = node.findDirectExpression(Expressions.Select);
|
|
42
42
|
if (s) {
|
|
43
|
-
|
|
43
|
+
select_1.Select.runSyntax(s, input);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -36,15 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.With = void 0;
|
|
37
37
|
const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
38
38
|
const select_1 = require("../expressions/select");
|
|
39
|
-
const select_loop_1 = require("../expressions/select_loop");
|
|
40
39
|
class With {
|
|
41
40
|
runSyntax(node, input) {
|
|
42
41
|
for (const s of node.findAllExpressions(Expressions.Select)) {
|
|
43
42
|
select_1.Select.runSyntax(s, input);
|
|
44
43
|
}
|
|
45
|
-
for (const s of node.findAllExpressions(Expressions.SelectLoop)) {
|
|
46
|
-
select_loop_1.SelectLoop.runSyntax(s, input);
|
|
47
|
-
}
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
exports.With = With;
|
|
@@ -36,15 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.WithLoop = void 0;
|
|
37
37
|
const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
38
38
|
const select_1 = require("../expressions/select");
|
|
39
|
-
const select_loop_1 = require("../expressions/select_loop");
|
|
40
39
|
class WithLoop {
|
|
41
40
|
runSyntax(node, input) {
|
|
42
41
|
for (const s of node.findAllExpressions(Expressions.Select)) {
|
|
43
42
|
select_1.Select.runSyntax(s, input);
|
|
44
43
|
}
|
|
45
|
-
for (const s of node.findAllExpressions(Expressions.SelectLoop)) {
|
|
46
|
-
select_loop_1.SelectLoop.runSyntax(s, input);
|
|
47
|
-
}
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
exports.WithLoop = WithLoop;
|
|
@@ -183,6 +183,7 @@ const insert_field_group_1 = require("./statements/insert_field_group");
|
|
|
183
183
|
const read_entities_1 = require("./statements/read_entities");
|
|
184
184
|
const modify_entities_1 = require("./statements/modify_entities");
|
|
185
185
|
const commit_entities_1 = require("./statements/commit_entities");
|
|
186
|
+
const read_dataset_1 = require("./statements/read_dataset");
|
|
186
187
|
const _syntax_input_1 = require("./_syntax_input");
|
|
187
188
|
const assert_error_1 = require("./assert_error");
|
|
188
189
|
const field_group_1 = require("./statements/field_group");
|
|
@@ -311,6 +312,7 @@ if (Object.keys(map).length === 0) {
|
|
|
311
312
|
addToMap(new parameter_1.Parameter());
|
|
312
313
|
addToMap(new fieldsymbol_1.FieldSymbol());
|
|
313
314
|
addToMap(new read_entities_1.ReadEntities());
|
|
315
|
+
addToMap(new read_dataset_1.ReadDataset());
|
|
314
316
|
addToMap(new modify_entities_1.ModifyEntities());
|
|
315
317
|
addToMap(new commit_entities_1.CommitEntities());
|
|
316
318
|
addToMap(new call_kernel_1.CallKernel());
|
package/build/src/registry.js
CHANGED
|
@@ -584,6 +584,9 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
584
584
|
if (where === undefined) {
|
|
585
585
|
return undefined;
|
|
586
586
|
}
|
|
587
|
+
if (high.findFirstExpression(Expressions.SQLFields) !== undefined) {
|
|
588
|
+
return undefined;
|
|
589
|
+
}
|
|
587
590
|
let into = high.findFirstExpression(Expressions.SQLIntoList);
|
|
588
591
|
if (into === undefined) {
|
|
589
592
|
into = high.findFirstExpression(Expressions.SQLIntoStructure);
|
|
@@ -37,11 +37,13 @@ exports.PrefixIsCurrentClass = exports.PrefixIsCurrentClassConf = void 0;
|
|
|
37
37
|
const issue_1 = require("../issue");
|
|
38
38
|
const _abap_rule_1 = require("./_abap_rule");
|
|
39
39
|
const Structures = __importStar(require("../abap/3_structures/structures"));
|
|
40
|
+
const Statements = __importStar(require("../abap/2_statements/statements"));
|
|
40
41
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
41
42
|
const expressions_1 = require("../abap/2_statements/expressions");
|
|
42
43
|
const position_1 = require("../position");
|
|
43
44
|
const edit_helper_1 = require("../edit_helper");
|
|
44
45
|
const _irule_1 = require("./_irule");
|
|
46
|
+
const comment_1 = require("../abap/1_lexer/tokens/comment");
|
|
45
47
|
class PrefixIsCurrentClassConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
46
48
|
constructor() {
|
|
47
49
|
super(...arguments);
|
|
@@ -117,11 +119,16 @@ class PrefixIsCurrentClass extends _abap_rule_1.ABAPRule {
|
|
|
117
119
|
for (const c of classStructures) {
|
|
118
120
|
const className = c.findFirstExpression(expressions_1.ClassName).getFirstToken().getStr().toUpperCase();
|
|
119
121
|
const staticAccess = className + "=>";
|
|
122
|
+
const shadowed = this.buildShadowedNames(struc, c, className);
|
|
120
123
|
for (const s of c.findAllStatementNodes()) {
|
|
121
124
|
const concat = s.concatTokensWithoutStringsAndComments().toUpperCase();
|
|
122
125
|
if (concat.includes(staticAccess)) {
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
// when the referenced member is shadowed by a method parameter or local
|
|
127
|
+
// declaration, the class prefix is required and cannot be omitted, see issues #3755 and #3707
|
|
128
|
+
const names = shadowed.get(s);
|
|
129
|
+
const ref = this.findStaticReferences(s, className).find(r => r.member === undefined || (names === null || names === void 0 ? void 0 : names.has(r.member)) !== true);
|
|
130
|
+
if (ref) {
|
|
131
|
+
const tokenPos = ref.pos;
|
|
125
132
|
const end = new position_1.Position(tokenPos.getRow(), tokenPos.getCol() + className.length + 2);
|
|
126
133
|
const fix = edit_helper_1.EditHelper.deleteRange(file, tokenPos, end);
|
|
127
134
|
issues.push(issue_1.Issue.atRange(file, tokenPos, end, "Reference to current class can be omitted: \"" + staticAccess + "\"", this.getMetadata().key, this.conf.severity, fix));
|
|
@@ -141,6 +148,62 @@ class PrefixIsCurrentClass extends _abap_rule_1.ABAPRule {
|
|
|
141
148
|
}
|
|
142
149
|
return issues;
|
|
143
150
|
}
|
|
151
|
+
/** finds "className=>member" references in the statement, position is the start of the class name */
|
|
152
|
+
findStaticReferences(s, className) {
|
|
153
|
+
var _a;
|
|
154
|
+
const refs = [];
|
|
155
|
+
const tokens = s.getTokens().filter(t => !(t instanceof comment_1.Comment));
|
|
156
|
+
for (let i = 0; i < tokens.length - 1; i++) {
|
|
157
|
+
if (tokens[i].getStr().toUpperCase() === className
|
|
158
|
+
&& tokens[i + 1].getStr() === "=>") {
|
|
159
|
+
refs.push({
|
|
160
|
+
pos: tokens[i].getStart(),
|
|
161
|
+
member: (_a = tokens[i + 2]) === null || _a === void 0 ? void 0 : _a.getStr().toUpperCase(),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return refs;
|
|
166
|
+
}
|
|
167
|
+
/** for each statement in a method implementation: the method parameter and local
|
|
168
|
+
* declaration names that shadow class members of the same name */
|
|
169
|
+
buildShadowedNames(struc, impl, className) {
|
|
170
|
+
var _a, _b, _c;
|
|
171
|
+
const map = new Map();
|
|
172
|
+
if (!(impl.get() instanceof Structures.ClassImplementation)) {
|
|
173
|
+
return map;
|
|
174
|
+
}
|
|
175
|
+
const definition = struc.findDirectStructures(Structures.ClassDefinition).find(d => { var _a; return ((_a = d.findFirstExpression(expressions_1.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase()) === className; });
|
|
176
|
+
for (const method of impl.findAllStructuresRecursive(Structures.Method)) {
|
|
177
|
+
const names = new Set();
|
|
178
|
+
const methodName = (_b = (_a = method.findFirstStatement(Statements.MethodImplementation)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(expressions_1.MethodName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
179
|
+
if (definition !== undefined && methodName !== undefined) {
|
|
180
|
+
for (const def of definition.findAllStatements(Statements.MethodDef)) {
|
|
181
|
+
if (((_c = def.findFirstExpression(expressions_1.MethodName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase()) === methodName) {
|
|
182
|
+
for (const param of def.findAllExpressions(expressions_1.MethodParamName)) {
|
|
183
|
+
names.add(param.concatTokens().toUpperCase());
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
for (const d of method.findAllExpressions(expressions_1.DefinitionName)) {
|
|
190
|
+
names.add(d.concatTokens().toUpperCase());
|
|
191
|
+
}
|
|
192
|
+
for (const inline of method.findAllExpressions(expressions_1.InlineData)) {
|
|
193
|
+
const field = inline.findFirstExpression(expressions_1.TargetField);
|
|
194
|
+
if (field) {
|
|
195
|
+
names.add(field.concatTokens().toUpperCase());
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (names.size === 0) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
for (const statement of method.findAllStatementNodes()) {
|
|
202
|
+
map.set(statement, names);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return map;
|
|
206
|
+
}
|
|
144
207
|
}
|
|
145
208
|
exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
|
|
146
209
|
//# sourceMappingURL=prefix_is_current_class.js.map
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildSelectCore = buildSelectCore;
|
|
4
|
-
const combi_1 = require("../combi");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const version_1 = require("../../../version");
|
|
7
|
-
const sql_group_by_1 = require("./sql_group_by");
|
|
8
|
-
const sql_into_structure_1 = require("./sql_into_structure");
|
|
9
|
-
const sql_up_to_1 = require("./sql_up_to");
|
|
10
|
-
function buildSelectCore(into, allowOrderBy = true) {
|
|
11
|
-
const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
|
|
12
|
-
const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
|
|
13
|
-
const bypass = (0, combi_1.str)("BYPASSING BUFFER");
|
|
14
|
-
const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields, version_1.Version.OpenABAP);
|
|
15
|
-
const privileged = (0, combi_1.ver)(version_1.Version.v758, _1.SQLPrivilegedAccess);
|
|
16
|
-
const orderByItems = allowOrderBy ? [_1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset] : [];
|
|
17
|
-
const permItems = [_1.SQLFrom, ...(into ? [into] : []), _1.SQLForAllEntries, where,
|
|
18
|
-
...orderByItems, _1.SQLClient, _1.SQLHaving,
|
|
19
|
-
bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection, _1.SQLHints, privileged, _1.SQLOptions];
|
|
20
|
-
const perm = (0, combi_1.per)(permItems[0], permItems[1], ...permItems.slice(2));
|
|
21
|
-
const intoSingle = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
|
|
22
|
-
const permSingleItems = [_1.SQLFrom, ...(into ? [intoSingle] : []), where, _1.SQLClient,
|
|
23
|
-
bypass, sql_group_by_1.SQLGroupBy, _1.SQLHaving, fields, _1.DatabaseConnection, _1.SQLHints, privileged, _1.SQLOptions];
|
|
24
|
-
const permSingle = (0, combi_1.per)(permSingleItems[0], permSingleItems[1], ...permSingleItems.slice(2));
|
|
25
|
-
const fieldList = (0, combi_1.optPrio)(_1.SQLFieldList);
|
|
26
|
-
const single = (0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, permSingle);
|
|
27
|
-
const other = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, perm);
|
|
28
|
-
return (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)(single, other));
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=select_core.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectLoop = void 0;
|
|
4
|
-
const combi_1 = require("../combi");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const sql_order_by_1 = require("./sql_order_by");
|
|
7
|
-
const sql_having_1 = require("./sql_having");
|
|
8
|
-
const sql_into_structure_1 = require("./sql_into_structure");
|
|
9
|
-
const sql_hints_1 = require("./sql_hints");
|
|
10
|
-
const sql_field_list_loop_1 = require("./sql_field_list_loop");
|
|
11
|
-
const sql_up_to_1 = require("./sql_up_to");
|
|
12
|
-
const version_1 = require("../../../version");
|
|
13
|
-
const sql_fields_loop_1 = require("./sql_fields_loop");
|
|
14
|
-
// note: SELECT loops are matched before single statement SELECTs
|
|
15
|
-
class SelectLoop extends combi_1.Expression {
|
|
16
|
-
getRunnable() {
|
|
17
|
-
const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
|
|
18
|
-
const bypass = "BYPASSING BUFFER";
|
|
19
|
-
const pack = (0, combi_1.seq)("PACKAGE SIZE", _1.SQLSource);
|
|
20
|
-
const privileged = (0, combi_1.ver)(version_1.Version.v758, _1.SQLPrivilegedAccess);
|
|
21
|
-
const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));
|
|
22
|
-
const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
|
|
23
|
-
const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
|
|
24
|
-
const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, _1.DatabaseConnection, privileged, _1.SQLOptions, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList, packTab));
|
|
25
|
-
const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)((0, combi_1.seq)(where, (0, combi_1.optPrio)(sql_order_by_1.SQLOrderBy), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo))));
|
|
26
|
-
const aggrIntoBeforeFrom = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
|
|
27
|
-
const aggrIntoAfterFrom = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
|
|
28
|
-
const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict, aggrIntoBeforeFrom, aggrIntoAfterFrom), (0, combi_1.optPrio)(sql_hints_1.SQLHints), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(_1.SQLOptions));
|
|
29
|
-
return ret;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.SelectLoop = SelectLoop;
|
|
33
|
-
//# sourceMappingURL=select_loop.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectLoop = void 0;
|
|
4
|
-
const select_1 = require("./select");
|
|
5
|
-
class SelectLoop {
|
|
6
|
-
static runSyntax(node, input) {
|
|
7
|
-
// try using the other Select, they should look very much the same
|
|
8
|
-
select_1.Select.runSyntax(node, input);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SelectLoop = SelectLoop;
|
|
12
|
-
//# sourceMappingURL=select_loop.js.map
|