@abaplint/core 2.94.9 → 2.94.10

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.
@@ -810,20 +810,24 @@ function tok(t) {
810
810
  return new Token(t.name);
811
811
  }
812
812
  exports.tok = tok;
813
- const singletons = {};
813
+ const expressionSingletons = {};
814
+ const stringSingletons = {};
814
815
  function map(s) {
815
816
  const type = typeof s;
816
817
  if (type === "string") {
817
- return str(s);
818
+ if (stringSingletons[s] === undefined) {
819
+ stringSingletons[s] = str(s);
820
+ }
821
+ return stringSingletons[s];
818
822
  }
819
823
  else if (type === "function") {
820
824
  // @ts-ignore
821
825
  const name = s.name;
822
- if (singletons[name] === undefined) {
826
+ if (expressionSingletons[name] === undefined) {
823
827
  // @ts-ignore
824
- singletons[name] = new s();
828
+ expressionSingletons[name] = new s();
825
829
  }
826
- return singletons[name];
830
+ return expressionSingletons[name];
827
831
  }
828
832
  else {
829
833
  return s;
@@ -21,10 +21,10 @@ class StatementMap {
21
21
  }
22
22
  for (const first of f) {
23
23
  if (this.map[first]) {
24
- this.map[first].push(stat);
24
+ this.map[first].push({ statement: stat });
25
25
  }
26
26
  else {
27
- this.map[first] = [stat];
27
+ this.map[first] = [{ statement: stat }];
28
28
  }
29
29
  }
30
30
  }
@@ -34,6 +34,11 @@ class StatementMap {
34
34
  if (res === undefined) {
35
35
  return [];
36
36
  }
37
+ if (res[0].matcher === undefined) {
38
+ for (const r of res) {
39
+ r.matcher = r.statement.getMatcher();
40
+ }
41
+ }
37
42
  return res;
38
43
  }
39
44
  }
@@ -213,20 +218,20 @@ class StatementParser {
213
218
  return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));
214
219
  }
215
220
  for (const st of StatementParser.map.lookup(filtered[0].getStr())) {
216
- const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);
221
+ const match = combi_1.Combi.run(st.matcher, filtered, this.version);
217
222
  if (match) {
218
223
  const last = tokens[tokens.length - 1];
219
224
  match.push(new nodes_1.TokenNode(last));
220
- return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);
225
+ return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
221
226
  }
222
227
  }
223
228
  // next try the statements without specific keywords
224
229
  for (const st of StatementParser.map.lookup("")) {
225
- const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);
230
+ const match = combi_1.Combi.run(st.matcher, filtered, this.version);
226
231
  if (match) {
227
232
  const last = tokens[tokens.length - 1];
228
233
  match.push(new nodes_1.TokenNode(last));
229
- return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);
234
+ return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
230
235
  }
231
236
  }
232
237
  return statement;
@@ -245,24 +250,26 @@ class StatementParser {
245
250
  }
246
251
  add.push(token);
247
252
  const str = token.getStr();
248
- if (str === ".") {
249
- wa.addUnknown(pre, add, colon);
250
- add = [];
251
- pre = [];
252
- colon = undefined;
253
- }
254
- else if (str === "," && pre.length > 0) {
255
- wa.addUnknown(pre, add, colon);
256
- add = [];
257
- }
258
- else if (str === ":" && colon === undefined) {
259
- colon = token;
260
- add.pop(); // do not add colon token to statement
261
- pre.push(...add);
262
- add = [];
263
- }
264
- else if (str === ":") {
265
- add.pop(); // do not add colon token to statement
253
+ if (str.length === 1) {
254
+ if (str === ".") {
255
+ wa.addUnknown(pre, add, colon);
256
+ add = [];
257
+ pre = [];
258
+ colon = undefined;
259
+ }
260
+ else if (str === "," && pre.length > 0) {
261
+ wa.addUnknown(pre, add, colon);
262
+ add = [];
263
+ }
264
+ else if (str === ":" && colon === undefined) {
265
+ colon = token;
266
+ add.pop(); // do not add colon token to statement
267
+ pre.push(...add);
268
+ add = [];
269
+ }
270
+ else if (str === ":") {
271
+ add.pop(); // do not add colon token to statement
272
+ }
266
273
  }
267
274
  }
268
275
  if (add.length > 0) {
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.94.9";
66
+ return "2.94.10";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.94.9",
3
+ "version": "2.94.10",
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
  "@microsoft/api-extractor": "^7.33.7",
51
51
  "@types/chai": "^4.3.4",
52
52
  "@types/mocha": "^10.0.1",
53
- "@types/node": "^18.11.17",
53
+ "@types/node": "^18.11.18",
54
54
  "chai": "^4.3.7",
55
55
  "eslint": "^8.30.0",
56
56
  "mocha": "^10.2.0",