@abaplint/transpiler 2.3.74 → 2.3.75

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.
@@ -1,4 +1,5 @@
1
1
  import * as abaplint from "@abaplint/core";
2
+ export declare const defaultKeywords: string[];
2
3
  /** Replaces javascript keywords in ABAP source code, in-memory only */
3
4
  export declare class Keywords {
4
5
  private readonly keywords;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Keywords = void 0;
3
+ exports.Keywords = exports.defaultKeywords = void 0;
4
4
  const abaplint = require("@abaplint/core");
5
5
  // https://www.w3schools.com/js/js_reserved.asp
6
- const defaultKeywords = [
6
+ exports.defaultKeywords = [
7
7
  "abstract", "arguments", "await",
8
8
  "break", "byte", "catch",
9
9
  "char", "class", "const", "continue",
@@ -31,7 +31,7 @@ class Keywords {
31
31
  this.keywords = keywords;
32
32
  }
33
33
  else {
34
- this.keywords = defaultKeywords;
34
+ this.keywords = exports.defaultKeywords;
35
35
  }
36
36
  }
37
37
  handle(reg) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Validation = exports.config = void 0;
4
4
  const core_1 = require("@abaplint/core");
5
+ const keywords_1 = require("./keywords");
5
6
  exports.config = {
6
7
  "global": {
7
8
  "files": "/**/*.*",
@@ -67,45 +68,40 @@ exports.config = {
67
68
  "setExtended": true,
68
69
  },
69
70
  "forbidden_identifier": {
70
- "check": [
71
- "^abstract$", "^arguments$", "^await$",
72
- "^break$", "^byte$", "^catch$",
73
- "^char$", "^class$", "^const$", "^continue$",
74
- "^debugger$", "^default$", "^do$",
75
- "^double$", "^else$", "^enum$", "^eval$",
76
- "^export$", "^extends$", "^false$", "^final$",
77
- "^finally$", "^for$", "^function$",
78
- "^goto$", "^if$", "^implements$", "^import$",
79
- "^in$", "^instanceof$", "^interface$",
80
- "^let$", "^long$", "^native$", "^new$",
81
- "^null$", "^package$", "^private$",
82
- // "^protected$",
83
- "^public$", "^return$", "^short$", "^static$",
84
- "^switch$", "^synchronized$", "^this$",
85
- "^throw$", "^throws$", "^transient$", "^true$",
86
- "^try$", "^typeof$", "^var$", "^void$",
87
- "^volatile$", "^while$", "^yield$",
88
- "^unique\\d+$"
89
- ],
71
+ "check": [],
90
72
  },
91
73
  },
92
74
  };
93
75
  // todo, make sure nothing is overloaded, eg "lines()", there is a rule for this in abaplint now
76
+ // hmm this ^ is okay? since lines will be prefixed with "abap.builtin"?
94
77
  class Validation {
95
78
  constructor(options) {
96
79
  this.options = options;
97
80
  }
98
81
  run(reg) {
99
- var _a, _b;
82
+ var _a, _b, _c;
100
83
  if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.ignoreSyntaxCheck) === true) {
101
84
  exports.config.rules["check_syntax"] = false;
102
85
  }
103
86
  else {
104
87
  exports.config.rules["check_syntax"] = true;
105
88
  }
106
- if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === "runtimeError") {
107
- exports.config.syntax.errorNamespace = "VOID_EVERYTHING"; // this is not a constant, just a regex that happens to not match anything
108
- // config.rules["unknown_types"] = false;
89
+ exports.config.rules["forbidden_identifier"]["check"] = ["^unique\\d+$"];
90
+ if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.keywords) === undefined) {
91
+ for (const d of keywords_1.defaultKeywords) {
92
+ const add = "^" + d + "$";
93
+ exports.config.rules["forbidden_identifier"]["check"].push(add);
94
+ }
95
+ }
96
+ else {
97
+ for (const d of this.options.keywords) {
98
+ const add = "^" + d + "$";
99
+ exports.config.rules["forbidden_identifier"]["check"].push(add);
100
+ }
101
+ }
102
+ if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.unknownTypes) === "runtimeError") {
103
+ // this is not a constant, just a regex that happens to not match anything
104
+ exports.config.syntax.errorNamespace = "VOID_EVERYTHING";
109
105
  }
110
106
  const conf = new core_1.Config(JSON.stringify(exports.config));
111
107
  reg.setConfig(conf);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.3.74",
3
+ "version": "2.3.75",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",