@abaplint/core 2.103.5 → 2.103.7

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.
@@ -606,6 +606,15 @@ declare class BusinessObjectModel extends AbstractObject {
606
606
  getDescription(): string | undefined;
607
607
  }
608
608
 
609
+ declare class BusinessObjectType extends AbstractObject {
610
+ getType(): string;
611
+ getAllowedNaming(): {
612
+ maxLength: number;
613
+ allowNamespace: boolean;
614
+ };
615
+ getDescription(): string | undefined;
616
+ }
617
+
609
618
  declare class Call implements IStatement {
610
619
  getMatcher(): IStatementRunnable;
611
620
  }
@@ -3372,7 +3381,7 @@ export declare interface INode {
3372
3381
  addChild(n: INode): void;
3373
3382
  setChildren(children: INode[]): void;
3374
3383
  getChildren(): readonly INode[];
3375
- get(): any;
3384
+ get(): object;
3376
3385
  getFirstToken(): Token;
3377
3386
  getLastToken(): Token;
3378
3387
  }
@@ -4364,9 +4373,9 @@ declare namespace Objects {
4364
4373
  export {
4365
4374
  ActivationVariant,
4366
4375
  APIReleaseState,
4367
- ApplicationLogObject,
4368
4376
  ApplicationJobCatalogEntry,
4369
4377
  ApplicationJobTemplate,
4378
+ ApplicationLogObject,
4370
4379
  AssignmentServiceToAuthorizationGroup,
4371
4380
  ATCCheckCategory,
4372
4381
  ATCCheckObject,
@@ -4385,6 +4394,7 @@ declare namespace Objects {
4385
4394
  BusinessFunctionAssignment,
4386
4395
  BusinessFunctionSetAssignment,
4387
4396
  BusinessObjectModel,
4397
+ BusinessObjectType,
4388
4398
  ParsedMetadataExtension,
4389
4399
  CDSMetadataExtension,
4390
4400
  ChangeDocument,
@@ -4,95 +4,8 @@ exports.Lexer = void 0;
4
4
  const position_1 = require("../../position");
5
5
  const virtual_position_1 = require("../../virtual_position");
6
6
  const tokens_1 = require("./tokens");
7
- class Buffer {
8
- constructor() {
9
- this.buf = "";
10
- }
11
- add(s) {
12
- this.buf = this.buf + s;
13
- return this.buf;
14
- }
15
- get() {
16
- return this.buf;
17
- }
18
- clear() {
19
- this.buf = "";
20
- }
21
- countIsEven(char) {
22
- let count = 0;
23
- for (let i = 0; i < this.buf.length; i += 1) {
24
- if (this.buf.charAt(i) === char) {
25
- count += 1;
26
- }
27
- }
28
- return count % 2 === 0;
29
- }
30
- }
31
- class Stream {
32
- constructor(raw) {
33
- this.offset = -1;
34
- this.raw = raw;
35
- this.row = 0;
36
- this.col = 0;
37
- }
38
- advance() {
39
- if (this.currentChar() === "\n") {
40
- this.col = 1;
41
- this.row = this.row + 1;
42
- }
43
- if (this.offset === this.raw.length) {
44
- return false;
45
- }
46
- this.col = this.col + 1;
47
- this.offset = this.offset + 1;
48
- return true;
49
- }
50
- getCol() {
51
- return this.col;
52
- }
53
- getRow() {
54
- return this.row;
55
- }
56
- prevChar() {
57
- if (this.offset - 1 < 0) {
58
- return "";
59
- }
60
- return this.raw.substr(this.offset - 1, 1);
61
- }
62
- prevPrevChar() {
63
- if (this.offset - 2 < 0) {
64
- return "";
65
- }
66
- return this.raw.substr(this.offset - 2, 2);
67
- }
68
- currentChar() {
69
- if (this.offset < 0) {
70
- return "\n"; // simulate newline at start of file to handle star(*) comments
71
- }
72
- else if (this.offset >= this.raw.length) {
73
- return "";
74
- }
75
- return this.raw.substr(this.offset, 1);
76
- }
77
- nextChar() {
78
- if (this.offset + 2 > this.raw.length) {
79
- return "";
80
- }
81
- return this.raw.substr(this.offset + 1, 1);
82
- }
83
- nextNextChar() {
84
- if (this.offset + 3 > this.raw.length) {
85
- return this.nextChar();
86
- }
87
- return this.raw.substr(this.offset + 1, 2);
88
- }
89
- getRaw() {
90
- return this.raw;
91
- }
92
- getOffset() {
93
- return this.offset;
94
- }
95
- }
7
+ const lexer_buffer_1 = require("./lexer_buffer");
8
+ const lexer_stream_1 = require("./lexer_stream");
96
9
  class Lexer {
97
10
  constructor() {
98
11
  this.ModeNormal = 1;
@@ -300,8 +213,8 @@ class Lexer {
300
213
  this.buffer.clear();
301
214
  }
302
215
  process(raw) {
303
- this.stream = new Stream(raw.replace(/\r/g, ""));
304
- this.buffer = new Buffer();
216
+ this.stream = new lexer_stream_1.LexerStream(raw.replace(/\r/g, ""));
217
+ this.buffer = new lexer_buffer_1.LexerBuffer();
305
218
  const splits = {};
306
219
  splits[" "] = true;
307
220
  splits[":"] = true;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LexerBuffer = void 0;
4
+ class LexerBuffer {
5
+ constructor() {
6
+ this.buf = "";
7
+ }
8
+ add(s) {
9
+ this.buf = this.buf + s;
10
+ return this.buf;
11
+ }
12
+ get() {
13
+ return this.buf;
14
+ }
15
+ clear() {
16
+ this.buf = "";
17
+ }
18
+ countIsEven(char) {
19
+ let count = 0;
20
+ for (let i = 0; i < this.buf.length; i += 1) {
21
+ if (this.buf.charAt(i) === char) {
22
+ count += 1;
23
+ }
24
+ }
25
+ return count % 2 === 0;
26
+ }
27
+ }
28
+ exports.LexerBuffer = LexerBuffer;
29
+ //# sourceMappingURL=lexer_buffer.js.map
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LexerStream = void 0;
4
+ class LexerStream {
5
+ constructor(raw) {
6
+ this.offset = -1;
7
+ this.raw = raw;
8
+ this.row = 0;
9
+ this.col = 0;
10
+ }
11
+ advance() {
12
+ if (this.currentChar() === "\n") {
13
+ this.col = 1;
14
+ this.row = this.row + 1;
15
+ }
16
+ if (this.offset === this.raw.length) {
17
+ return false;
18
+ }
19
+ this.col = this.col + 1;
20
+ this.offset = this.offset + 1;
21
+ return true;
22
+ }
23
+ getCol() {
24
+ return this.col;
25
+ }
26
+ getRow() {
27
+ return this.row;
28
+ }
29
+ prevChar() {
30
+ if (this.offset - 1 < 0) {
31
+ return "";
32
+ }
33
+ return this.raw.substr(this.offset - 1, 1);
34
+ }
35
+ prevPrevChar() {
36
+ if (this.offset - 2 < 0) {
37
+ return "";
38
+ }
39
+ return this.raw.substr(this.offset - 2, 2);
40
+ }
41
+ currentChar() {
42
+ if (this.offset < 0) {
43
+ return "\n"; // simulate newline at start of file to handle star(*) comments
44
+ }
45
+ else if (this.offset >= this.raw.length) {
46
+ return "";
47
+ }
48
+ return this.raw.substr(this.offset, 1);
49
+ }
50
+ nextChar() {
51
+ if (this.offset + 2 > this.raw.length) {
52
+ return "";
53
+ }
54
+ return this.raw.substr(this.offset + 1, 1);
55
+ }
56
+ nextNextChar() {
57
+ if (this.offset + 3 > this.raw.length) {
58
+ return this.nextChar();
59
+ }
60
+ return this.raw.substr(this.offset + 1, 2);
61
+ }
62
+ getRaw() {
63
+ return this.raw;
64
+ }
65
+ getOffset() {
66
+ return this.offset;
67
+ }
68
+ }
69
+ exports.LexerStream = LexerStream;
70
+ //# sourceMappingURL=lexer_stream.js.map
@@ -18,4 +18,5 @@ __exportStar(require("./expression_node"), exports);
18
18
  __exportStar(require("./statement_node"), exports);
19
19
  __exportStar(require("./structure_node"), exports);
20
20
  __exportStar(require("./token_node"), exports);
21
+ __exportStar(require("./token_node_regex"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenNodeRegex = exports.TokenNode = void 0;
3
+ exports.TokenNode = void 0;
4
4
  class TokenNode {
5
5
  constructor(token) {
6
6
  this.token = token;
@@ -31,7 +31,4 @@ class TokenNode {
31
31
  }
32
32
  }
33
33
  exports.TokenNode = TokenNode;
34
- class TokenNodeRegex extends TokenNode {
35
- }
36
- exports.TokenNodeRegex = TokenNodeRegex;
37
34
  //# sourceMappingURL=token_node.js.map
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TokenNodeRegex = void 0;
4
+ const token_node_1 = require("./token_node");
5
+ class TokenNodeRegex extends token_node_1.TokenNode {
6
+ }
7
+ exports.TokenNodeRegex = TokenNodeRegex;
8
+ //# sourceMappingURL=token_node_regex.js.map
@@ -166,6 +166,7 @@ class Help {
166
166
  switch (node.constructor.name) {
167
167
  case "TokenNode":
168
168
  case "TokenNodeRegex":
169
+ // @ts-ignore
169
170
  extra = node.get().constructor.name + ", \"" + node.get().getStr() + "\"";
170
171
  break;
171
172
  case "ExpressionNode":
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BusinessObjectType = void 0;
4
+ const _abstract_object_1 = require("./_abstract_object");
5
+ class BusinessObjectType extends _abstract_object_1.AbstractObject {
6
+ getType() {
7
+ return "SOBJ";
8
+ }
9
+ getAllowedNaming() {
10
+ return {
11
+ maxLength: 200,
12
+ allowNamespace: true,
13
+ };
14
+ }
15
+ getDescription() {
16
+ // todo
17
+ return undefined;
18
+ }
19
+ }
20
+ exports.BusinessObjectType = BusinessObjectType;
21
+ //# sourceMappingURL=business_object_type.js.map
@@ -16,9 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./activation_variant"), exports);
18
18
  __exportStar(require("./api_release_state"), exports);
19
- __exportStar(require("./application_log_object"), exports);
20
19
  __exportStar(require("./application_job_catalog_entry"), exports);
21
20
  __exportStar(require("./application_job_template"), exports);
21
+ __exportStar(require("./application_log_object"), exports);
22
22
  __exportStar(require("./assignment_service_to_authorization_group"), exports);
23
23
  __exportStar(require("./atc_check_category"), exports);
24
24
  __exportStar(require("./atc_check_object"), exports);
@@ -37,6 +37,7 @@ __exportStar(require("./business_configuration_set"), exports);
37
37
  __exportStar(require("./business_function_assignment"), exports);
38
38
  __exportStar(require("./business_function_set_assignment"), exports);
39
39
  __exportStar(require("./business_object_model"), exports);
40
+ __exportStar(require("./business_object_type"), exports);
40
41
  __exportStar(require("./cds_metadata_extension"), exports);
41
42
  __exportStar(require("./change_document"), exports);
42
43
  __exportStar(require("./chapter_of_book_structure"), exports);
@@ -63,8 +64,8 @@ __exportStar(require("./ecatt_test_script"), exports);
63
64
  __exportStar(require("./enhancement_implementation"), exports);
64
65
  __exportStar(require("./enhancement_spot"), exports);
65
66
  __exportStar(require("./event_binding"), exports);
66
- __exportStar(require("./event_consumer"), exports);
67
67
  __exportStar(require("./event_binding"), exports);
68
+ __exportStar(require("./event_consumer"), exports);
68
69
  __exportStar(require("./extension_index"), exports);
69
70
  __exportStar(require("./field_catalog"), exports);
70
71
  __exportStar(require("./form_object_form"), exports);
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.103.5";
68
+ return "2.103.7";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -35,9 +35,8 @@ class CloudTypes {
35
35
  this.reg = reg;
36
36
  return this;
37
37
  }
38
- run(obj) {
39
- if (this.reg.getConfig().getVersion() !== version_1.Version.Cloud
40
- || obj instanceof Objects.ApplicationJobCatalogEntry
38
+ static isCloud(obj) {
39
+ return obj instanceof Objects.ApplicationJobCatalogEntry
41
40
  || obj instanceof Objects.ApplicationJobTemplate
42
41
  || obj instanceof Objects.AssignmentServiceToAuthorizationGroup
43
42
  || obj instanceof Objects.ATCCheckCategory
@@ -75,7 +74,10 @@ class CloudTypes {
75
74
  || obj instanceof Objects.ServiceDefinition
76
75
  || obj instanceof Objects.Table
77
76
  || obj instanceof Objects.TableType
78
- || obj instanceof Objects.Transformation) {
77
+ || obj instanceof Objects.Transformation;
78
+ }
79
+ run(obj) {
80
+ if (this.reg.getConfig().getVersion() !== version_1.Version.Cloud || CloudTypes.isCloud(obj)) {
79
81
  return [];
80
82
  }
81
83
  const position = new position_1.Position(1, 1);
@@ -2852,24 +2852,40 @@ ${indentation} output = ${uniqueName}.\n`;
2852
2852
  if (cdef && cdef.getMethodDefinitions === undefined) {
2853
2853
  return undefined; // something wrong
2854
2854
  }
2855
- const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName("CONSTRUCTOR")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();
2855
+ const importing = (_c = this.findConstructor(cdef, spag)) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();
2856
2856
  if (importing) {
2857
2857
  extra += " EXPORTING " + importing + " = " + source;
2858
2858
  }
2859
2859
  else if (spag === undefined) {
2860
- extra += " SpagUndefined";
2860
+ extra += " SpagUndefined ERROR";
2861
2861
  }
2862
2862
  else if (cdef === undefined) {
2863
- extra += " ClassDefinitionNotFound";
2863
+ extra += " ClassDefinitionNotFound ERROR";
2864
2864
  }
2865
2865
  else {
2866
- extra += " SomeError";
2866
+ extra += " SomeError ERROR";
2867
2867
  }
2868
2868
  }
2869
2869
  }
2870
2870
  const abap = `CREATE OBJECT ${name}${extra}.`;
2871
2871
  return abap;
2872
2872
  }
2873
+ findConstructor(cdef, spag) {
2874
+ let def = cdef;
2875
+ while (def !== undefined) {
2876
+ const method = def === null || def === void 0 ? void 0 : def.getMethodDefinitions().getByName("CONSTRUCTOR");
2877
+ if (method) {
2878
+ return method;
2879
+ }
2880
+ const name = def.getSuperClass();
2881
+ if (name) {
2882
+ def = spag === null || spag === void 0 ? void 0 : spag.findClassDefinition(name);
2883
+ }
2884
+ else {
2885
+ return undefined;
2886
+ }
2887
+ }
2888
+ }
2873
2889
  }
2874
2890
  exports.Downport = Downport;
2875
2891
  //# sourceMappingURL=downport.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.103.5",
3
+ "version": "2.103.7",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.38.2",
53
+ "@microsoft/api-extractor": "^7.38.3",
54
54
  "@types/chai": "^4.3.10",
55
55
  "@types/mocha": "^10.0.4",
56
56
  "@types/node": "^20.9.0",