@abaplint/core 2.93.86 → 2.93.88
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 +15 -3
- package/build/src/abap/5_syntax/basic_types.js +35 -14
- package/build/src/abap/types/basic/table_type.js +3 -2
- package/build/src/cds/expressions/cds_arithmetics.js +2 -1
- package/build/src/cds/expressions/cds_condition.js +5 -6
- package/build/src/cds/expressions/cds_element.js +1 -1
- package/build/src/cds/expressions/cds_integer.js +11 -0
- package/build/src/cds/expressions/index.js +1 -0
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -359,6 +359,7 @@ declare namespace BasicTypes {
|
|
|
359
359
|
IStructureComponent,
|
|
360
360
|
StructureType,
|
|
361
361
|
TableAccessType,
|
|
362
|
+
ITableKey,
|
|
362
363
|
ITableOptions,
|
|
363
364
|
TableType_2 as TableType,
|
|
364
365
|
TimeType,
|
|
@@ -670,6 +671,10 @@ declare class CDSGroupBy extends Expression {
|
|
|
670
671
|
getRunnable(): IStatementRunnable;
|
|
671
672
|
}
|
|
672
673
|
|
|
674
|
+
declare class CDSInteger extends Expression {
|
|
675
|
+
getRunnable(): IStatementRunnable;
|
|
676
|
+
}
|
|
677
|
+
|
|
673
678
|
declare class CDSJoin extends Expression {
|
|
674
679
|
getRunnable(): IStatementRunnable;
|
|
675
680
|
}
|
|
@@ -2095,6 +2100,7 @@ declare namespace ExpressionsCDS {
|
|
|
2095
2100
|
CDSElement,
|
|
2096
2101
|
CDSFunction,
|
|
2097
2102
|
CDSGroupBy,
|
|
2103
|
+
CDSInteger,
|
|
2098
2104
|
CDSJoin,
|
|
2099
2105
|
CDSName,
|
|
2100
2106
|
CDSParametersSelect,
|
|
@@ -3551,11 +3557,17 @@ declare interface ISyntaxSettings {
|
|
|
3551
3557
|
globalMacros?: string[];
|
|
3552
3558
|
}
|
|
3553
3559
|
|
|
3554
|
-
declare type
|
|
3560
|
+
declare type ITableKey = {
|
|
3561
|
+
name: string;
|
|
3555
3562
|
type?: TableAccessType;
|
|
3556
|
-
keyFields
|
|
3557
|
-
isUnique
|
|
3563
|
+
keyFields: string[];
|
|
3564
|
+
isUnique: boolean;
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3567
|
+
declare type ITableOptions = {
|
|
3558
3568
|
withHeader: boolean;
|
|
3569
|
+
primaryKey?: ITableKey;
|
|
3570
|
+
secondary?: ITableKey[];
|
|
3559
3571
|
};
|
|
3560
3572
|
|
|
3561
3573
|
declare interface ITextDocumentPositionParams {
|
|
@@ -262,34 +262,55 @@ class BasicTypes {
|
|
|
262
262
|
return undefined;
|
|
263
263
|
}
|
|
264
264
|
parseTable(node, name) {
|
|
265
|
-
var _a, _b;
|
|
265
|
+
var _a, _b, _c;
|
|
266
266
|
const typename = node.findFirstExpression(Expressions.TypeName);
|
|
267
267
|
const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
268
268
|
if (text === undefined) {
|
|
269
269
|
return undefined;
|
|
270
270
|
}
|
|
271
271
|
let type = undefined;
|
|
272
|
-
if (text.
|
|
272
|
+
if (text.startsWith("TYPE STANDARD TABLE ") || text.startsWith("LIKE STANDARD TABLE ")) {
|
|
273
273
|
type = basic_1.TableAccessType.standard;
|
|
274
274
|
}
|
|
275
|
-
else if (text.
|
|
275
|
+
else if (text.startsWith("TYPE SORTED TABLE ") || text.startsWith("LIKE SORTED TABLE ")) {
|
|
276
276
|
type = basic_1.TableAccessType.sorted;
|
|
277
277
|
}
|
|
278
|
-
else if (text.
|
|
278
|
+
else if (text.startsWith("TYPE HASHED TABLE ") || text.startsWith("LIKE HASHED TABLE ")) {
|
|
279
279
|
type = basic_1.TableAccessType.hashed;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);
|
|
282
|
+
const firstKey = typeTableKeys[0];
|
|
283
|
+
const primaryKey = {
|
|
284
|
+
name: "primary_key",
|
|
285
|
+
type: type,
|
|
286
|
+
isUnique: (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
|
|
287
|
+
keyFields: [],
|
|
288
|
+
};
|
|
289
|
+
for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {
|
|
290
|
+
primaryKey.keyFields.push(k.concatTokens().toUpperCase());
|
|
291
|
+
}
|
|
292
|
+
const secondaryKeys = [];
|
|
293
|
+
for (let i = 1; i < typeTableKeys.length; i++) {
|
|
294
|
+
const row = typeTableKeys[i];
|
|
295
|
+
const name = (_b = row.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
296
|
+
if (name === undefined) {
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const secondary = {
|
|
300
|
+
name: name,
|
|
301
|
+
type: row.findDirectTokenByText("SORTED") ? basic_1.TableAccessType.sorted : basic_1.TableAccessType.hashed,
|
|
302
|
+
isUnique: (row === null || row === void 0 ? void 0 : row.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
|
|
303
|
+
keyFields: [],
|
|
304
|
+
};
|
|
305
|
+
for (const k of (row === null || row === void 0 ? void 0 : row.findDirectExpressions(expressions_1.FieldSub)) || []) {
|
|
306
|
+
secondary.keyFields.push(k.concatTokens().toUpperCase());
|
|
307
|
+
}
|
|
308
|
+
secondaryKeys.push(secondary);
|
|
287
309
|
}
|
|
288
310
|
const options = {
|
|
289
311
|
withHeader: text.includes(" WITH HEADER LINE"),
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
keyFields: keyFields,
|
|
312
|
+
primaryKey: primaryKey,
|
|
313
|
+
secondary: secondaryKeys,
|
|
293
314
|
};
|
|
294
315
|
let found = undefined;
|
|
295
316
|
if (text.startsWith("TYPE TABLE OF REF TO ")
|
|
@@ -357,7 +378,7 @@ class BasicTypes {
|
|
|
357
378
|
else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
|
|
358
379
|
|| text.startsWith("TYPE TABLE FOR UPDATE "))) {
|
|
359
380
|
const name = typename.concatTokens();
|
|
360
|
-
const type = (
|
|
381
|
+
const type = (_c = this.scope.getDDIC().lookupDDLS(name)) === null || _c === void 0 ? void 0 : _c.type;
|
|
361
382
|
if (type) {
|
|
362
383
|
return new Types.TableType(new basic_1.VoidType("RapTodo"), options);
|
|
363
384
|
}
|
|
@@ -23,13 +23,14 @@ class TableType extends _abstract_type_1.AbstractType {
|
|
|
23
23
|
return this.options.withHeader;
|
|
24
24
|
}
|
|
25
25
|
getAccessType() {
|
|
26
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
return (_a = this.options.primaryKey) === null || _a === void 0 ? void 0 : _a.type;
|
|
27
28
|
}
|
|
28
29
|
getRowType() {
|
|
29
30
|
return this.rowType;
|
|
30
31
|
}
|
|
31
32
|
toABAP() {
|
|
32
|
-
// this is used for downport, so use default key for now
|
|
33
|
+
// todo, this is used for downport, so use default key for now
|
|
33
34
|
return "STANDARD TABLE OF " + this.rowType.toABAP() + " WITH DEFAULT KEY";
|
|
34
35
|
}
|
|
35
36
|
toText(level) {
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSArithmetics = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_integer_1 = require("./cds_integer");
|
|
6
7
|
class CDSArithmetics extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
9
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
-
const val = (0, combi_1.alt)(
|
|
10
|
+
const val = (0, combi_1.alt)(cds_integer_1.CDSInteger, name, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString);
|
|
10
11
|
const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
|
|
11
12
|
return (0, combi_1.seq)(val, operator, val);
|
|
12
13
|
}
|
|
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSCondition = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_integer_1 = require("./cds_integer");
|
|
6
7
|
class CDSCondition extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
9
|
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
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const isNotNull = (0, combi_1.seq)(name, "IS NOT NULL");
|
|
14
|
-
const condition = (0, combi_1.alt)(eq, isNull, isNotNull, isInitial, isNotInitial);
|
|
10
|
+
const left = (0, combi_1.alt)(name, _1.CDSFunction);
|
|
11
|
+
const compare = (0, combi_1.seq)(left, (0, combi_1.alt)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), "<", ">", (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "LIKE", "NOT LIKE"), (0, combi_1.alt)(left, cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSString));
|
|
12
|
+
const is = (0, combi_1.seq)(left, "IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("INITIAL", "NULL"));
|
|
13
|
+
const condition = (0, combi_1.alt)(compare, is);
|
|
15
14
|
const paren = (0, combi_1.seq)("(", CDSCondition, ")");
|
|
16
15
|
return (0, combi_1.seq)((0, combi_1.alt)(condition, paren), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.alt)("AND", "OR"), (0, combi_1.alt)(condition, paren))));
|
|
17
16
|
}
|
|
@@ -7,7 +7,7 @@ const cds_as_1 = require("./cds_as");
|
|
|
7
7
|
const cds_cast_1 = require("./cds_cast");
|
|
8
8
|
class CDSElement extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
|
-
return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSFunction, _1.CDSArithmetics, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters)))), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.CDSElement = CDSElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSInteger = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
class CDSInteger extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
return (0, combi_1.regex)(/^\d+$/);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CDSInteger = CDSInteger;
|
|
11
|
+
//# sourceMappingURL=cds_integer.js.map
|
|
@@ -35,6 +35,7 @@ __exportStar(require("./cds_define_view"), exports);
|
|
|
35
35
|
__exportStar(require("./cds_element"), exports);
|
|
36
36
|
__exportStar(require("./cds_function"), exports);
|
|
37
37
|
__exportStar(require("./cds_group_by"), exports);
|
|
38
|
+
__exportStar(require("./cds_integer"), exports);
|
|
38
39
|
__exportStar(require("./cds_join"), exports);
|
|
39
40
|
__exportStar(require("./cds_name"), exports);
|
|
40
41
|
__exportStar(require("./cds_parameters_select"), exports);
|
package/build/src/registry.js
CHANGED