aontu 0.29.0 → 0.30.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/dist/aontu.d.ts +17 -13
- package/dist/aontu.js +145 -60
- package/dist/aontu.js.map +1 -1
- package/package.json +18 -34
- package/aontu.ts +0 -92
- package/dist/lib/err.d.ts +0 -4
- package/dist/lib/err.js +0 -61
- package/dist/lib/err.js.map +0 -1
- package/dist/lib/lang.d.ts +0 -15
- package/dist/lib/lang.js +0 -409
- package/dist/lib/lang.js.map +0 -1
- package/dist/lib/op/disjunct.d.ts +0 -3
- package/dist/lib/op/disjunct.js +0 -28
- package/dist/lib/op/disjunct.js.map +0 -1
- package/dist/lib/op/op.d.ts +0 -6
- package/dist/lib/op/op.js +0 -9
- package/dist/lib/op/op.js.map +0 -1
- package/dist/lib/op/unite.d.ts +0 -3
- package/dist/lib/op/unite.js +0 -100
- package/dist/lib/op/unite.js.map +0 -1
- package/dist/lib/type.d.ts +0 -49
- package/dist/lib/type.js +0 -7
- package/dist/lib/type.js.map +0 -1
- package/dist/lib/unify.d.ts +0 -38
- package/dist/lib/unify.js +0 -67
- package/dist/lib/unify.js.map +0 -1
- package/dist/lib/utility.d.ts +0 -3
- package/dist/lib/utility.js +0 -16
- package/dist/lib/utility.js.map +0 -1
- package/dist/lib/val/ConjunctVal.d.ts +0 -17
- package/dist/lib/val/ConjunctVal.js +0 -171
- package/dist/lib/val/ConjunctVal.js.map +0 -1
- package/dist/lib/val/DisjunctVal.d.ts +0 -17
- package/dist/lib/val/DisjunctVal.js +0 -95
- package/dist/lib/val/DisjunctVal.js.map +0 -1
- package/dist/lib/val/ListVal.d.ts +0 -18
- package/dist/lib/val/ListVal.js +0 -120
- package/dist/lib/val/ListVal.js.map +0 -1
- package/dist/lib/val/MapVal.d.ts +0 -18
- package/dist/lib/val/MapVal.js +0 -117
- package/dist/lib/val/MapVal.js.map +0 -1
- package/dist/lib/val/Nil.d.ts +0 -22
- package/dist/lib/val/Nil.js +0 -84
- package/dist/lib/val/Nil.js.map +0 -1
- package/dist/lib/val/NullVal.d.ts +0 -15
- package/dist/lib/val/NullVal.js +0 -38
- package/dist/lib/val/NullVal.js.map +0 -1
- package/dist/lib/val/OpVal.d.ts +0 -17
- package/dist/lib/val/OpVal.js +0 -89
- package/dist/lib/val/OpVal.js.map +0 -1
- package/dist/lib/val/PlusVal.d.ts +0 -12
- package/dist/lib/val/PlusVal.js +0 -32
- package/dist/lib/val/PlusVal.js.map +0 -1
- package/dist/lib/val/PrefVal.d.ts +0 -17
- package/dist/lib/val/PrefVal.js +0 -87
- package/dist/lib/val/PrefVal.js.map +0 -1
- package/dist/lib/val/RefVal.d.ts +0 -22
- package/dist/lib/val/RefVal.js +0 -247
- package/dist/lib/val/RefVal.js.map +0 -1
- package/dist/lib/val/ValBase.d.ts +0 -26
- package/dist/lib/val/ValBase.js +0 -77
- package/dist/lib/val/ValBase.js.map +0 -1
- package/dist/lib/val/VarVal.d.ts +0 -15
- package/dist/lib/val/VarVal.js +0 -84
- package/dist/lib/val/VarVal.js.map +0 -1
- package/dist/lib/val.d.ts +0 -81
- package/dist/lib/val.js +0 -191
- package/dist/lib/val.js.map +0 -1
- package/lib/err.ts +0 -83
- package/lib/lang.ts +0 -585
- package/lib/op/disjunct.ts +0 -51
- package/lib/op/op.ts +0 -18
- package/lib/op/unite.ts +0 -143
- package/lib/type.ts +0 -95
- package/lib/unify.ts +0 -128
- package/lib/utility.ts +0 -24
- package/lib/val/ConjunctVal.ts +0 -265
- package/lib/val/DisjunctVal.ts +0 -160
- package/lib/val/ListVal.ts +0 -196
- package/lib/val/MapVal.ts +0 -181
- package/lib/val/Nil.ts +0 -144
- package/lib/val/NullVal.ts +0 -72
- package/lib/val/OpVal.ts +0 -159
- package/lib/val/PlusVal.ts +0 -76
- package/lib/val/PrefVal.ts +0 -154
- package/lib/val/RefVal.ts +0 -362
- package/lib/val/ValBase.ts +0 -109
- package/lib/val/VarVal.ts +0 -157
- package/lib/val.ts +0 -327
package/lib/val/NullVal.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
Val,
|
|
7
|
-
ValSpec,
|
|
8
|
-
} from '../type'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
Context,
|
|
12
|
-
} from '../unify'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { Nil } from '../val/Nil'
|
|
17
|
-
import { ValBase } from '../val/ValBase'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class NullVal extends ValBase {
|
|
21
|
-
isNullVal = true
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
spec: {
|
|
25
|
-
peg: null
|
|
26
|
-
},
|
|
27
|
-
ctx?: Context
|
|
28
|
-
) {
|
|
29
|
-
super(spec, ctx)
|
|
30
|
-
this.peg = null
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
unify(peer: Val, ctx: Context): Val {
|
|
35
|
-
let out: Val
|
|
36
|
-
|
|
37
|
-
if ((peer as any).isTop || (peer as NullVal).isNullVal) {
|
|
38
|
-
out = this
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
out = Nil.make(ctx, 'null', this, peer)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return out
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
same(peer: Val): boolean {
|
|
49
|
-
return null == peer ? false : peer instanceof NullVal && this.peg === peer.peg
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
clone(spec?: ValSpec, ctx?: Context): Val {
|
|
54
|
-
let out = (super.clone(spec, ctx) as NullVal)
|
|
55
|
-
return out
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
get canon() {
|
|
60
|
-
return '' + this.peg
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
gen(_ctx?: Context) {
|
|
65
|
-
return null
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
NullVal,
|
|
72
|
-
}
|
package/lib/val/OpVal.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2024 Richard Rodger, MIT License */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type {
|
|
5
|
-
Val,
|
|
6
|
-
ValSpec,
|
|
7
|
-
} from '../type'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
DONE,
|
|
11
|
-
} from '../type'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
descErr
|
|
15
|
-
} from '../err'
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
Context,
|
|
19
|
-
} from '../unify'
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
unite
|
|
23
|
-
} from '../op/op'
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
TOP,
|
|
27
|
-
StringVal,
|
|
28
|
-
} from '../val'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import { ConjunctVal } from '../val/ConjunctVal'
|
|
32
|
-
import { MapVal } from '../val/MapVal'
|
|
33
|
-
import { Nil } from '../val/Nil'
|
|
34
|
-
import { VarVal } from '../val/VarVal'
|
|
35
|
-
import { ValBase } from '../val/ValBase'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class OpVal extends ValBase {
|
|
42
|
-
isOpVal = true
|
|
43
|
-
|
|
44
|
-
constructor(
|
|
45
|
-
spec: {
|
|
46
|
-
peg: any[],
|
|
47
|
-
},
|
|
48
|
-
ctx?: Context
|
|
49
|
-
) {
|
|
50
|
-
super(spec, ctx)
|
|
51
|
-
this.peg = []
|
|
52
|
-
|
|
53
|
-
for (let pI = 0; pI < spec.peg.length; pI++) {
|
|
54
|
-
this.append(spec.peg[pI])
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
append(part: any) {
|
|
60
|
-
this.peg.push(part)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
unify(peer: Val, ctx: Context): Val {
|
|
65
|
-
let out: Val = this
|
|
66
|
-
|
|
67
|
-
if (this.id !== peer.id) {
|
|
68
|
-
let result: Val | undefined = null == ctx ? this : this.operate(ctx)
|
|
69
|
-
|
|
70
|
-
result = result || this
|
|
71
|
-
|
|
72
|
-
if (null == result && this.canon === peer.canon) {
|
|
73
|
-
out = this
|
|
74
|
-
}
|
|
75
|
-
else if (result instanceof OpVal) {
|
|
76
|
-
if (TOP === peer) {
|
|
77
|
-
out = this
|
|
78
|
-
}
|
|
79
|
-
else if (peer instanceof Nil) {
|
|
80
|
-
out = Nil.make(ctx, 'op[' + this.peg + ']', this, peer)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
else if (this.canon === peer.canon) {
|
|
84
|
-
out = this
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
else {
|
|
88
|
-
this.done = DONE === this.done ? DONE : this.done + 1
|
|
89
|
-
out = new ConjunctVal({ peg: [this, peer] }, ctx)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
out = unite(ctx, result, peer, 'op')
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
out.done = DONE === out.done ? DONE : this.done + 1
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return out
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
same(peer: Val): boolean {
|
|
104
|
-
return null == peer ? false : this.peg === peer.peg
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
clone(_spec?: ValSpec, ctx?: Context): Val {
|
|
109
|
-
let out = (super.clone({
|
|
110
|
-
peg: this.peg,
|
|
111
|
-
}, ctx) as OpVal)
|
|
112
|
-
return out
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
operate(ctx: Context): Val | undefined {
|
|
117
|
-
this.peg = this.peg.map((v: any) => v.isRefVal ? v.unify(TOP, ctx) : v)
|
|
118
|
-
return undefined
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
get canon() {
|
|
124
|
-
return ''
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
gen(ctx?: Context) {
|
|
129
|
-
// Unresolved op cannot be generated, so always an error.
|
|
130
|
-
let nil = Nil.make(
|
|
131
|
-
ctx,
|
|
132
|
-
'op',
|
|
133
|
-
this,
|
|
134
|
-
undefined
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
// TODO: refactor to use Site
|
|
138
|
-
nil.path = this.path
|
|
139
|
-
nil.url = this.url
|
|
140
|
-
nil.row = this.row
|
|
141
|
-
nil.col = this.col
|
|
142
|
-
|
|
143
|
-
descErr(nil, ctx)
|
|
144
|
-
|
|
145
|
-
if (ctx) {
|
|
146
|
-
ctx.err.push(nil)
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
throw new Error(nil.msg)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return undefined
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export {
|
|
158
|
-
OpVal,
|
|
159
|
-
}
|
package/lib/val/PlusVal.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2024 Richard Rodger, MIT License */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type {
|
|
5
|
-
Val,
|
|
6
|
-
ValSpec,
|
|
7
|
-
} from '../type'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
DONE,
|
|
11
|
-
} from '../type'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
descErr
|
|
15
|
-
} from '../err'
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
Context,
|
|
19
|
-
} from '../unify'
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
unite
|
|
23
|
-
} from '../op/op'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { TOP, IntegerVal, NumberVal, StringVal } from '../val'
|
|
27
|
-
import { Nil } from '../val/Nil'
|
|
28
|
-
import { OpVal } from '../val/OpVal'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class PlusVal extends OpVal {
|
|
35
|
-
isOpVal = true
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
spec: {
|
|
39
|
-
peg: any[],
|
|
40
|
-
},
|
|
41
|
-
ctx?: Context
|
|
42
|
-
) {
|
|
43
|
-
super(spec, ctx)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
operate(ctx: Context) {
|
|
48
|
-
super.operate(ctx)
|
|
49
|
-
|
|
50
|
-
if (this.peg.find((v: any) => v.isRefVal)) {
|
|
51
|
-
return undefined
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let peg = this.peg[0].peg + this.peg[1].peg
|
|
55
|
-
let pegtype = typeof peg
|
|
56
|
-
if ('string' === pegtype) {
|
|
57
|
-
return new StringVal({ peg })
|
|
58
|
-
}
|
|
59
|
-
else if ('number' === pegtype) {
|
|
60
|
-
return Number.isInteger(peg) ? new IntegerVal({ peg }) : new NumberVal({ peg })
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return undefined
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
get canon() {
|
|
68
|
-
return this.peg[0].canon + '+' + this.peg[1].canon
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
PlusVal,
|
|
76
|
-
}
|
package/lib/val/PrefVal.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/* Copyright (c) 2021-2023 Richard Rodger, MIT License */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
Val,
|
|
7
|
-
ValSpec,
|
|
8
|
-
} from '../type'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
DONE,
|
|
12
|
-
} from '../type'
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
descErr
|
|
16
|
-
} from '../err'
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
Context,
|
|
20
|
-
} from '../unify'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
Site
|
|
25
|
-
} from '../lang'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
unite
|
|
30
|
-
} from '../op/op'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// import { TOP } from '../val'
|
|
35
|
-
// import { ConjunctVal } from '../val/ConjunctVal'
|
|
36
|
-
// import { DisjunctVal } from '../val/DisjunctVal'
|
|
37
|
-
// import { ListVal } from '../val/ListVal'
|
|
38
|
-
// import { MapVal } from '../val/MapVal'
|
|
39
|
-
import { Nil } from '../val/Nil'
|
|
40
|
-
// import { RefVal } from '../val/RefVal'
|
|
41
|
-
import { ValBase } from '../val/ValBase'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class PrefVal extends ValBase {
|
|
45
|
-
isPrefVal = true
|
|
46
|
-
|
|
47
|
-
pref: Val
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
spec: {
|
|
51
|
-
peg: any,
|
|
52
|
-
pref?: any
|
|
53
|
-
},
|
|
54
|
-
ctx?: Context
|
|
55
|
-
) {
|
|
56
|
-
super(spec, ctx)
|
|
57
|
-
this.pref = spec.pref || spec.peg
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// PrefVal unify always returns a PrefVal
|
|
61
|
-
// PrefVals can only be removed by becoming Nil in a Disjunct
|
|
62
|
-
unify(peer: Val, ctx: Context): Val {
|
|
63
|
-
let done = true
|
|
64
|
-
let out: Val
|
|
65
|
-
|
|
66
|
-
if (peer instanceof PrefVal) {
|
|
67
|
-
out = new PrefVal(
|
|
68
|
-
{
|
|
69
|
-
peg: unite(ctx, this.peg, peer.peg, 'Pref000'),
|
|
70
|
-
pref: unite(ctx, this.pref, peer.pref, 'Pref010'),
|
|
71
|
-
},
|
|
72
|
-
ctx
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
else {
|
|
77
|
-
out = new PrefVal(
|
|
78
|
-
{
|
|
79
|
-
// TODO: find a better way to drop Nil non-errors
|
|
80
|
-
peg: unite(ctx?.clone({ err: [] }), this.peg, peer, 'Pref020'),
|
|
81
|
-
pref: unite(ctx?.clone({ err: [] }), this.pref, peer, 'Pref030'),
|
|
82
|
-
},
|
|
83
|
-
ctx
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
done = done && DONE === out.peg.done &&
|
|
88
|
-
(null != (out as PrefVal).pref ? DONE === (out as PrefVal).pref.done : true)
|
|
89
|
-
|
|
90
|
-
if (out.peg instanceof Nil) {
|
|
91
|
-
out = (out as PrefVal).pref
|
|
92
|
-
}
|
|
93
|
-
else if ((out as PrefVal).pref instanceof Nil) {
|
|
94
|
-
out = out.peg
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
out.done = done ? DONE : this.done + 1
|
|
98
|
-
|
|
99
|
-
return out
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
same(peer: Val): boolean {
|
|
104
|
-
if (null == peer) {
|
|
105
|
-
return false
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
let pegsame = (this.peg === peer.peg) ||
|
|
109
|
-
(this.peg instanceof ValBase && this.peg.same(peer.peg))
|
|
110
|
-
|
|
111
|
-
let prefsame = peer instanceof PrefVal &&
|
|
112
|
-
((this.pref === peer.pref) ||
|
|
113
|
-
(this.pref instanceof ValBase && this.pref.same(peer.pref)))
|
|
114
|
-
|
|
115
|
-
return pegsame && prefsame
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
clone(spec?: ValSpec, ctx?: Context): Val {
|
|
120
|
-
let out = (super.clone(spec, ctx) as PrefVal)
|
|
121
|
-
out.pref = this.pref.clone(null, ctx)
|
|
122
|
-
return out
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
get canon() {
|
|
127
|
-
return this.pref instanceof Nil ? this.peg.canon : '*' + this.pref.canon
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
gen(ctx?: Context) {
|
|
131
|
-
let val = !(this.pref instanceof Nil) ? this.pref :
|
|
132
|
-
(!(this.peg instanceof Nil) ? this.peg :
|
|
133
|
-
this.pref)
|
|
134
|
-
|
|
135
|
-
if (val instanceof Nil) {
|
|
136
|
-
descErr(val, ctx)
|
|
137
|
-
|
|
138
|
-
if (ctx) {
|
|
139
|
-
ctx.err.push(val)
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
throw new Error(val.msg)
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return val.gen(ctx)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export {
|
|
153
|
-
PrefVal,
|
|
154
|
-
}
|