ot-builder-cli 1.7.4 → 1.7.5
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.
- package/lib/create-grammar.d.ts +1 -1
- package/lib/create-grammar.js +4 -2
- package/lib/index.js +1 -1
- package/lib/package-version.d.ts +1 -1
- package/lib/package-version.js +8 -5
- package/lib/sub-parsers/unicode-ranges/generated.js +79 -77
- package/lib/syntax/composite/start.d.ts +2 -1
- package/lib/syntax/composite/start.js +3 -3
- package/lib/syntax/document/version.js +1 -1
- package/package.json +6 -6
package/lib/create-grammar.d.ts
CHANGED
package/lib/create-grammar.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGrammar = createGrammar;
|
|
4
|
+
const package_version_1 = require("./package-version");
|
|
4
5
|
const consolidate_1 = require("./syntax/actions/consolidate");
|
|
5
6
|
const drop_1 = require("./syntax/actions/drop");
|
|
6
7
|
const gc_1 = require("./syntax/actions/gc");
|
|
@@ -28,7 +29,7 @@ const cliActionJoiner = {
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
// Grammar Creator
|
|
31
|
-
function createGrammar() {
|
|
32
|
+
async function createGrammar() {
|
|
32
33
|
const element = new alternate_1.AlternateSyntax([
|
|
33
34
|
intro_1.IntroSyntax,
|
|
34
35
|
save_1.SaveSyntax,
|
|
@@ -43,7 +44,8 @@ function createGrammar() {
|
|
|
43
44
|
set_optimize_level_1.SetOptimizationLevelSyntax,
|
|
44
45
|
set_recalc_os2_avg_char_width_1.SetRecalcOs2AvgCharWidthSyntax
|
|
45
46
|
]);
|
|
46
|
-
const
|
|
47
|
+
const appVersion = await (0, package_version_1.getPackageVersion)();
|
|
48
|
+
const start = new start_1.StartSyntax(appVersion, new alternate_1.AlternateSyntax([
|
|
47
49
|
help_1.HelpSyntax,
|
|
48
50
|
version_1.VersionSyntax,
|
|
49
51
|
new main_command_1.MainCommandSyntax(new possessive_repeat_1.PossessiveRepeatSyntax(cliActionJoiner, element))
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const create_grammar_1 = require("./create-grammar");
|
|
|
6
6
|
const state_1 = require("./state");
|
|
7
7
|
async function cliMain(argv) {
|
|
8
8
|
const parse = (0, argv_parser_1.StartParseArgv)(argv, 2);
|
|
9
|
-
const syntax = (0, create_grammar_1.createGrammar)();
|
|
9
|
+
const syntax = await (0, create_grammar_1.createGrammar)();
|
|
10
10
|
const prAction = syntax.start.handle(parse, syntax);
|
|
11
11
|
if (!prAction.progress.isEof()) {
|
|
12
12
|
console.error("! Unrecognizable argument/option. Stop.");
|
package/lib/package-version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function getPackageVersion(): Promise<string>;
|
|
2
2
|
//# sourceMappingURL=package-version.d.ts.map
|
package/lib/package-version.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
6
|
-
const
|
|
7
|
-
|
|
3
|
+
exports.getPackageVersion = getPackageVersion;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
async function getPackageVersion() {
|
|
7
|
+
const moduleDir = path.join(__dirname, "..");
|
|
8
|
+
const json = JSON.parse(await fs.promises.readFile(path.join(moduleDir, "package.json"), "utf-8"));
|
|
9
|
+
return json.version;
|
|
10
|
+
}
|
|
8
11
|
//# sourceMappingURL=package-version.js.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* AutoGenerated Code, changes may be overwritten
|
|
3
|
-
* INPUT GRAMMAR:
|
|
4
|
-
* ---
|
|
5
|
-
* import { RangeDecl } from "./datatypes";
|
|
6
|
-
* ---
|
|
7
|
-
* start := __ rgs=Ranges __
|
|
8
|
-
* .ranges = RangeDecl[] { return this.rgs.ranges }
|
|
9
|
-
* Ranges := car=Range Separator cdr=Ranges
|
|
10
|
-
* .ranges = RangeDecl[] { return [this.car.codeRange, ...this.cdr.ranges] }
|
|
11
|
-
* | range=Range
|
|
12
|
-
* .ranges = RangeDecl[] { return [this.range.codeRange] }
|
|
13
|
-
* Range := _ exclude='-'? _ start=CodePoint _ '..' _ end=CodePoint _
|
|
14
|
-
* .codeRange = RangeDecl {
|
|
15
|
-
* return {
|
|
16
|
-
* isExclusion: !!this.exclude,
|
|
17
|
-
* start: this.start.value,
|
|
18
|
-
* end:this.end.value
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* | _ exclude='-'? _ at=CodePoint _
|
|
22
|
-
* .codeRange = RangeDecl {
|
|
23
|
-
* return { isExclusion: !!this.exclude, start: this.at.value, end:this.at.value }
|
|
24
|
-
* }
|
|
25
|
-
* CodePoint := Prefix? literal='[0-9A-Fa-f]+'
|
|
26
|
-
* .value = number { return parseInt(this.literal, 16) }
|
|
27
|
-
* Prefix := 'U\+' | '0x' | '0X'
|
|
28
|
-
* Separator := _ '[,;]' __
|
|
29
|
-
* | ___
|
|
30
|
-
* _ := '[ \t]*'
|
|
31
|
-
* __ := '(?:[ \t]|(?:#[^\r\n]*)?[\r\n])*'
|
|
32
|
-
* ___ := _ '(?:#[^\r\n]*)?[\r\n]' __
|
|
33
|
-
*/
|
|
3
|
+
* INPUT GRAMMAR:
|
|
4
|
+
* ---
|
|
5
|
+
* import { RangeDecl } from "./datatypes";
|
|
6
|
+
* ---
|
|
7
|
+
* start := __ rgs=Ranges __
|
|
8
|
+
* .ranges = RangeDecl[] { return this.rgs.ranges }
|
|
9
|
+
* Ranges := car=Range Separator cdr=Ranges
|
|
10
|
+
* .ranges = RangeDecl[] { return [this.car.codeRange, ...this.cdr.ranges] }
|
|
11
|
+
* | range=Range
|
|
12
|
+
* .ranges = RangeDecl[] { return [this.range.codeRange] }
|
|
13
|
+
* Range := _ exclude='-'? _ start=CodePoint _ '..' _ end=CodePoint _
|
|
14
|
+
* .codeRange = RangeDecl {
|
|
15
|
+
* return {
|
|
16
|
+
* isExclusion: !!this.exclude,
|
|
17
|
+
* start: this.start.value,
|
|
18
|
+
* end:this.end.value
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* | _ exclude='-'? _ at=CodePoint _
|
|
22
|
+
* .codeRange = RangeDecl {
|
|
23
|
+
* return { isExclusion: !!this.exclude, start: this.at.value, end:this.at.value }
|
|
24
|
+
* }
|
|
25
|
+
* CodePoint := Prefix? literal='[0-9A-Fa-f]+'
|
|
26
|
+
* .value = number { return parseInt(this.literal, 16) }
|
|
27
|
+
* Prefix := 'U\+' | '0x' | '0X'
|
|
28
|
+
* Separator := _ '[,;]' __
|
|
29
|
+
* | ___
|
|
30
|
+
* _ := '[ \t]*'
|
|
31
|
+
* __ := '(?:[ \t]|(?:#[^\r\n]*)?[\r\n])*'
|
|
32
|
+
* ___ := _ '(?:#[^\r\n]*)?[\r\n]' __
|
|
33
|
+
*/
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.SyntaxErr = exports.Parser = exports.CodePoint = exports.Range_2 = exports.Range_1 = exports.Ranges_2 = exports.Ranges_1 = exports.start = exports.ASTKinds = void 0;
|
|
36
36
|
exports.parse = parse;
|
|
@@ -157,10 +157,10 @@ class Parser {
|
|
|
157
157
|
return this.run($$dpth, () => {
|
|
158
158
|
let $scope$rgs;
|
|
159
159
|
let $$res = null;
|
|
160
|
-
if (true
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
if (true &&
|
|
161
|
+
this.match__($$dpth + 1, $$cr) !== null &&
|
|
162
|
+
($scope$rgs = this.matchRanges($$dpth + 1, $$cr)) !== null &&
|
|
163
|
+
this.match__($$dpth + 1, $$cr) !== null) {
|
|
164
164
|
$$res = new start($scope$rgs);
|
|
165
165
|
}
|
|
166
166
|
return $$res;
|
|
@@ -171,7 +171,7 @@ class Parser {
|
|
|
171
171
|
return this.memoise(() => {
|
|
172
172
|
return this.choice([
|
|
173
173
|
() => this.matchRanges_1($$dpth + 1, $$cr),
|
|
174
|
-
() => this.matchRanges_2($$dpth + 1, $$cr)
|
|
174
|
+
() => this.matchRanges_2($$dpth + 1, $$cr)
|
|
175
175
|
]);
|
|
176
176
|
}, this.$scope$Ranges$memo);
|
|
177
177
|
}
|
|
@@ -180,10 +180,10 @@ class Parser {
|
|
|
180
180
|
let $scope$car;
|
|
181
181
|
let $scope$cdr;
|
|
182
182
|
let $$res = null;
|
|
183
|
-
if (true
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
if (true &&
|
|
184
|
+
($scope$car = this.matchRange($$dpth + 1, $$cr)) !== null &&
|
|
185
|
+
this.matchSeparator($$dpth + 1, $$cr) !== null &&
|
|
186
|
+
($scope$cdr = this.matchRanges($$dpth + 1, $$cr)) !== null) {
|
|
187
187
|
$$res = new Ranges_1($scope$car, $scope$cdr);
|
|
188
188
|
}
|
|
189
189
|
return $$res;
|
|
@@ -193,8 +193,7 @@ class Parser {
|
|
|
193
193
|
return this.run($$dpth, () => {
|
|
194
194
|
let $scope$range;
|
|
195
195
|
let $$res = null;
|
|
196
|
-
if (true
|
|
197
|
-
&& ($scope$range = this.matchRange($$dpth + 1, $$cr)) !== null) {
|
|
196
|
+
if (true && ($scope$range = this.matchRange($$dpth + 1, $$cr)) !== null) {
|
|
198
197
|
$$res = new Ranges_2($scope$range);
|
|
199
198
|
}
|
|
200
199
|
return $$res;
|
|
@@ -204,7 +203,7 @@ class Parser {
|
|
|
204
203
|
return this.memoise(() => {
|
|
205
204
|
return this.choice([
|
|
206
205
|
() => this.matchRange_1($$dpth + 1, $$cr),
|
|
207
|
-
() => this.matchRange_2($$dpth + 1, $$cr)
|
|
206
|
+
() => this.matchRange_2($$dpth + 1, $$cr)
|
|
208
207
|
]);
|
|
209
208
|
}, this.$scope$Range$memo);
|
|
210
209
|
}
|
|
@@ -214,16 +213,17 @@ class Parser {
|
|
|
214
213
|
let $scope$start;
|
|
215
214
|
let $scope$end;
|
|
216
215
|
let $$res = null;
|
|
217
|
-
if (true
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
216
|
+
if (true &&
|
|
217
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
218
|
+
(($scope$exclude = this.regexAccept(String.raw `(?:-)`, $$dpth + 1, $$cr)) ||
|
|
219
|
+
true) &&
|
|
220
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
221
|
+
($scope$start = this.matchCodePoint($$dpth + 1, $$cr)) !== null &&
|
|
222
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
223
|
+
this.regexAccept(String.raw `(?:..)`, $$dpth + 1, $$cr) !== null &&
|
|
224
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
225
|
+
($scope$end = this.matchCodePoint($$dpth + 1, $$cr)) !== null &&
|
|
226
|
+
this.match_($$dpth + 1, $$cr) !== null) {
|
|
227
227
|
$$res = new Range_1($scope$exclude, $scope$start, $scope$end);
|
|
228
228
|
}
|
|
229
229
|
return $$res;
|
|
@@ -234,12 +234,13 @@ class Parser {
|
|
|
234
234
|
let $scope$exclude;
|
|
235
235
|
let $scope$at;
|
|
236
236
|
let $$res = null;
|
|
237
|
-
if (true
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
if (true &&
|
|
238
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
239
|
+
(($scope$exclude = this.regexAccept(String.raw `(?:-)`, $$dpth + 1, $$cr)) ||
|
|
240
|
+
true) &&
|
|
241
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
242
|
+
($scope$at = this.matchCodePoint($$dpth + 1, $$cr)) !== null &&
|
|
243
|
+
this.match_($$dpth + 1, $$cr) !== null) {
|
|
243
244
|
$$res = new Range_2($scope$exclude, $scope$at);
|
|
244
245
|
}
|
|
245
246
|
return $$res;
|
|
@@ -250,9 +251,9 @@ class Parser {
|
|
|
250
251
|
return this.run($$dpth, () => {
|
|
251
252
|
let $scope$literal;
|
|
252
253
|
let $$res = null;
|
|
253
|
-
if (true
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
if (true &&
|
|
255
|
+
(this.matchPrefix($$dpth + 1, $$cr) || true) &&
|
|
256
|
+
($scope$literal = this.regexAccept(String.raw `(?:[0-9A-Fa-f]+)`, $$dpth + 1, $$cr)) !== null) {
|
|
256
257
|
$$res = new CodePoint($scope$literal);
|
|
257
258
|
}
|
|
258
259
|
return $$res;
|
|
@@ -264,7 +265,7 @@ class Parser {
|
|
|
264
265
|
return this.choice([
|
|
265
266
|
() => this.matchPrefix_1($$dpth + 1, $$cr),
|
|
266
267
|
() => this.matchPrefix_2($$dpth + 1, $$cr),
|
|
267
|
-
() => this.matchPrefix_3($$dpth + 1, $$cr)
|
|
268
|
+
() => this.matchPrefix_3($$dpth + 1, $$cr)
|
|
268
269
|
]);
|
|
269
270
|
}, this.$scope$Prefix$memo);
|
|
270
271
|
}
|
|
@@ -281,18 +282,18 @@ class Parser {
|
|
|
281
282
|
return this.memoise(() => {
|
|
282
283
|
return this.choice([
|
|
283
284
|
() => this.matchSeparator_1($$dpth + 1, $$cr),
|
|
284
|
-
() => this.matchSeparator_2($$dpth + 1, $$cr)
|
|
285
|
+
() => this.matchSeparator_2($$dpth + 1, $$cr)
|
|
285
286
|
]);
|
|
286
287
|
}, this.$scope$Separator$memo);
|
|
287
288
|
}
|
|
288
289
|
matchSeparator_1($$dpth, $$cr) {
|
|
289
290
|
return this.run($$dpth, () => {
|
|
290
291
|
let $$res = null;
|
|
291
|
-
if (true
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
$$res = { kind: ASTKinds.Separator_1
|
|
292
|
+
if (true &&
|
|
293
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
294
|
+
this.regexAccept(String.raw `(?:[,;])`, $$dpth + 1, $$cr) !== null &&
|
|
295
|
+
this.match__($$dpth + 1, $$cr) !== null) {
|
|
296
|
+
$$res = { kind: ASTKinds.Separator_1 };
|
|
296
297
|
}
|
|
297
298
|
return $$res;
|
|
298
299
|
});
|
|
@@ -314,11 +315,12 @@ class Parser {
|
|
|
314
315
|
return this.memoise(() => {
|
|
315
316
|
return this.run($$dpth, () => {
|
|
316
317
|
let $$res = null;
|
|
317
|
-
if (true
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
$$
|
|
318
|
+
if (true &&
|
|
319
|
+
this.match_($$dpth + 1, $$cr) !== null &&
|
|
320
|
+
this.regexAccept(String.raw `(?:(?:#[^\r\n]*)?[\r\n])`, $$dpth + 1, $$cr) !==
|
|
321
|
+
null &&
|
|
322
|
+
this.match__($$dpth + 1, $$cr) !== null) {
|
|
323
|
+
$$res = { kind: ASTKinds.___ };
|
|
322
324
|
}
|
|
323
325
|
return $$res;
|
|
324
326
|
});
|
|
@@ -391,7 +393,7 @@ class Parser {
|
|
|
391
393
|
// We substring from 3 to len - 1 to strip off the
|
|
392
394
|
// non-capture group syntax added as a WebKit workaround
|
|
393
395
|
literal: match.substring(3, match.length - 1),
|
|
394
|
-
negated: this.negating
|
|
396
|
+
negated: this.negating
|
|
395
397
|
});
|
|
396
398
|
}
|
|
397
399
|
return res;
|
|
@@ -411,7 +413,7 @@ class Parser {
|
|
|
411
413
|
this.pos = {
|
|
412
414
|
overallPos: reg.lastIndex,
|
|
413
415
|
line: this.pos.line + lineJmp,
|
|
414
|
-
offset: lind === -1 ? this.pos.offset + res[0].length :
|
|
416
|
+
offset: lind === -1 ? this.pos.offset + res[0].length : res[0].length - lind - 1
|
|
415
417
|
};
|
|
416
418
|
return res[0];
|
|
417
419
|
}
|
|
@@ -456,7 +458,7 @@ class SyntaxErr {
|
|
|
456
458
|
this.expmatches = [...expmatches];
|
|
457
459
|
}
|
|
458
460
|
toString() {
|
|
459
|
-
return `Syntax Error at line ${this.pos.line}:${this.pos.offset}. Expected one of ${this.expmatches.map(x => x.kind === "EOF" ? " EOF" : ` ${x.negated ?
|
|
461
|
+
return `Syntax Error at line ${this.pos.line}:${this.pos.offset}. Expected one of ${this.expmatches.map(x => (x.kind === "EOF" ? " EOF" : ` ${x.negated ? "not " : ""}'${x.literal}'`))}`;
|
|
460
462
|
}
|
|
461
463
|
}
|
|
462
464
|
exports.SyntaxErr = SyntaxErr;
|
|
@@ -2,8 +2,9 @@ import { CliHelpShower } from "@ot-builder/cli-help-shower";
|
|
|
2
2
|
import { ParseState } from "../../argv-parser";
|
|
3
3
|
import { Grammar, Syntax } from "../../command";
|
|
4
4
|
export declare class StartSyntax<T> implements Syntax<T> {
|
|
5
|
+
private readonly appVersion;
|
|
5
6
|
private readonly body;
|
|
6
|
-
constructor(body: Syntax<T>);
|
|
7
|
+
constructor(appVersion: string, body: Syntax<T>);
|
|
7
8
|
handle(st0: ParseState, grammar: Grammar): import("../../argv-parser").ParseResult<T>;
|
|
8
9
|
displayHelp(shower: CliHelpShower): void;
|
|
9
10
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StartSyntax = void 0;
|
|
4
4
|
const cli_help_shower_1 = require("@ot-builder/cli-help-shower");
|
|
5
|
-
const package_version_1 = require("../../package-version");
|
|
6
5
|
class StartSyntax {
|
|
7
|
-
constructor(body) {
|
|
6
|
+
constructor(appVersion, body) {
|
|
7
|
+
this.appVersion = appVersion;
|
|
8
8
|
this.body = body;
|
|
9
9
|
}
|
|
10
10
|
handle(st0, grammar) {
|
|
@@ -13,7 +13,7 @@ class StartSyntax {
|
|
|
13
13
|
displayHelp(shower) {
|
|
14
14
|
shower
|
|
15
15
|
.message()
|
|
16
|
-
.message('ot-builder CLI utility program "otb-cli",', "version",
|
|
16
|
+
.message('ot-builder CLI utility program "otb-cli",', "version", this.appVersion)
|
|
17
17
|
.message(cli_help_shower_1.Style.Rule)
|
|
18
18
|
.message(`Usage :`);
|
|
19
19
|
this.body.displayHelp(shower);
|
|
@@ -9,7 +9,7 @@ exports.VersionSyntax = {
|
|
|
9
9
|
if (!st.isOption("--version", "-v"))
|
|
10
10
|
return (0, argv_parser_1.ParseResult)(st, null);
|
|
11
11
|
return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
|
|
12
|
-
console.log(package_version_1.
|
|
12
|
+
console.log(await (0, package_version_1.getPackageVersion)());
|
|
13
13
|
});
|
|
14
14
|
},
|
|
15
15
|
displayHelp(shower) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ot-builder-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"bin": {
|
|
5
5
|
"otb-cli": "./bin/otb-cli"
|
|
6
6
|
},
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"tslib": "^2.
|
|
30
|
-
"ot-builder": "1.7.
|
|
31
|
-
"@ot-builder/cli-help-shower": "1.7.
|
|
32
|
-
"@ot-builder/cli-shared": "1.7.
|
|
29
|
+
"tslib": "^2.8.1",
|
|
30
|
+
"ot-builder": "1.7.5",
|
|
31
|
+
"@ot-builder/cli-help-shower": "1.7.5",
|
|
32
|
+
"@ot-builder/cli-shared": "1.7.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/jest": "^29.5.
|
|
35
|
+
"@types/jest": "^29.5.14",
|
|
36
36
|
"jest": "^29.7.0"
|
|
37
37
|
}
|
|
38
38
|
}
|