@abaplint/core 2.103.6 → 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.
@@ -3381,7 +3381,7 @@ export declare interface INode {
3381
3381
  addChild(n: INode): void;
3382
3382
  setChildren(children: INode[]): void;
3383
3383
  getChildren(): readonly INode[];
3384
- get(): any;
3384
+ get(): object;
3385
3385
  getFirstToken(): Token;
3386
3386
  getLastToken(): Token;
3387
3387
  }
@@ -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":
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.103.6";
68
+ return "2.103.7";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -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.6",
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",