@abaplint/core 2.83.8 → 2.83.12

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.
@@ -551,6 +551,82 @@ declare class CatchSystemExceptions_2 implements IStatement {
551
551
  getMatcher(): IStatementRunnable;
552
552
  }
553
553
 
554
+ declare class CDSAggregate extends Expression {
555
+ getRunnable(): IStatementRunnable;
556
+ }
557
+
558
+ declare class CDSAnnotation extends Expression {
559
+ getRunnable(): IStatementRunnable;
560
+ }
561
+
562
+ declare class CDSAnnotationArray extends Expression {
563
+ getRunnable(): IStatementRunnable;
564
+ }
565
+
566
+ declare class CDSAnnotationObject extends Expression {
567
+ getRunnable(): IStatementRunnable;
568
+ }
569
+
570
+ declare class CDSAnnotationSimple extends Expression {
571
+ getRunnable(): IStatementRunnable;
572
+ }
573
+
574
+ declare class CDSArithmetics extends Expression {
575
+ getRunnable(): IStatementRunnable;
576
+ }
577
+
578
+ declare class CDSAs extends Expression {
579
+ getRunnable(): IStatementRunnable;
580
+ }
581
+
582
+ declare class CDSAssociation extends Expression {
583
+ getRunnable(): IStatementRunnable;
584
+ }
585
+
586
+ declare class CDSCardinality extends Expression {
587
+ getRunnable(): IStatementRunnable;
588
+ }
589
+
590
+ declare class CDSCase extends Expression {
591
+ getRunnable(): IStatementRunnable;
592
+ }
593
+
594
+ declare class CDSCast extends Expression {
595
+ getRunnable(): IStatementRunnable;
596
+ }
597
+
598
+ declare class CDSComposition extends Expression {
599
+ getRunnable(): IStatementRunnable;
600
+ }
601
+
602
+ declare class CDSCondition extends Expression {
603
+ getRunnable(): IStatementRunnable;
604
+ }
605
+
606
+ declare class CDSDefineAbstract extends Expression {
607
+ getRunnable(): IStatementRunnable;
608
+ }
609
+
610
+ declare class CDSDefineView extends Expression {
611
+ getRunnable(): IStatementRunnable;
612
+ }
613
+
614
+ declare class CDSElement extends Expression {
615
+ getRunnable(): IStatementRunnable;
616
+ }
617
+
618
+ declare class CDSFunction extends Expression {
619
+ getRunnable(): IStatementRunnable;
620
+ }
621
+
622
+ declare class CDSGroupBy extends Expression {
623
+ getRunnable(): IStatementRunnable;
624
+ }
625
+
626
+ declare class CDSJoin extends Expression {
627
+ getRunnable(): IStatementRunnable;
628
+ }
629
+
554
630
  declare class CDSMetadataExtension extends AbstractObject {
555
631
  getType(): string;
556
632
  getAllowedNaming(): {
@@ -560,10 +636,46 @@ declare class CDSMetadataExtension extends AbstractObject {
560
636
  getDescription(): string | undefined;
561
637
  }
562
638
 
639
+ declare class CDSName extends Expression {
640
+ getRunnable(): IStatementRunnable;
641
+ }
642
+
643
+ declare class CDSParameters extends Expression {
644
+ getRunnable(): IStatementRunnable;
645
+ }
646
+
563
647
  export declare class CDSParser {
564
648
  parse(file: IFile | undefined): ExpressionNode | undefined;
565
649
  }
566
650
 
651
+ declare class CDSRelation extends Expression {
652
+ getRunnable(): IStatementRunnable;
653
+ }
654
+
655
+ declare class CDSSelect extends Expression {
656
+ getRunnable(): IStatementRunnable;
657
+ }
658
+
659
+ declare class CDSSource extends Expression {
660
+ getRunnable(): IStatementRunnable;
661
+ }
662
+
663
+ declare class CDSString extends Expression {
664
+ getRunnable(): IStatementRunnable;
665
+ }
666
+
667
+ declare class CDSType extends Expression {
668
+ getRunnable(): IStatementRunnable;
669
+ }
670
+
671
+ declare class CDSWhere extends Expression {
672
+ getRunnable(): IStatementRunnable;
673
+ }
674
+
675
+ declare class CDSWithParameters extends Expression {
676
+ getRunnable(): IStatementRunnable;
677
+ }
678
+
567
679
  declare class ChangeDocument extends AbstractObject {
568
680
  getType(): string;
569
681
  getAllowedNaming(): {
@@ -1130,8 +1242,10 @@ declare class DataDefinition extends AbstractObject {
1130
1242
  allowNamespace: boolean;
1131
1243
  };
1132
1244
  getSQLViewName(): string | undefined;
1245
+ getDefinitionName(): string | undefined;
1133
1246
  getDescription(): string | undefined;
1134
1247
  parseType(reg: IRegistry): AbstractType;
1248
+ getParsedData(): ParsedDataDefinition | undefined;
1135
1249
  listSources(): {
1136
1250
  name: string;
1137
1251
  as: string | undefined;
@@ -1838,6 +1952,40 @@ declare namespace Expressions {
1838
1952
  }
1839
1953
  export { Expressions }
1840
1954
 
1955
+ declare namespace ExpressionsCDS {
1956
+ export {
1957
+ CDSAggregate,
1958
+ CDSAnnotationArray,
1959
+ CDSAnnotationObject,
1960
+ CDSAnnotationSimple,
1961
+ CDSAnnotation,
1962
+ CDSArithmetics,
1963
+ CDSAs,
1964
+ CDSAssociation,
1965
+ CDSCardinality,
1966
+ CDSCase,
1967
+ CDSCast,
1968
+ CDSComposition,
1969
+ CDSCondition,
1970
+ CDSDefineAbstract,
1971
+ CDSDefineView,
1972
+ CDSElement,
1973
+ CDSFunction,
1974
+ CDSGroupBy,
1975
+ CDSJoin,
1976
+ CDSName,
1977
+ CDSParameters,
1978
+ CDSRelation,
1979
+ CDSSelect,
1980
+ CDSSource,
1981
+ CDSString,
1982
+ CDSType,
1983
+ CDSWhere,
1984
+ CDSWithParameters
1985
+ }
1986
+ }
1987
+ export { ExpressionsCDS }
1988
+
1841
1989
  declare class ExtensionIndex extends AbstractObject {
1842
1990
  getType(): string;
1843
1991
  getAllowedNaming(): {
@@ -3932,8 +4080,11 @@ declare class ParenRightW extends Token {
3932
4080
 
3933
4081
  declare type ParsedDataDefinition = {
3934
4082
  sqlViewName: string | undefined;
4083
+ definitionName: string | undefined;
3935
4084
  fields: {
4085
+ key: boolean;
3936
4086
  name: string;
4087
+ annotations: string[];
3937
4088
  }[];
3938
4089
  sources: {
3939
4090
  name: string;
@@ -16,7 +16,7 @@ class DecFloat16Type extends _abstract_type_1.AbstractType {
16
16
  return false;
17
17
  }
18
18
  toCDS() {
19
- return "abap.TODO_DECFLOAT16";
19
+ return "abap.d16n";
20
20
  }
21
21
  }
22
22
  exports.DecFloat16Type = DecFloat16Type;
@@ -16,7 +16,7 @@ class DecFloat34Type extends _abstract_type_1.AbstractType {
16
16
  return false;
17
17
  }
18
18
  toCDS() {
19
- return "abap.TODO_DECFLOAT34";
19
+ return "abap.d34n";
20
20
  }
21
21
  }
22
22
  exports.DecFloat34Type = DecFloat34Type;
@@ -16,7 +16,7 @@ class StringType extends _abstract_type_1.AbstractType {
16
16
  return false;
17
17
  }
18
18
  toCDS() {
19
- return "abap.TODO_STRING";
19
+ return "abap.string";
20
20
  }
21
21
  }
22
22
  exports.StringType = StringType;
@@ -16,7 +16,7 @@ class UTCLongType extends _abstract_type_1.AbstractType {
16
16
  return false;
17
17
  }
18
18
  toCDS() {
19
- return "abap.TODO_UTCLONG";
19
+ return "abap.utcl";
20
20
  }
21
21
  }
22
22
  exports.UTCLongType = UTCLongType;
@@ -16,7 +16,7 @@ class XStringType extends _abstract_type_1.AbstractType {
16
16
  return false;
17
17
  }
18
18
  toCDS() {
19
- return "abap.TODO_XSTRING";
19
+ return "abap.rawstring";
20
20
  }
21
21
  }
22
22
  exports.XStringType = XStringType;
@@ -71,7 +71,9 @@ class CDSLexer {
71
71
  if (next === "\n") {
72
72
  mode = Mode.Default;
73
73
  }
74
- continue;
74
+ else {
75
+ continue;
76
+ }
75
77
  }
76
78
  else if (mode === Mode.Default && next === "/" && nextNext === "/") {
77
79
  mode = Mode.SingleLineComment;
@@ -80,7 +82,10 @@ class CDSLexer {
80
82
  }
81
83
  // multi line comment handling
82
84
  if (mode === Mode.MultiLineComment) {
83
- if (prev === "*" && next === "/") {
85
+ if (next === "\n") {
86
+ row++;
87
+ }
88
+ else if (prev === "*" && next === "/") {
84
89
  mode = Mode.Default;
85
90
  }
86
91
  continue;
package/build/src/ddic.js CHANGED
@@ -155,10 +155,6 @@ class DDIC {
155
155
  if (foundTTYP) {
156
156
  return { type: foundTTYP.parseType(this.reg), object: foundTTYP };
157
157
  }
158
- const foundDDLS = this.reg.getObject("DDLS", name);
159
- if (foundDDLS) {
160
- return { type: foundDDLS.parseType(this.reg), object: foundDDLS };
161
- }
162
158
  const foundDTEL = this.reg.getObject("DTEL", name);
163
159
  if (foundDTEL) {
164
160
  return { type: foundDTEL.parseType(this.reg), object: foundDTEL };
@@ -166,7 +162,7 @@ class DDIC {
166
162
  const upper = name.toUpperCase();
167
163
  for (const obj of this.reg.getObjectsByType("DDLS")) {
168
164
  const ddls = obj;
169
- if (ddls.getSQLViewName() === upper) {
165
+ if (ddls.getSQLViewName() === upper || ddls.getDefinitionName() === upper) {
170
166
  return { type: ddls.parseType(this.reg), object: obj };
171
167
  }
172
168
  }
@@ -220,14 +216,10 @@ class DDIC {
220
216
  if (foundTABL) {
221
217
  return { type: foundTABL.parseType(this.reg), object: foundTABL };
222
218
  }
223
- const foundDDLS = this.reg.getObject("DDLS", name);
224
- if (foundDDLS) {
225
- return { type: foundDDLS.parseType(this.reg), object: foundDDLS };
226
- }
227
219
  const upper = name.toUpperCase();
228
220
  for (const obj of this.reg.getObjectsByType("DDLS")) {
229
221
  const ddls = obj;
230
- if (ddls.getSQLViewName() === upper) {
222
+ if (ddls.getSQLViewName() === upper || ddls.getDefinitionName() === upper) {
231
223
  return { type: ddls.parseType(this.reg), object: ddls };
232
224
  }
233
225
  }
@@ -245,14 +237,10 @@ class DDIC {
245
237
  if (foundVIEW) {
246
238
  return foundVIEW;
247
239
  }
248
- const foundDDLS = this.reg.getObject("DDLS", name);
249
- if (foundDDLS) {
250
- return foundDDLS;
251
- }
252
240
  const upper = name.toUpperCase();
253
241
  for (const obj of this.reg.getObjectsByType("DDLS")) {
254
242
  const ddls = obj;
255
- if (ddls.getSQLViewName() === upper) {
243
+ if (ddls.getSQLViewName() === upper || ddls.getDefinitionName() === upper) {
256
244
  return ddls;
257
245
  }
258
246
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
3
+ exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
4
  const issue_1 = require("./issue");
5
5
  Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
6
6
  const config_1 = require("./config");
@@ -44,6 +44,8 @@ const Statements = require("./abap/2_statements/statements");
44
44
  exports.Statements = Statements;
45
45
  const Expressions = require("./abap/2_statements/expressions");
46
46
  exports.Expressions = Expressions;
47
+ const ExpressionsCDS = require("./cds/expressions");
48
+ exports.ExpressionsCDS = ExpressionsCDS;
47
49
  const Structures = require("./abap/3_structures/structures");
48
50
  exports.Structures = Structures;
49
51
  const Nodes = require("./abap/nodes");
@@ -25,6 +25,11 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
25
25
  this.parse();
26
26
  return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sqlViewName;
27
27
  }
28
+ getDefinitionName() {
29
+ var _a;
30
+ this.parse();
31
+ return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.definitionName;
32
+ }
28
33
  getDescription() {
29
34
  // todo
30
35
  return undefined;
@@ -33,6 +38,9 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
33
38
  this.parse();
34
39
  return new cds_determine_types_1.CDSDetermineTypes().parseType(reg, this.parsedData);
35
40
  }
41
+ getParsedData() {
42
+ return this.parsedData;
43
+ }
36
44
  listSources() {
37
45
  var _a;
38
46
  this.parse();
@@ -50,12 +58,14 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
50
58
  return this.parserError;
51
59
  }
52
60
  parse() {
61
+ var _a, _b;
53
62
  if (this.isDirty() === false) {
54
63
  return { updated: false, runtime: 0 };
55
64
  }
56
65
  const start = Date.now();
57
66
  this.parsedData = {
58
67
  sqlViewName: undefined,
68
+ definitionName: undefined,
59
69
  fields: [],
60
70
  sources: [],
61
71
  relations: [],
@@ -65,6 +75,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
65
75
  this.findSQLViewName();
66
76
  this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
67
77
  if (this.parsedData.tree) {
78
+ this.parsedData.definitionName = (_b = (_a = this.parsedData.tree) === null || _a === void 0 ? void 0 : _a.findFirstExpression(expressions_1.CDSName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
68
79
  this.findSourcesAndRelations(this.parsedData.tree);
69
80
  this.findFieldNames(this.parsedData.tree);
70
81
  }
@@ -97,7 +108,15 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
97
108
  if ((_b = this.parsedData) === null || _b === void 0 ? void 0 : _b.associations.some(a => { var _a; return a.name.toUpperCase() === name.toUpperCase() || ((_a = a.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === name.toUpperCase(); })) {
98
109
  continue;
99
110
  }
100
- this.parsedData.fields.push({ name: name });
111
+ const annotations = [];
112
+ for (const a of e.findDirectExpressions(expressions_1.CDSAnnotation)) {
113
+ annotations.push(a.concatTokens());
114
+ }
115
+ this.parsedData.fields.push({
116
+ name: name,
117
+ annotations: annotations,
118
+ key: e.findDirectTokenByText("KEY") !== undefined,
119
+ });
101
120
  }
102
121
  }
103
122
  findSourcesAndRelations(tree) {
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.83.8";
71
+ return "2.83.12";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.83.8",
3
+ "version": "2.83.12",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "homepage": "https://abaplint.org",
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.19.2",
48
+ "@microsoft/api-extractor": "^7.19.3",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.0.0",
51
- "@types/node": "^17.0.4",
51
+ "@types/node": "^17.0.5",
52
52
  "chai": "^4.3.4",
53
53
  "eslint": "^8.5.0",
54
54
  "mocha": "^9.1.3",