aontu 0.0.7 → 0.1.1
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/aontu.ts +33 -13
- package/dist/aontu.d.ts +4 -6
- package/dist/aontu.js +30 -5
- package/dist/aontu.js.map +1 -1
- package/dist/aontu.min.js +63 -1
- package/dist/lib/common.d.ts +4 -4
- package/dist/lib/lang.d.ts +11 -2
- package/dist/lib/lang.js +306 -199
- package/dist/lib/lang.js.map +1 -1
- package/dist/lib/op/disjunct.d.ts +3 -0
- package/dist/lib/op/disjunct.js +28 -0
- package/dist/lib/op/disjunct.js.map +1 -0
- package/dist/lib/op/op.d.ts +6 -0
- package/dist/lib/op/op.js +9 -0
- package/dist/lib/op/op.js.map +1 -0
- package/dist/lib/op/unite.d.ts +3 -0
- package/dist/lib/op/unite.js +53 -0
- package/dist/lib/op/unite.js.map +1 -0
- package/dist/lib/unify.d.ts +18 -4
- package/dist/lib/unify.js +32 -8
- package/dist/lib/unify.js.map +1 -1
- package/dist/lib/val.d.ts +59 -44
- package/dist/lib/val.js +377 -220
- package/dist/lib/val.js.map +1 -1
- package/lib/common.ts +7 -5
- package/lib/lang.ts +360 -211
- package/lib/op/disjunct.ts +39 -0
- package/lib/op/op.ts +17 -0
- package/lib/op/unite.ts +82 -0
- package/lib/unify.ts +70 -10
- package/lib/val.ts +488 -244
- package/package.json +16 -13
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2021 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.disjunct = void 0;
|
|
5
|
+
const lang_1 = require("../lang");
|
|
6
|
+
const val_1 = require("../val");
|
|
7
|
+
const disjunct = (ctx, a, b) => {
|
|
8
|
+
let peers = [];
|
|
9
|
+
let origsites = [];
|
|
10
|
+
origsites.push(append(peers, a));
|
|
11
|
+
origsites.push(append(peers, b));
|
|
12
|
+
let out = new val_1.DisjunctVal(peers, ctx, origsites);
|
|
13
|
+
return out;
|
|
14
|
+
};
|
|
15
|
+
exports.disjunct = disjunct;
|
|
16
|
+
function append(peers, v) {
|
|
17
|
+
let origsite = lang_1.Site.NONE;
|
|
18
|
+
if (v instanceof val_1.DisjunctVal) {
|
|
19
|
+
peers.push(...v.peg);
|
|
20
|
+
origsite = v.site;
|
|
21
|
+
}
|
|
22
|
+
// TODO: handle no-error Nil (drop) and error Nil (keep and become)
|
|
23
|
+
else if (v instanceof val_1.Val) {
|
|
24
|
+
peers.push(v);
|
|
25
|
+
}
|
|
26
|
+
return origsite;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=disjunct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disjunct.js","sourceRoot":"","sources":["../../../lib/op/disjunct.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAGpD,kCAA8B;AAE9B,gCAAyC;AAIzC,MAAM,QAAQ,GAAc,CAAC,GAAa,EAAE,CAAO,EAAE,CAAO,EAAE,EAAE;IAC9D,IAAI,KAAK,GAAU,EAAE,CAAA;IACrB,IAAI,SAAS,GAAW,EAAE,CAAA;IAC1B,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;IAChC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;IAChC,IAAI,GAAG,GAAG,IAAI,iBAAW,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;IAChD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAqBC,4BAAQ;AAlBV,SAAS,MAAM,CAAC,KAAY,EAAE,CAAO;IACnC,IAAI,QAAQ,GAAS,WAAI,CAAC,IAAI,CAAA;IAE9B,IAAI,CAAC,YAAY,iBAAW,EAAE;QAC5B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;QACpB,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAA;KAClB;IAED,mEAAmE;SAC9D,IAAI,CAAC,YAAY,SAAG,EAAE;QACzB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KACd;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2021 Richard Rodger, MIT License. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.unite = exports.disjunct = void 0;
|
|
5
|
+
const disjunct_1 = require("./disjunct");
|
|
6
|
+
Object.defineProperty(exports, "disjunct", { enumerable: true, get: function () { return disjunct_1.disjunct; } });
|
|
7
|
+
const unite_1 = require("./unite");
|
|
8
|
+
Object.defineProperty(exports, "unite", { enumerable: true, get: function () { return unite_1.unite; } });
|
|
9
|
+
//# sourceMappingURL=op.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op.js","sourceRoot":"","sources":["../../../lib/op/op.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAMrD,yCAAqC;AAQnC,yFARO,mBAAQ,OAQP;AAPV,mCAA+B;AAQ7B,sFARO,aAAK,OAQP"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2021 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.unite = void 0;
|
|
5
|
+
const val_1 = require("../val");
|
|
6
|
+
// Vals should only have to unify downwards (in .unify) over Vals they understand.
|
|
7
|
+
// and for complex Vals, TOP, which means self unify if not yet done
|
|
8
|
+
const unite = (ctx, a, b) => {
|
|
9
|
+
let out = a;
|
|
10
|
+
//console.log('Ua', a && a.canon, b && b.canon)
|
|
11
|
+
if (b && (val_1.TOP === a || !a)) {
|
|
12
|
+
//console.log('Utb', b.canon)
|
|
13
|
+
out = b;
|
|
14
|
+
}
|
|
15
|
+
else if (a && (val_1.TOP === b || !b)) {
|
|
16
|
+
//console.log('Uta', a.canon)
|
|
17
|
+
out = a;
|
|
18
|
+
}
|
|
19
|
+
else if (a && b && val_1.TOP !== b) {
|
|
20
|
+
if (a instanceof val_1.Nil) {
|
|
21
|
+
out = update(a, b);
|
|
22
|
+
}
|
|
23
|
+
else if (b instanceof val_1.Nil) {
|
|
24
|
+
out = update(b, a);
|
|
25
|
+
}
|
|
26
|
+
else if (b instanceof val_1.ConjunctVal ||
|
|
27
|
+
b instanceof val_1.DisjunctVal ||
|
|
28
|
+
b instanceof val_1.RefVal ||
|
|
29
|
+
b instanceof val_1.PrefVal) {
|
|
30
|
+
//console.log('U', a.canon, b.canon)
|
|
31
|
+
return b.unify(a, ctx);
|
|
32
|
+
}
|
|
33
|
+
else if (a.constructor === b.constructor && a.peg === b.peg) {
|
|
34
|
+
out = update(a, b);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
out = a.unify(b, ctx);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!out) {
|
|
41
|
+
out = val_1.Nil.make(ctx, 'unite', a, b);
|
|
42
|
+
}
|
|
43
|
+
if (val_1.DONE !== out.done) {
|
|
44
|
+
out = out.unify(val_1.TOP, ctx);
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
};
|
|
48
|
+
exports.unite = unite;
|
|
49
|
+
function update(x, _y) {
|
|
50
|
+
// TODO: update x with y.site
|
|
51
|
+
return x;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=unite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unite.js","sourceRoot":"","sources":["../../../lib/op/unite.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAKpD,gCAUe;AAIf,kFAAkF;AAClF,oEAAoE;AACpE,MAAM,KAAK,GAAc,CAAC,GAAY,EAAE,CAAO,EAAE,CAAO,EAAE,EAAE;IA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CAAC,KAAK,CAAC,SAAG,EAAE,GAAG,CAAC,CAAA;KAC1B;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAUC,sBAAK;AAPP,SAAS,MAAM,CAAC,CAAM,EAAE,EAAO;IAC7B,6BAA6B;IAC7B,OAAO,CAAC,CAAA;AACV,CAAC"}
|
package/dist/lib/unify.d.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import { Val, RefVal, MapVal } from './val';
|
|
1
|
+
import { Val, RefVal, MapVal, Nil } from './val';
|
|
2
2
|
import { Lang } from './lang';
|
|
3
|
+
declare type Path = string[];
|
|
3
4
|
declare class Context {
|
|
4
|
-
root:
|
|
5
|
-
|
|
5
|
+
root: Val;
|
|
6
|
+
path: Path;
|
|
7
|
+
err: Nil[];
|
|
8
|
+
vc: number;
|
|
9
|
+
constructor(cfg: {
|
|
10
|
+
root: Val;
|
|
11
|
+
err?: Nil[];
|
|
12
|
+
vc?: number;
|
|
13
|
+
});
|
|
14
|
+
clone(cfg: {
|
|
15
|
+
root: Val;
|
|
16
|
+
path?: Path;
|
|
17
|
+
}): Context;
|
|
18
|
+
descend(key: string): Context;
|
|
6
19
|
find(ref: RefVal): MapVal | undefined;
|
|
7
20
|
}
|
|
8
21
|
declare class Unify {
|
|
9
22
|
root: Val;
|
|
10
23
|
res: Val;
|
|
24
|
+
err: Nil[];
|
|
11
25
|
dc: number;
|
|
12
26
|
lang: Lang;
|
|
13
27
|
constructor(root: Val | string, lang?: Lang);
|
|
14
28
|
}
|
|
15
|
-
export { Context, Unify, };
|
|
29
|
+
export { Context, Path, Unify, };
|
package/dist/lib/unify.js
CHANGED
|
@@ -4,18 +4,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Unify = exports.Context = void 0;
|
|
5
5
|
const val_1 = require("./val");
|
|
6
6
|
const lang_1 = require("./lang");
|
|
7
|
+
const op_1 = require("./op/op");
|
|
7
8
|
class Context {
|
|
8
9
|
constructor(cfg) {
|
|
9
10
|
this.root = cfg.root;
|
|
11
|
+
this.path = [];
|
|
12
|
+
this.err = cfg.err || [];
|
|
13
|
+
// Multiple unify passes will keep incrementing Val counter.
|
|
14
|
+
this.vc = null == cfg.vc ? 1000000000 : cfg.vc;
|
|
15
|
+
}
|
|
16
|
+
clone(cfg) {
|
|
17
|
+
return new Context({
|
|
18
|
+
root: cfg.root,
|
|
19
|
+
err: this.err,
|
|
20
|
+
vc: this.vc,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
descend(key) {
|
|
24
|
+
return this.clone({
|
|
25
|
+
root: this.root,
|
|
26
|
+
path: this.path.concat(key),
|
|
27
|
+
});
|
|
10
28
|
}
|
|
11
29
|
find(ref) {
|
|
12
30
|
// TODO: relative paths
|
|
13
|
-
if (ref.absolute) {
|
|
31
|
+
if (this.root instanceof val_1.MapVal && ref.absolute) {
|
|
14
32
|
let node = this.root;
|
|
15
33
|
let pI = 0;
|
|
16
34
|
for (; pI < ref.parts.length && node instanceof val_1.MapVal; pI++) {
|
|
17
35
|
let part = ref.parts[pI];
|
|
18
|
-
node = node.
|
|
36
|
+
node = node.peg[part];
|
|
19
37
|
}
|
|
20
38
|
if (pI === ref.parts.length) {
|
|
21
39
|
return node;
|
|
@@ -26,19 +44,25 @@ class Context {
|
|
|
26
44
|
exports.Context = Context;
|
|
27
45
|
class Unify {
|
|
28
46
|
constructor(root, lang) {
|
|
29
|
-
this.dc = 0;
|
|
30
47
|
this.lang = lang || new lang_1.Lang();
|
|
31
48
|
if ('string' === typeof root) {
|
|
32
49
|
root = this.lang.parse(root);
|
|
33
50
|
}
|
|
34
51
|
this.root = root;
|
|
35
52
|
this.res = root;
|
|
53
|
+
this.err = [];
|
|
36
54
|
let res = root;
|
|
37
|
-
let ctx
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
let ctx = new Context({
|
|
56
|
+
root: res,
|
|
57
|
+
err: this.err,
|
|
58
|
+
});
|
|
59
|
+
// TODO: derive maxdc from res deterministically
|
|
60
|
+
// perhaps parse should count intial vals, paths, etc?
|
|
61
|
+
let maxdc = 999;
|
|
62
|
+
for (this.dc = 0; this.dc < maxdc && val_1.DONE !== res.done; this.dc++) {
|
|
63
|
+
//res = res.unify(TOP, ctx)
|
|
64
|
+
res = (0, op_1.unite)(ctx, res, val_1.TOP);
|
|
65
|
+
ctx = ctx.clone({ root: res });
|
|
42
66
|
}
|
|
43
67
|
this.res = res;
|
|
44
68
|
}
|
package/dist/lib/unify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unify.js","sourceRoot":"","sources":["../../lib/unify.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAIpD,+
|
|
1
|
+
{"version":3,"file":"unify.js","sourceRoot":"","sources":["../../lib/unify.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAIpD,+BAOc;AAEd,iCAEe;AAEf,gCAEgB;AAOhB,MAAM,OAAO;IAOX,YAAY,GAIX;QACC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,CAAA;QAExB,4DAA4D;QAC5D,IAAI,CAAC,EAAE,GAAG,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,UAAa,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;IACnD,CAAC;IAGD,KAAK,CAAC,GAGL;QACC,OAAO,IAAI,OAAO,CAAC;YACjB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAC,CAAA;IACJ,CAAC;IAGD,OAAO,CAAC,GAAW;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf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G,CAAA;QACf,KAAK,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,UAAI,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE;YACjE,2BAA2B;YAC3B,GAAG,GAAG,IAAA,UAAK,EAAC,GAAG,EAAE,GAAG,EAAE,SAAG,CAAC,CAAA;YAC1B,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;SAC/B;QAGD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;CACF;AAMC,sBAAK"}
|
package/dist/lib/val.d.ts
CHANGED
|
@@ -1,100 +1,115 @@
|
|
|
1
1
|
import { Context } from './unify';
|
|
2
|
+
import { Site } from './lang';
|
|
3
|
+
declare type ValMap = {
|
|
4
|
+
[key: string]: Val;
|
|
5
|
+
};
|
|
2
6
|
declare const DONE = -1;
|
|
3
7
|
declare const TOP: Val;
|
|
4
8
|
declare abstract class Val {
|
|
5
|
-
|
|
6
|
-
val?: any;
|
|
9
|
+
id: number;
|
|
7
10
|
done: number;
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
path: string[];
|
|
12
|
+
row: number;
|
|
13
|
+
col: number;
|
|
14
|
+
url: string;
|
|
15
|
+
top?: boolean;
|
|
16
|
+
peg?: any;
|
|
17
|
+
err?: any[];
|
|
18
|
+
deps?: any;
|
|
19
|
+
constructor(peg?: any, ctx?: Context);
|
|
10
20
|
same(peer: Val): boolean;
|
|
11
|
-
|
|
21
|
+
get site(): Site;
|
|
22
|
+
abstract unify(peer: Val, ctx: Context): Val;
|
|
12
23
|
abstract get canon(): string;
|
|
13
|
-
abstract gen(
|
|
24
|
+
abstract gen(ctx?: Context): any;
|
|
14
25
|
}
|
|
15
26
|
declare class Nil extends Val {
|
|
27
|
+
nil: boolean;
|
|
16
28
|
why: any;
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
primary?: Val;
|
|
30
|
+
secondary?: Val;
|
|
31
|
+
static make: (ctx?: Context, why?: any, av?: Val, bv?: Val) => Nil;
|
|
32
|
+
constructor(why?: any, ctx?: Context);
|
|
33
|
+
unify(_peer: Val, _ctx: Context): this;
|
|
19
34
|
get canon(): string;
|
|
20
|
-
gen(
|
|
35
|
+
gen(_ctx?: Context): undefined;
|
|
21
36
|
}
|
|
22
37
|
declare class Integer {
|
|
23
38
|
}
|
|
24
39
|
declare type ScalarConstructor = StringConstructor | NumberConstructor | BooleanConstructor | (typeof Integer.constructor);
|
|
25
40
|
declare class ScalarTypeVal extends Val {
|
|
26
|
-
constructor(
|
|
27
|
-
unify(peer: Val,
|
|
41
|
+
constructor(peg: ScalarConstructor, ctx?: Context);
|
|
42
|
+
unify(peer: Val, ctx: Context): Val;
|
|
28
43
|
get canon(): any;
|
|
29
44
|
same(peer: Val): boolean;
|
|
30
|
-
gen(
|
|
45
|
+
gen(_ctx?: Context): undefined;
|
|
31
46
|
}
|
|
32
47
|
declare class ScalarVal<T> extends Val {
|
|
33
48
|
type: any;
|
|
34
|
-
constructor(
|
|
35
|
-
unify(peer: Val,
|
|
49
|
+
constructor(peg: T, type: ScalarConstructor, ctx?: Context);
|
|
50
|
+
unify(peer: Val, ctx: Context): Val;
|
|
36
51
|
get canon(): any;
|
|
37
52
|
same(peer: Val): boolean;
|
|
38
|
-
gen(
|
|
53
|
+
gen(_ctx?: Context): any;
|
|
39
54
|
}
|
|
40
55
|
declare class NumberVal extends ScalarVal<number> {
|
|
41
|
-
constructor(
|
|
42
|
-
unify(peer: Val,
|
|
56
|
+
constructor(peg: number, ctx?: Context);
|
|
57
|
+
unify(peer: Val, ctx: Context): Val;
|
|
43
58
|
}
|
|
44
59
|
declare class IntegerVal extends ScalarVal<number> {
|
|
45
|
-
constructor(
|
|
46
|
-
unify(peer: Val,
|
|
60
|
+
constructor(peg: number, ctx?: Context);
|
|
61
|
+
unify(peer: Val, ctx: Context): Val;
|
|
47
62
|
}
|
|
48
63
|
declare class StringVal extends ScalarVal<string> {
|
|
49
|
-
constructor(
|
|
50
|
-
unify(peer: Val,
|
|
64
|
+
constructor(peg: string, ctx?: Context);
|
|
65
|
+
unify(peer: Val, ctx: Context): Val;
|
|
51
66
|
get canon(): string;
|
|
52
67
|
}
|
|
53
68
|
declare class BooleanVal extends ScalarVal<boolean> {
|
|
54
|
-
constructor(
|
|
55
|
-
unify(peer: Val): Val;
|
|
69
|
+
constructor(peg: boolean, ctx?: Context);
|
|
70
|
+
unify(peer: Val, ctx: Context): Val;
|
|
56
71
|
static TRUE: BooleanVal;
|
|
57
72
|
static FALSE: BooleanVal;
|
|
58
73
|
}
|
|
59
74
|
declare class MapVal extends Val {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
75
|
+
static SPREAD: symbol;
|
|
76
|
+
spread: {
|
|
77
|
+
cj: Val | undefined;
|
|
78
|
+
};
|
|
79
|
+
constructor(peg: ValMap, ctx?: Context);
|
|
80
|
+
unify(peer: Val, ctx: Context): Val;
|
|
65
81
|
get canon(): string;
|
|
66
|
-
gen(
|
|
82
|
+
gen(ctx?: Context): any;
|
|
67
83
|
}
|
|
68
84
|
declare class ConjunctVal extends Val {
|
|
69
|
-
constructor(
|
|
85
|
+
constructor(peg: Val[], ctx?: Context);
|
|
70
86
|
append(peer: Val): ConjunctVal;
|
|
71
|
-
|
|
72
|
-
unify(peer: Val, ctx?: Context): Val;
|
|
87
|
+
unify(peer: Val, ctx: Context): Val;
|
|
73
88
|
get canon(): any;
|
|
74
|
-
gen(
|
|
89
|
+
gen(ctx?: Context): any;
|
|
75
90
|
}
|
|
76
91
|
declare class DisjunctVal extends Val {
|
|
77
|
-
constructor(
|
|
92
|
+
constructor(peg: Val[], ctx?: Context, _sites?: Site[]);
|
|
78
93
|
append(peer: Val): DisjunctVal;
|
|
79
|
-
|
|
80
|
-
unify(peer: Val, ctx?: Context): Val;
|
|
94
|
+
unify(peer: Val, ctx: Context): Val;
|
|
81
95
|
get canon(): any;
|
|
82
|
-
gen(
|
|
96
|
+
gen(ctx?: Context): any;
|
|
83
97
|
}
|
|
84
98
|
declare class RefVal extends Val {
|
|
85
99
|
parts: string[];
|
|
86
100
|
absolute: boolean;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
sep: string;
|
|
102
|
+
constructor(peg: any[], abs?: boolean);
|
|
103
|
+
append(part: any): void;
|
|
104
|
+
unify(peer: Val, ctx: Context): Val;
|
|
90
105
|
get canon(): any;
|
|
91
|
-
gen(
|
|
106
|
+
gen(_ctx?: Context): undefined;
|
|
92
107
|
}
|
|
93
108
|
declare class PrefVal extends Val {
|
|
94
109
|
pref: Val;
|
|
95
|
-
constructor(
|
|
96
|
-
unify(peer: Val, ctx
|
|
110
|
+
constructor(peg: any, pref?: any, ctx?: Context);
|
|
111
|
+
unify(peer: Val, ctx: Context): Val;
|
|
97
112
|
get canon(): any;
|
|
98
|
-
gen(
|
|
113
|
+
gen(ctx?: Context): any;
|
|
99
114
|
}
|
|
100
115
|
export { DONE, Integer, Val, TOP, Nil, ScalarTypeVal, NumberVal, StringVal, BooleanVal, IntegerVal, MapVal, ConjunctVal, DisjunctVal, RefVal, PrefVal, };
|