astn 0.89.0 → 0.90.0

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,6 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createDictionaryBuilder = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  function createDictionaryBuilder() {
5
25
  const imp = {};
6
26
  return {
@@ -10,21 +30,21 @@ function createDictionaryBuilder() {
10
30
  toDictionary: () => {
11
31
  return {
12
32
  forEach: (callback) => {
13
- Object.keys(imp).sort().forEach((key) => callback(imp[key], key));
33
+ pr.Objectkeys(imp).sort().forEach((key) => callback(imp[key], key));
14
34
  },
15
35
  getLookup: () => {
16
36
  return {
17
37
  getUnsafe: (key) => {
18
38
  const entry = imp[key];
19
39
  if (entry === undefined) {
20
- throw new Error(`no such entry: ${key}, options: ${Object.keys(imp).join(", ")}`);
40
+ throw new Error(`no such entry: ${key}, options: ${pr.Objectkeys(imp).join(", ")}`);
21
41
  }
22
42
  return entry;
23
43
  },
24
44
  with: (key, ifFound, ifNotFound) => {
25
45
  const entry = imp[key];
26
46
  if (entry === undefined) {
27
- return ifNotFound(Object.keys(imp).sort());
47
+ return ifNotFound(pr.Objectkeys(imp).sort());
28
48
  }
29
49
  return ifFound(entry);
30
50
  },
@@ -0,0 +1,50 @@
1
+ interface Array<T> {
2
+ push(v: T): void;
3
+ forEach(callback: (e: T, i: number) => void): void;
4
+ map<RT>(callback: (e: T, i: number) => RT): RT[];
5
+ includes(v: T): boolean;
6
+ length: number;
7
+ join(separator: string): string;
8
+ pop(): undefined | T;
9
+ concat(array: T[]): T[];
10
+ slice(position: number): T[];
11
+ sort(): T[];
12
+ [n: number]: T;
13
+ }
14
+ interface Boolean {
15
+ }
16
+ interface CallableFunction {
17
+ }
18
+ interface Function {
19
+ }
20
+ interface IArguments {
21
+ }
22
+ interface NewableFunction {
23
+ }
24
+ interface Number {
25
+ toString(radix: number): string;
26
+ }
27
+ interface Object {
28
+ }
29
+ interface RegExp {
30
+ }
31
+ interface String {
32
+ readonly length: number;
33
+ substring(begin: number, end: number): string;
34
+ substr(begin: number): string;
35
+ charCodeAt(index: number): number;
36
+ split(splitter: string): string[];
37
+ startsWith(str: string): boolean;
38
+ }
39
+ interface Error {
40
+ }
41
+ /**
42
+ * Allows manipulation and formatting of text strings and determination and location of substrings within strings.
43
+ */
44
+ declare function isNaN(v: any): boolean;
45
+ interface ErrorConstructor {
46
+ new (message?: string): Error;
47
+ (message?: string): Error;
48
+ readonly prototype: Error;
49
+ }
50
+ declare let Error: ErrorConstructor;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /*eslint
3
+ "@typescript-eslint/no-unused-vars": "off",
4
+ "@typescript-eslint/no-empty-interface": "off",
5
+ "@typescript-eslint/no-explicit-any": "off",
6
+ */
@@ -49,5 +49,6 @@ export * from "./modules/tokenizer/types/range";
49
49
  export * from "./modules/tokenizer/types/TokenizerAnnotationData";
50
50
  export * from "./modules/typed/interfaces/ITypedTreeHandler";
51
51
  export * from "./modules/typed/interfaces/SchemaAndSideEffects";
52
+ export * from "./IStreamConsumer";
52
53
  export * from "./normalizeText";
53
54
  export * from "./toJSON";
package/dist/src/index.js CHANGED
@@ -61,5 +61,6 @@ __exportStar(require("./modules/tokenizer/types/range"), exports);
61
61
  __exportStar(require("./modules/tokenizer/types/TokenizerAnnotationData"), exports);
62
62
  __exportStar(require("./modules/typed/interfaces/ITypedTreeHandler"), exports);
63
63
  __exportStar(require("./modules/typed/interfaces/SchemaAndSideEffects"), exports);
64
+ __exportStar(require("./IStreamConsumer"), exports);
64
65
  __exportStar(require("./normalizeText"), exports);
65
66
  __exportStar(require("./toJSON"), exports);
@@ -1,6 +1,28 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createExpectContext = void 0;
23
+ /* eslint
24
+ */
25
+ const pr = __importStar(require("pareto-runtime"));
4
26
  const DiagnosticSeverity_1 = require("../../diagnosticSeverity/types/DiagnosticSeverity");
5
27
  const expectSeverity_1 = require("../types/expectSeverity");
6
28
  const onDuplicateEntry_1 = require("../types/onDuplicateEntry");
@@ -100,7 +122,7 @@ function createCreateContext(issueHandler, createDummyPropertyHandler, createDum
100
122
  hasErrors = true;
101
123
  raiseError(["unexpected property", {
102
124
  "found key": $$.token.data.value,
103
- "valid keys": Object.keys(properties).sort(),
125
+ "valid keys": pr.Objectkeys(properties).sort(),
104
126
  }], $$.token.annotation);
105
127
  if (onUnexpectedProperty !== undefined) {
106
128
  return onUnexpectedProperty($$);
@@ -150,7 +172,7 @@ function createCreateContext(issueHandler, createDummyPropertyHandler, createDum
150
172
  return vh;
151
173
  },
152
174
  objectEnd: (endData) => {
153
- Object.keys(properties).forEach((epName) => {
175
+ pr.Objectkeys(properties).forEach((epName) => {
154
176
  if (!foundProperies.includes(epName)) {
155
177
  const ep = properties[epName];
156
178
  if (ep.onNotExists === null) {
@@ -187,7 +209,7 @@ function createCreateContext(issueHandler, createDummyPropertyHandler, createDum
187
209
  let index = 0;
188
210
  return {
189
211
  element: () => {
190
- const ee2 = elements[index];
212
+ const ee2 = pr.getElement(elements, index);
191
213
  index++;
192
214
  if (ee2 === undefined) {
193
215
  const dvh = createDummyValueHandler();
@@ -227,7 +249,7 @@ function createCreateContext(issueHandler, createDummyPropertyHandler, createDum
227
249
  }),
228
250
  }], $$.token.annotation);
229
251
  for (let x = index; x !== elements.length; x += 1) {
230
- const ee2 = elements[x];
252
+ const ee2 = pr.getElement(elements, x);
231
253
  ee2.getHandler().missing();
232
254
  }
233
255
  }
@@ -264,7 +286,7 @@ function createCreateContext(issueHandler, createDummyPropertyHandler, createDum
264
286
  if (optionHandler === undefined) {
265
287
  raiseError(["unknown option", {
266
288
  "found": optionData.token.data.value,
267
- "valid options": options ? Object.keys(options) : [],
289
+ "valid options": options ? pr.Objectkeys(options) : [],
268
290
  }], optionData.token.annotation);
269
291
  if (onUnexpectedOption !== undefined) {
270
292
  onUnexpectedOption({
@@ -1,7 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createCodeCompletionsGenerator = void 0;
4
23
  const stringSerialization_1 = require("../../serializers/functions/stringSerialization");
24
+ const pr = __importStar(require("pareto-runtime"));
5
25
  function assertUnreachable(_x) {
6
26
  throw new Error("unreachable");
7
27
  }
@@ -151,7 +171,7 @@ function createAlternativesRoot() {
151
171
  function ser(seed, s, add) {
152
172
  let out = seed;
153
173
  for (let i = 0; i !== s.length; i += 1) {
154
- const step = s[i];
174
+ const step = pr.getElement(s, i);
155
175
  switch (step[0]) {
156
176
  case "block":
157
177
  cc(step[1], (step2) => {
@@ -179,7 +199,7 @@ function createAlternativesRoot() {
179
199
  cc(step[1], (step2) => {
180
200
  const temp = [];
181
201
  for (let j = 0; j !== step2.alts.length; j += 1) {
182
- const alt = step2.alts[j];
202
+ const alt = pr.getElement(step2.alts, j);
183
203
  ser(out, alt, (str) => temp.push(str));
184
204
  }
185
205
  out = temp;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.marshallDataset = void 0;
7
+ const pareto_runtime_1 = require("pareto-runtime");
7
8
  function assertUnreachable(_x) {
8
9
  throw new Error("unreachable");
9
10
  }
@@ -68,7 +69,7 @@ function onValueIsNonDefault(value, definition, callback) {
68
69
  if (lines.length > 1) {
69
70
  callback();
70
71
  }
71
- if (lines.length === 1 && lines[0] !== "") {
72
+ if (lines.length === 1 && (0, pareto_runtime_1.getElement)(lines, 0) !== "") {
72
73
  callback();
73
74
  }
74
75
  });
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createTreeParser = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  function assertUnreachable(_x) {
5
25
  throw new Error("unreachable");
6
26
  }
@@ -114,7 +134,7 @@ function createTreeParser(treeHandler, onError, createUnexpectedValueHandler, on
114
134
  }
115
135
  case "taggedunion": {
116
136
  if (currentContext[1].state[0] !== "expecting value") {
117
- console.error("HANDLE UNEXPECTED TAGGED UNION VALUE END");
137
+ pr.logError("HANDLE UNEXPECTED TAGGED UNION VALUE END");
118
138
  }
119
139
  closeTaggedUnionImp(annotation);
120
140
  break;
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.serializeSchema = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  function assertUnreachable(_x) {
5
25
  throw new Error("unreachable");
6
26
  }
@@ -22,7 +42,7 @@ function serializeSchema(schema, sendEvent) {
22
42
  sendEvent(["open object", {
23
43
  type: ["verbose group"],
24
44
  }]);
25
- Object.keys(properties).sort().forEach((key) => {
45
+ pr.Objectkeys(properties).sort().forEach((key) => {
26
46
  sendEvent(["simple string", {
27
47
  value: key,
28
48
  wrapping: ["apostrophe", {}],
@@ -60,14 +60,14 @@ function createJSONFormatter(indentationString, newline, writer) {
60
60
  token: (() => {
61
61
  switch ($.token.data.wrapping[0]) {
62
62
  case "none": {
63
- if ($.token.data.value === "true" || $.token.data.value === "false" || $.token.data.value === "null") {
64
- return $.token.data.value;
65
- }
66
- //eslint-disable-next-line
67
- const nr = new Number($.token.data.value).valueOf();
68
- if (isNaN(nr)) {
69
- return (0, stringSerialization_1.createSerializedQuotedString)($.token.data.value);
70
- }
63
+ // if ($.token.data.value === "true" || $.token.data.value === "false" || $.token.data.value === "null") {
64
+ // return $.token.data.value
65
+ // }
66
+ // //eslint-disable-next-line
67
+ // const nr = new Number($.token.data.value).valueOf()
68
+ // if (isNaN(nr)) {
69
+ // return createSerializedQuotedString($.token.data.value)
70
+ // }
71
71
  return (0, stringSerialization_1.createSerializedNonWrappedString)($.token.data.value);
72
72
  }
73
73
  case "quote": {
@@ -1,51 +1,56 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createSerializedNonWrappedString = exports.createSerializedQuotedString = exports.createSerializedApostrophedString = exports.createSerializedMultilineString = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  function createSerializedMultilineString(lines, indentation) {
5
25
  //don't escape tabs, newlines!
6
- return `\`${lines.map((line, index) => `${index === 0 ? "" : indentation}${escapeCharacters(line, false, "`")}`).join("")}\``;
26
+ return `\`${lines.map((line, index) => `${index === 0 ? "" : indentation}${pr.escapeString({
27
+ str: line,
28
+ escapeTabsAndNewLines: false,
29
+ wrapperToEscape: "`",
30
+ })}`).join("")}\``;
7
31
  }
8
32
  exports.createSerializedMultilineString = createSerializedMultilineString;
9
33
  function createSerializedApostrophedString(str) {
10
- return `'${escapeCharacters(str, true, "'")}'`;
34
+ return `'${pr.escapeString({
35
+ str: str,
36
+ escapeTabsAndNewLines: true,
37
+ wrapperToEscape: "'",
38
+ })}'`;
11
39
  }
12
40
  exports.createSerializedApostrophedString = createSerializedApostrophedString;
13
41
  function createSerializedQuotedString(str) {
14
- return `"${escapeCharacters(str, true, "\"")}"`;
42
+ return `"${pr.escapeString({
43
+ str: str,
44
+ escapeTabsAndNewLines: true,
45
+ wrapperToEscape: "\"",
46
+ })}"`;
15
47
  }
16
48
  exports.createSerializedQuotedString = createSerializedQuotedString;
17
49
  function createSerializedNonWrappedString(str) {
18
- return escapeCharacters(str, false, null);
50
+ return pr.escapeString({
51
+ str: str,
52
+ escapeTabsAndNewLines: false,
53
+ wrapperToEscape: null,
54
+ });
19
55
  }
20
56
  exports.createSerializedNonWrappedString = createSerializedNonWrappedString;
21
- function escapeCharacters(str, escapeTabsAndNewLines, wrapperToEscape) {
22
- let out = "";
23
- for (let i = 0; i !== str.length; i += 1) {
24
- const curChar = str.charCodeAt(i);
25
- //solidus characters ( / ) are not escaped!
26
- //backspace and form feed are escaped using the hexadecimal notation, not the shorthands \b and \f
27
- if (str[i] === "\\") {
28
- out += "\\\\";
29
- }
30
- else if (str[i] === wrapperToEscape) {
31
- out += "\\" + wrapperToEscape;
32
- }
33
- else if (str[i] === "\n") {
34
- out += escapeTabsAndNewLines ? "\\n" : str[i];
35
- }
36
- else if (str[i] === "\r") {
37
- out += escapeTabsAndNewLines ? "\\r" : str[i];
38
- }
39
- else if (str[i] === "\t") {
40
- out += escapeTabsAndNewLines ? "\\t" : str[i];
41
- }
42
- else if (str.charCodeAt(i) < 32) {
43
- //control character (some of them have already been escaped above)
44
- out += "\\u" + curChar.toString(16).toUpperCase().padStart(4, "0");
45
- }
46
- else {
47
- out += str[i];
48
- }
49
- }
50
- return out;
51
- }
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createMarshallInterface = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  function createMarshallInterface(ds) {
5
25
  function createValueSerializeInterface(value) {
6
26
  return {
@@ -12,11 +32,11 @@ function createMarshallInterface(ds) {
12
32
  callback({
13
33
  entries: {
14
34
  forEach: (callback2) => {
15
- Object.keys(dict).forEach((key) => {
35
+ pr.Objectkeys(dict).forEach((key) => {
16
36
  callback2(createValueSerializeInterface(dict[key]), key);
17
37
  });
18
38
  },
19
- isEmpty: () => Object.keys(dict).length === 0,
39
+ isEmpty: () => pr.Objectkeys(dict).length === 0,
20
40
  },
21
41
  });
22
42
  },
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.createPreTokenizer = void 0;
2
23
  /* eslint
3
24
  complexity:"off",
4
25
  no-console:"off",
5
26
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createPreTokenizer = void 0;
27
+ const pr = __importStar(require("pareto-runtime"));
8
28
  const PreToken_1 = require("../types/PreToken");
9
29
  function assertUnreachable(_x) {
10
30
  throw new Error("unreachable");
@@ -663,7 +683,7 @@ function createPreTokenizer(locationState, onError) {
663
683
  onError({
664
684
  error: {
665
685
  type: ["expected special character after escape slash", {
666
- found: String.fromCharCode(nextChar),
686
+ found: pr.StringFromCharCode(nextChar),
667
687
  }],
668
688
  },
669
689
  range: getCurrentCharacterRange(locationState),
@@ -684,17 +704,17 @@ function createPreTokenizer(locationState, onError) {
684
704
  onError({
685
705
  error: {
686
706
  type: ["expected hexadecimal digit", {
687
- found: String.fromCharCode(nextChar),
707
+ found: pr.StringFromCharCode(nextChar),
688
708
  }],
689
709
  },
690
710
  range: getCurrentCharacterRange(locationState),
691
711
  });
692
712
  }
693
- const nextCharAsString = String.fromCharCode(nextChar);
713
+ const nextCharAsString = pr.StringFromCharCode(nextChar);
694
714
  $.unicode.foundCharacters += nextCharAsString;
695
715
  $.unicode.charactersLeft--;
696
716
  if ($.unicode.charactersLeft === 0) {
697
- const textNode = String.fromCharCode(parseInt($.unicode.foundCharacters, 16));
717
+ const textNode = pr.StringFromCharCode(pr.parseNumber($.unicode.foundCharacters, 16));
698
718
  $.unicode = null;
699
719
  return {
700
720
  startSnippet: false,
@@ -779,7 +799,7 @@ function createPreTokenizer(locationState, onError) {
779
799
  preToken: changeCurrentTokenType([TokenType.NONE, { foundNewlineCharacter: null, foundSolidus: null }], {
780
800
  type: [PreToken_1.PreTokenDataType.WrappedStringEnd, {
781
801
  range: rangeInfo,
782
- wrapper: String.fromCharCode(nextChar),
802
+ wrapper: pr.StringFromCharCode(nextChar),
783
803
  }],
784
804
  }),
785
805
  };
@@ -1,6 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createValueUnmarshaller = exports.defaultInitializeValue = void 0;
23
+ /* eslint
24
+ "@typescript-eslint/no-shadow": "off"
25
+ */
26
+ const pr = __importStar(require("pareto-runtime"));
4
27
  const dummyHandlers_1 = require("../../parser/functions/dummyHandlers");
5
28
  const DiagnosticSeverity_1 = require("../../diagnosticSeverity/types/DiagnosticSeverity");
6
29
  const ShorthandParsingState_1 = require("../states/ShorthandParsingState");
@@ -425,7 +448,7 @@ function createValueUnmarshaller(definition, handler, onError, flagNonDefaultPro
425
448
  flagNonDefaultPropertiesFound();
426
449
  }
427
450
  else {
428
- if ($e.token.data.lines.length === 1 && $e.token.data.lines[0] !== "") {
451
+ if ($e.token.data.lines.length === 1 && pr.getElement($e.token.data.lines, 0) !== "") {
429
452
  flagNonDefaultPropertiesFound();
430
453
  }
431
454
  }
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
22
  exports.createShorthandParsingState = void 0;
23
+ const pr = __importStar(require("pareto-runtime"));
4
24
  const DiagnosticSeverity_1 = require("../../diagnosticSeverity/types/DiagnosticSeverity");
5
25
  const createValueUnmarshaller_1 = require("../functions/createValueUnmarshaller");
6
26
  function assertUnreachable(_x) {
@@ -56,7 +76,7 @@ function createShorthandParsingState(groupDefinition, groupHandler) {
56
76
  if (missing > 0) {
57
77
  onError(["missing elements", { elements: $.elements.slice($.index).map((ee) => ee.name) }], annotation, DiagnosticSeverity_1.DiagnosticSeverity.error);
58
78
  for (let x = $.index; x !== $.elements.length; x += 1) {
59
- const ee = $.elements[x];
79
+ const ee = pr.getElement($.elements, x);
60
80
  (0, createValueUnmarshaller_1.defaultInitializeValue)(ee.definition, ee.handler.onProperty({
61
81
  key: ee.name,
62
82
  token: null,
@@ -97,7 +117,7 @@ function createShorthandParsingState(groupDefinition, groupHandler) {
97
117
  switch (stateImp.currentContext[0]) {
98
118
  case "group":
99
119
  const $ = stateImp.currentContext[1];
100
- const ee = $.elements[$.index];
120
+ const ee = pr.getElement($.elements, $.index);
101
121
  $.index++;
102
122
  if (ee !== undefined) {
103
123
  return {
@@ -20,19 +20,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.runProgram = void 0;
23
- const stream = __importStar(require("stream"));
23
+ const pr = __importStar(require("pareto-runtime"));
24
24
  function runProgram(createStreamConsumer) {
25
- const ssp = createStreamConsumer((str) => process.stdout.write(str), (str) => console.error(str));
26
- process.stdin.setEncoding("utf-8");
27
- process.stdin.pipe(new stream.Writable({
28
- defaultEncoding: "utf-8",
29
- write: function (data, _encoding, callback) {
30
- //eslint-disable-next-line
31
- ssp.onData(data.toString());
32
- callback();
33
- },
34
- })).on('finish', () => {
35
- ssp.onEnd(null);
36
- });
25
+ const stdOut = pr.createStdOut();
26
+ const stdErr = pr.createStdOut();
27
+ const ssp = createStreamConsumer((str) => stdOut.write(str), (str) => stdErr.write(str));
28
+ pr.subscribeToStdIn(ssp);
37
29
  }
38
30
  exports.runProgram = runProgram;
package/package.json CHANGED
@@ -1,18 +1,32 @@
1
1
  {
2
- "name": "astn",
3
- "description": "tools for handling ASTN files, including a SAX-style parser",
4
- "author": "corno",
5
- "contributors": [],
6
- "version": "0.89.0",
7
- "main": "./dist/src/index.js",
8
- "homepage": "https://github.com/corno/astn",
9
- "repository": {
10
- "type": "git",
11
- "url": "http://github.com/corno/astn.git"
2
+ "author": "Corno",
3
+ "bin": {
4
+ "astn-normalize": "bin/normalizeFile.mjs",
5
+ "astn-to-json": "bin/toJSON.mjs"
12
6
  },
13
7
  "bugs": {
14
8
  "url": "http://github.com/corno/astn/issues"
15
9
  },
10
+ "dependencies": {
11
+ "pareto-runtime": "^0.0.4"
12
+ },
13
+ "description": "tools for handling ASTN files, including a SAX-style parser",
14
+ "devDependencies": {
15
+ "@typescript-eslint/eslint-plugin": "^5.3.0",
16
+ "@typescript-eslint/eslint-plugin-tslint": "^5.3.0",
17
+ "@typescript-eslint/parser": "^5.3.0",
18
+ "eslint": "^8.1.0",
19
+ "pareto-test": "^0.0.4",
20
+ "tslint": "^6.1.3",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "directories": {
24
+ "test": "test"
25
+ },
26
+ "engines": {
27
+ "node": ">=8.0.0"
28
+ },
29
+ "homepage": "https://github.com/corno/astn",
16
30
  "keywords": [
17
31
  "ASTN",
18
32
  "tools",
@@ -25,48 +39,31 @@
25
39
  "sum",
26
40
  "type"
27
41
  ],
28
- "types": "dist/src/index.d.ts",
29
- "devDependencies": {
30
- "@types/chai": "^4.2.22",
31
- "@types/mocha": "^9.0.0",
32
- "@types/node": "^16.11.6",
33
- "@typescript-eslint/eslint-plugin": "^5.2.0",
34
- "@typescript-eslint/eslint-plugin-tslint": "^5.2.0",
35
- "@typescript-eslint/parser": "^5.2.0",
36
- "chai": "^4.3.4",
37
- "eslint": "^8.1.0",
38
- "mocha": "^9.1.3",
39
- "should": "13.2.x",
40
- "tslint": "^6.1.3",
41
- "typescript": "^4.4.4"
42
+ "license": "BSD-2-Clause",
43
+ "main": "./dist/src/index.js",
44
+ "name": "astn",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "http://github.com/corno/astn.git"
42
48
  },
43
49
  "scripts": {
44
50
  "build": "rm -rf ./dist && tsc",
45
- "lint": "node ./node_modules/eslint/bin/eslint.js .",
46
51
  "buildLintAndTest": "npm run build && npm run lint && npm run test",
47
- "validatePublishReadiness": "git diff --exit-code && ncu -u --packageFile package.json --timeout 120000 && npm install && npm run buildLintAndTest",
52
+ "generateASTNSchema": "astn-expand ./src/modules/schema/etc/schema.astn | astn-generate > ./src/modules/schema/astnschema@0.1",
53
+ "lint": "node ./node_modules/eslint/bin/eslint.js .",
48
54
  "pubMin": "npm run validatePublishReadiness && npm version minor && git push && npm publish",
49
55
  "pubPatch": "npm run validatePublishReadiness && npm version patch && git push && npm publish",
50
56
  "test": "tsc && npm run testJSONTestSuite && npm run testOwnSuite && npm run testFormatting && npm run testTyped2 && npm run testTyped",
51
- "testOwnSuite": "node ./node_modules/mocha/bin/mocha dist/test/testTestSets.js",
52
57
  "testFormatting": "node ./node_modules/mocha/bin/mocha dist/test/testFormatting.js",
58
+ "testJSONTestSuite": "node ./node_modules/mocha/bin/mocha dist/test/JSONTestSuite.js",
59
+ "testOwnSuite": "node ./node_modules/mocha/bin/mocha dist/test/testTestSets.js",
53
60
  "testTyped": "node ./node_modules/mocha/bin/mocha dist/test/testTyped.js",
54
61
  "testTyped2": "node ./node_modules/mocha/bin/mocha dist/test/typed.js",
55
- "testJSONTestSuite": "node ./node_modules/mocha/bin/mocha dist/test/JSONTestSuite.js",
56
62
  "update2latest": "ncu -u --packageFile package.json --timeout 60000 && nsi && tsc",
57
63
  "update2latestAndPublishMinor": "npm run validatePublishReadiness && npm run update2latest && npm run test && git commit -am \"u2l\" && npm run pubMin",
58
64
  "update2latestAndPublishPath": "npm run validatePublishReadiness && npm run update2latest && npm run test && git commit -am \"u2l\" && npm run pubPatch",
59
- "generateASTNSchema": "astn-expand ./src/modules/schema/etc/schema.astn | astn-generate > ./src/modules/schema/astnschema@0.1"
65
+ "validatePublishReadiness": "git diff --exit-code && ncu -u --packageFile package.json --timeout 120000 && npm install && npm run buildLintAndTest"
60
66
  },
61
- "engines": {
62
- "node": ">=8.0.0"
63
- },
64
- "directories": {
65
- "test": "test"
66
- },
67
- "license": "BSD-2-Clause",
68
- "bin": {
69
- "astn-normalize": "bin/normalizeFile.mjs",
70
- "astn-to-json": "bin/toJSON.mjs"
71
- }
67
+ "types": "dist/src/index.d.ts",
68
+ "version": "0.90.0"
72
69
  }
package/AUTHORS DELETED
@@ -1,3 +0,0 @@
1
- Corno <corno@schraverus.com>
2
- Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com/)
3
- Jann Horn <jannhorn@googlemail.com>
package/LICENSE DELETED
@@ -1,28 +0,0 @@
1
- Copyright (c) Isaac Z. Schlueter ("Author")
2
- Copyright (c) 2011 nuno job <nunojob.com>
3
- All rights reserved.
4
-
5
- The BSD License
6
-
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions
9
- are met:
10
-
11
- 1. Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
-
14
- 2. Redistributions in binary form must reproduce the above copyright
15
- notice, this list of conditions and the following disclaimer in the
16
- documentation and/or other materials provided with the distribution.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
22
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28
- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.