@abaplint/core 2.93.85 → 2.93.87

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.
@@ -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,
@@ -3551,11 +3552,17 @@ declare interface ISyntaxSettings {
3551
3552
  globalMacros?: string[];
3552
3553
  }
3553
3554
 
3554
- declare type ITableOptions = {
3555
+ declare type ITableKey = {
3556
+ name: string;
3555
3557
  type?: TableAccessType;
3556
- keyFields?: string[];
3557
- isUnique?: boolean;
3558
+ keyFields: string[];
3559
+ isUnique: boolean;
3560
+ };
3561
+
3562
+ declare type ITableOptions = {
3558
3563
  withHeader: boolean;
3564
+ primaryKey?: ITableKey;
3565
+ secondary?: ITableKey[];
3559
3566
  };
3560
3567
 
3561
3568
  declare interface ITextDocumentPositionParams {
@@ -108,6 +108,7 @@ class StatementParser {
108
108
  const concat = statement.concatTokens().toUpperCase();
109
109
  if (concat.startsWith("CALL METHOD ") === false
110
110
  && concat.startsWith("RAISE EXCEPTION TYPE ") === false
111
+ && concat.startsWith("LOOP AT ") === false
111
112
  && concat.startsWith("CALL FUNCTION ") === false) {
112
113
  for (const { first, second } of this.buildSplits(statement.getTokens())) {
113
114
  if (second.length === 1) {
@@ -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.includes(" STANDARD TABLE ")) {
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.includes(" SORTED TABLE ")) {
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.includes(" HASHED TABLE ")) {
278
+ else if (text.startsWith("TYPE HASHED TABLE ") || text.startsWith("LIKE HASHED TABLE ")) {
279
279
  type = basic_1.TableAccessType.hashed;
280
280
  }
281
- const keyFields = [];
282
- if (type) {
283
- const keys = node.findFirstExpression(expressions_1.TypeTableKey);
284
- for (const k of (keys === null || keys === void 0 ? void 0 : keys.findDirectExpressions(expressions_1.FieldSub)) || []) {
285
- keyFields.push(k.concatTokens().toUpperCase());
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
- type: type,
291
- isUnique: text.includes(" WITH UNIQUE"),
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 = (_b = this.scope.getDDIC().lookupDDLS(name)) === null || _b === void 0 ? void 0 : _b.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
- return this.options.type;
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) {
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.85";
66
+ return "2.93.87";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -225,6 +225,8 @@ Only one transformation is applied to a statement at a time, so multiple steps m
225
225
  ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));
226
226
  */
227
227
  // hmm, add some way to disable lazyUnknown() in statement_parser.ts
228
+ // alternatively explicit enable it in vscode, its only relevant when a user is
229
+ // actively editing the files
228
230
  continue;
229
231
  }
230
232
  for (let i = 0; i < lowStatements.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.85",
3
+ "version": "2.93.87",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",