@king-one/form-antdv 0.0.3 → 0.0.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/CHANGELOG.md +13 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.mjs +4 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/contexts.mjs +15 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/destructor.mjs +72 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.mjs +317 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/matcher.mjs +83 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/parser.mjs +232 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/shared.mjs +62 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokenizer.mjs +192 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokens.mjs +140 -0
- package/dist/es/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/types.mjs +18 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs +47 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/array.mjs +124 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.mjs +43 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/delay.mjs +10 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/file.mjs +10 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/img.mjs +20 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/install.mjs +19 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/number.mjs +18 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/uid.mjs +11 -0
- package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/validate.mjs +6 -0
- package/dist/es/node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.mjs +648 -0
- package/dist/es/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue2.mjs +24 -23
- package/dist/es/packages/form-antdv/src/components/ArrayCard/index.mjs +13 -0
- package/dist/es/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue2.mjs +17 -16
- package/dist/es/packages/form-antdv/src/components/ArrayTable/index.mjs +13 -0
- package/dist/es/packages/form-antdv/src/components/DateRange/index.mjs +12 -0
- package/dist/es/packages/form-antdv/src/components/FormArea/index.mjs +11 -0
- package/dist/es/packages/form-antdv/src/components/Input/index.mjs +12 -0
- package/dist/es/packages/form-antdv/src/components/InputNumber/index.mjs +12 -0
- package/dist/es/packages/form-antdv/src/components/Select/index.mjs +15 -0
- package/dist/es/packages/form-antdv/src/internal.mjs +2 -0
- package/dist/es/packages/form-render/src/components/FormProvider.vue.mjs +4 -0
- package/dist/es/packages/form-render/src/components/FormProvider.vue2.mjs +39 -0
- package/dist/es/packages/form-render/src/components/SchemaField.mjs +31 -0
- package/dist/es/packages/form-render/src/components/propsType.mjs +34 -0
- package/dist/es/packages/form-render/src/components/widget/ArrayField.mjs +40 -0
- package/dist/es/packages/form-render/src/components/widget/ErrorField.mjs +14 -0
- package/dist/es/packages/form-render/src/components/widget/Field.mjs +43 -0
- package/dist/es/packages/form-render/src/components/widget/FormItem.mjs +48 -0
- package/dist/es/packages/form-render/src/components/widget/ObjectField.mjs +54 -0
- package/dist/es/packages/form-render/src/components/widget/RecursionField.mjs +31 -0
- package/dist/es/packages/form-render/src/components/widget/index.mjs +8 -0
- package/dist/es/packages/form-render/src/context/field.mjs +12 -0
- package/dist/es/packages/form-render/src/context/form.mjs +12 -0
- package/dist/es/packages/form-render/src/context/index.mjs +8 -0
- package/dist/es/packages/form-render/src/core/ArrayField.mjs +22 -0
- package/dist/es/packages/form-render/src/core/Base.mjs +162 -0
- package/dist/es/packages/form-render/src/core/Field.mjs +17 -0
- package/dist/es/packages/form-render/src/core/Form.mjs +96 -0
- package/dist/es/packages/form-render/src/core/Heart.mjs +25 -0
- package/dist/es/packages/form-render/src/core/ObjectField.mjs +13 -0
- package/dist/es/packages/form-render/src/core/index.mjs +7 -0
- package/dist/es/packages/form-render/src/effects/LifeCycle.mjs +25 -0
- package/dist/es/packages/form-render/src/effects/contants.mjs +10 -0
- package/dist/es/packages/form-render/src/effects/effect.enum.mjs +5 -0
- package/dist/es/packages/form-render/src/effects/effective.mjs +25 -0
- package/dist/es/packages/form-render/src/effects/index.mjs +15 -0
- package/dist/es/packages/form-render/src/effects/onEffects.mjs +21 -0
- package/dist/es/packages/form-render/src/hooks/index.mjs +7 -0
- package/dist/es/packages/form-render/src/hooks/use-namespace/index.mjs +49 -0
- package/dist/es/packages/form-render/src/index.mjs +21 -0
- package/dist/es/packages/form-render/src/internal.mjs +7 -0
- package/dist/es/packages/form-render/src/schema/index.mjs +5 -0
- package/dist/es/packages/form-render/src/schema/makeProxy.mjs +46 -0
- package/dist/es/packages/form-render/src/utils/connect.mjs +12 -0
- package/dist/es/packages/form-render/src/utils/index.mjs +7 -0
- package/dist/es/packages/form-render/src/utils/mapProps.mjs +26 -0
- package/dist/es/packages/form-render/src/utils/schema.mjs +26 -0
- package/dist/es/packages/form-render/src/utils/style.mjs +13 -0
- package/dist/es/packages/form-render/src/utils/transformComponent.mjs +20 -0
- package/dist/es/packages/form-render/theme-chalk/index.css +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/index.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/contexts.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/destructor.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/index.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/matcher.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/parser.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/shared.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokenizer.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/tokens.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_path@1.0.4/node_modules/@king-one/path/dist/es/src/types.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/array.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/checkers.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/delay.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/file.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/img.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/install.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/number.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/uid.js +1 -0
- package/dist/lib/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/src/validate.js +1 -0
- package/dist/lib/node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.js +12 -0
- package/dist/lib/packages/form-antdv/src/components/ArrayCard/array-card.vue2.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/ArrayCard/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/ArrayTable/array-table.vue2.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/ArrayTable/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/DateRange/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/FormArea/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/Input/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/InputNumber/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/components/Select/index.js +1 -0
- package/dist/lib/packages/form-antdv/src/internal.js +1 -0
- package/dist/lib/packages/form-render/src/components/FormProvider.vue.js +1 -0
- package/dist/lib/packages/form-render/src/components/FormProvider.vue2.js +1 -0
- package/dist/lib/packages/form-render/src/components/SchemaField.js +1 -0
- package/dist/lib/packages/form-render/src/components/propsType.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/ArrayField.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/ErrorField.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/Field.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/FormItem.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/ObjectField.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/RecursionField.js +1 -0
- package/dist/lib/packages/form-render/src/components/widget/index.js +1 -0
- package/dist/lib/packages/form-render/src/context/field.js +1 -0
- package/dist/lib/packages/form-render/src/context/form.js +1 -0
- package/dist/lib/packages/form-render/src/context/index.js +1 -0
- package/dist/lib/packages/form-render/src/core/ArrayField.js +1 -0
- package/dist/lib/packages/form-render/src/core/Base.js +5 -0
- package/dist/lib/packages/form-render/src/core/Field.js +1 -0
- package/dist/lib/packages/form-render/src/core/Form.js +1 -0
- package/dist/lib/packages/form-render/src/core/Heart.js +1 -0
- package/dist/lib/packages/form-render/src/core/ObjectField.js +1 -0
- package/dist/lib/packages/form-render/src/core/index.js +1 -0
- package/dist/lib/packages/form-render/src/effects/LifeCycle.js +1 -0
- package/dist/lib/packages/form-render/src/effects/contants.js +1 -0
- package/dist/lib/packages/form-render/src/effects/effect.enum.js +1 -0
- package/dist/lib/packages/form-render/src/effects/effective.js +1 -0
- package/dist/lib/packages/form-render/src/effects/index.js +1 -0
- package/dist/lib/packages/form-render/src/effects/onEffects.js +1 -0
- package/dist/lib/packages/form-render/src/hooks/index.js +1 -0
- package/dist/lib/packages/form-render/src/hooks/use-namespace/index.js +1 -0
- package/dist/lib/packages/form-render/src/index.js +1 -0
- package/dist/lib/packages/form-render/src/internal.js +1 -0
- package/dist/lib/packages/form-render/src/schema/index.js +1 -0
- package/dist/lib/packages/form-render/src/schema/makeProxy.js +1 -0
- package/dist/lib/packages/form-render/src/utils/connect.js +1 -0
- package/dist/lib/packages/form-render/src/utils/index.js +1 -0
- package/dist/lib/packages/form-render/src/utils/mapProps.js +1 -0
- package/dist/lib/packages/form-render/src/utils/schema.js +1 -0
- package/dist/lib/packages/form-render/src/utils/style.js +1 -0
- package/dist/lib/packages/form-render/src/utils/transformComponent.js +1 -0
- package/dist/lib/packages/form-render/theme-chalk/index.css +1 -0
- package/dist/types/src/components/ArrayCard/index.d.ts +2 -2
- package/dist/types/src/components/ArrayTable/index.d.ts +2 -2
- package/dist/types/src/components/DateRange/index.d.ts +2 -2
- package/dist/types/src/components/FormArea/index.d.ts +2 -2
- package/dist/types/src/components/Input/index.d.ts +2 -2
- package/dist/types/src/components/InputNumber/index.d.ts +2 -2
- package/dist/types/src/components/Select/index.d.ts +2 -2
- package/dist/types/src/internal.d.ts +1 -1
- package/package.json +2 -2
- package/dist/es/src/components/ArrayCard/index.mjs +0 -11
- package/dist/es/src/components/ArrayTable/index.mjs +0 -11
- package/dist/es/src/components/DateRange/index.mjs +0 -10
- package/dist/es/src/components/FormArea/index.mjs +0 -9
- package/dist/es/src/components/Input/index.mjs +0 -10
- package/dist/es/src/components/InputNumber/index.mjs +0 -10
- package/dist/es/src/components/Select/index.mjs +0 -13
- package/dist/es/src/internal.mjs +0 -9
- package/dist/lib/src/components/ArrayCard/array-card.vue2.js +0 -1
- package/dist/lib/src/components/ArrayCard/index.js +0 -1
- package/dist/lib/src/components/ArrayTable/array-table.vue2.js +0 -1
- package/dist/lib/src/components/ArrayTable/index.js +0 -1
- package/dist/lib/src/components/DateRange/index.js +0 -1
- package/dist/lib/src/components/FormArea/index.js +0 -1
- package/dist/lib/src/components/Input/index.js +0 -1
- package/dist/lib/src/components/InputNumber/index.js +0 -1
- package/dist/lib/src/components/Select/index.js +0 -1
- package/dist/lib/src/internal.js +0 -1
- /package/dist/es/{index.mjs → packages/form-antdv/index.mjs} +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/components/FormArea/form-area.vue.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/components/FormArea/form-area.vue2.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/hooks/index.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/hooks/use-namespace/index.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/index.mjs +0 -0
- /package/dist/es/{src → packages/form-antdv/src}/style/index.mjs +0 -0
- /package/dist/lib/{index.js → packages/form-antdv/index.js} +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/components/ArrayCard/array-card.vue.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/components/ArrayTable/array-table.vue.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/components/FormArea/form-area.vue.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/components/FormArea/form-area.vue2.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/hooks/index.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/hooks/use-namespace/index.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/index.js +0 -0
- /package/dist/lib/{src → packages/form-antdv/src}/style/index.js +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Tokenizer as k } from "./tokenizer.mjs";
|
|
2
|
+
import { eofTok as p, dotTok as f, bracketDLTok as A, starTok as E, dbStarTok as m, expandTok as N, nameTok as x, bracketLTok as c, braceLTok as l, bracketRTok as u, parenLTok as T, braceRTok as y, colonTok as b, parenRTok as O, bangTok as S, commaTok as v } from "./tokens.mjs";
|
|
3
|
+
import { destructorContext as o, bracketArrayContext as P } from "./contexts.mjs";
|
|
4
|
+
import { setDestructor as w, parseDestructorRules as D } from "./destructor.mjs";
|
|
5
|
+
import { isNumberLike as g } from "./shared.mjs";
|
|
6
|
+
var M = Object.defineProperty, I = (s, t, e) => t in s ? M(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, n = (s, t, e) => I(s, typeof t != "symbol" ? t + "" : t, e);
|
|
7
|
+
function R(s = [], t) {
|
|
8
|
+
const e = s.length, r = (i = 0) => {
|
|
9
|
+
const a = i < e - 1 ? r(i + 1) : t, h = a && {
|
|
10
|
+
type: "DotOperator",
|
|
11
|
+
after: a
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
type: "Identifier",
|
|
15
|
+
value: s[i],
|
|
16
|
+
after: h
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
return r();
|
|
20
|
+
}
|
|
21
|
+
function d(s, t, e) {
|
|
22
|
+
if (g(s) && g(t)) {
|
|
23
|
+
if (e === "+")
|
|
24
|
+
return String(Number(s) + Number(t));
|
|
25
|
+
if (e === "-")
|
|
26
|
+
return String(Number(s) - Number(t));
|
|
27
|
+
if (e === "*")
|
|
28
|
+
return String(Number(s) * Number(t));
|
|
29
|
+
if (e === "/")
|
|
30
|
+
return String(Number(s) / Number(t));
|
|
31
|
+
} else {
|
|
32
|
+
if (e === "+")
|
|
33
|
+
return String(s) + String(t);
|
|
34
|
+
if (e === "-" || e === "*" || e === "/")
|
|
35
|
+
return "NaN";
|
|
36
|
+
}
|
|
37
|
+
return String(Number(t));
|
|
38
|
+
}
|
|
39
|
+
class G extends k {
|
|
40
|
+
constructor(t, e) {
|
|
41
|
+
super(t), n(this, "isMatchPattern", !1), n(this, "isWildMatchPattern", !1), n(this, "haveExcludePattern", !1), n(this, "haveRelativePattern", !1), n(this, "base"), n(this, "relative"), n(this, "data"), this.base = e;
|
|
42
|
+
}
|
|
43
|
+
parse() {
|
|
44
|
+
let t;
|
|
45
|
+
return this.data = {
|
|
46
|
+
segments: []
|
|
47
|
+
}, this.eat(p) || (this.next(), t = this.parseAtom(this.state.type)), this.data.tree = t, t;
|
|
48
|
+
}
|
|
49
|
+
append(t, e) {
|
|
50
|
+
t && e && (t.after = e);
|
|
51
|
+
}
|
|
52
|
+
parseAtom(t) {
|
|
53
|
+
switch (t) {
|
|
54
|
+
case l:
|
|
55
|
+
case c:
|
|
56
|
+
return this.includesContext(o) ? t === l ? this.parseObjectPattern() : this.parseArrayPattern() : this.parseDestructorExpression();
|
|
57
|
+
case x:
|
|
58
|
+
return this.parseIdentifier();
|
|
59
|
+
case N:
|
|
60
|
+
return this.parseExpandOperator();
|
|
61
|
+
case m:
|
|
62
|
+
case E:
|
|
63
|
+
return this.parseWildcardOperator();
|
|
64
|
+
case A:
|
|
65
|
+
return this.parseIgnoreExpression();
|
|
66
|
+
case f:
|
|
67
|
+
return this.parseDotOperator();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
pushSegments(t) {
|
|
71
|
+
this.data.segments.push(t);
|
|
72
|
+
}
|
|
73
|
+
parseIdentifier() {
|
|
74
|
+
const t = {
|
|
75
|
+
type: "Identifier",
|
|
76
|
+
value: this.state.value
|
|
77
|
+
}, e = !this.includesContext(o) && !this.isMatchPattern && !this.isWildMatchPattern;
|
|
78
|
+
if (this.next(), this.includesContext(P)) {
|
|
79
|
+
if (this.state.type !== u)
|
|
80
|
+
throw this.unexpect();
|
|
81
|
+
this.state.context.pop(), this.next();
|
|
82
|
+
} else e && this.pushSegments(t.value);
|
|
83
|
+
if (this.state.type === c) {
|
|
84
|
+
if (this.next(), this.state.type !== x)
|
|
85
|
+
throw this.unexpect();
|
|
86
|
+
this.state.context.push(P);
|
|
87
|
+
let r = !1;
|
|
88
|
+
/^\d+$/.test(this.state.value) && (r = !0);
|
|
89
|
+
const i = this.state.value;
|
|
90
|
+
this.pushSegments(r ? Number(i) : i);
|
|
91
|
+
const a = this.parseAtom(this.state.type);
|
|
92
|
+
r && (a.arrayIndex = !0), this.append(t, a);
|
|
93
|
+
} else
|
|
94
|
+
this.append(t, this.parseAtom(this.state.type));
|
|
95
|
+
return t;
|
|
96
|
+
}
|
|
97
|
+
parseExpandOperator() {
|
|
98
|
+
const t = {
|
|
99
|
+
type: "ExpandOperator"
|
|
100
|
+
};
|
|
101
|
+
return this.isMatchPattern = !0, this.isWildMatchPattern = !0, this.data.segments = [], this.next(), this.append(t, this.parseAtom(this.state.type)), t;
|
|
102
|
+
}
|
|
103
|
+
parseWildcardOperator() {
|
|
104
|
+
const t = {
|
|
105
|
+
type: "WildcardOperator"
|
|
106
|
+
};
|
|
107
|
+
return this.state.type === m && (t.optional = !0), this.isMatchPattern = !0, this.isWildMatchPattern = !0, this.data.segments = [], this.next(), this.state.type === T ? t.filter = this.parseGroupExpression(t) : this.state.type === c && (t.filter = this.parseRangeExpression(t)), this.append(t, this.parseAtom(this.state.type)), t;
|
|
108
|
+
}
|
|
109
|
+
parseDestructorExpression() {
|
|
110
|
+
const t = {
|
|
111
|
+
type: "DestructorExpression"
|
|
112
|
+
};
|
|
113
|
+
this.state.context.push(o);
|
|
114
|
+
const e = this.state.pos - 1;
|
|
115
|
+
t.value = this.state.type === l ? this.parseObjectPattern() : this.parseArrayPattern();
|
|
116
|
+
const r = this.state.pos;
|
|
117
|
+
return this.state.context.pop(), t.source = this.input.substring(e, r).replace(
|
|
118
|
+
/\[\s*(?:([+\-*/])\s*)?([^,\]\s]*)\s*\]/,
|
|
119
|
+
(i, a, h) => this.relative !== void 0 ? a ? h ? d(this.relative, h, a) : d(this.relative, 1, a) : h ? d(this.relative, h, "+") : String(this.relative) : i
|
|
120
|
+
).replace(/\s*\.\s*/g, "").replace(/\s*/g, ""), this.relative === void 0 && w(t.source, D(t)), this.relative = void 0, this.pushSegments(t.source), this.next(), this.append(t, this.parseAtom(this.state.type)), t;
|
|
121
|
+
}
|
|
122
|
+
parseArrayPattern() {
|
|
123
|
+
const t = {
|
|
124
|
+
type: "ArrayPattern",
|
|
125
|
+
elements: []
|
|
126
|
+
};
|
|
127
|
+
return this.next(), t.elements = this.parseArrayPatternElements(), t;
|
|
128
|
+
}
|
|
129
|
+
parseArrayPatternElements() {
|
|
130
|
+
const t = [];
|
|
131
|
+
for (; this.state.type !== u && this.state.type !== p; ) {
|
|
132
|
+
if (t.push(this.parseAtom(this.state.type)), this.state.type === u)
|
|
133
|
+
return this.includesContext(o) && this.next(), t;
|
|
134
|
+
this.next();
|
|
135
|
+
}
|
|
136
|
+
return t;
|
|
137
|
+
}
|
|
138
|
+
parseObjectPattern() {
|
|
139
|
+
const t = {
|
|
140
|
+
type: "ObjectPattern",
|
|
141
|
+
properties: []
|
|
142
|
+
};
|
|
143
|
+
return this.next(), t.properties = this.parseObjectProperties(), t;
|
|
144
|
+
}
|
|
145
|
+
parseObjectProperties() {
|
|
146
|
+
const t = [];
|
|
147
|
+
for (; this.state.type !== y && this.state.type !== p; ) {
|
|
148
|
+
const e = {
|
|
149
|
+
type: "ObjectPatternProperty",
|
|
150
|
+
key: this.parseAtom(this.state.type)
|
|
151
|
+
};
|
|
152
|
+
if (t.push(e), this.state.type === b && (this.next(), e.value = this.parseAtom(this.state.type)), this.state.type === y)
|
|
153
|
+
return this.includesContext(o) && this.next(), t;
|
|
154
|
+
this.next();
|
|
155
|
+
}
|
|
156
|
+
return t;
|
|
157
|
+
}
|
|
158
|
+
parseDotOperator() {
|
|
159
|
+
const t = {
|
|
160
|
+
type: "DotOperator"
|
|
161
|
+
};
|
|
162
|
+
if (!this.type_ && this.base) {
|
|
163
|
+
if (this.base.isMatchPattern)
|
|
164
|
+
throw new Error("Base path must be an absolute path.");
|
|
165
|
+
for (this.data.segments = this.base.toArr(); this.state.type === f; )
|
|
166
|
+
this.relative = this.data.segments.pop(), this.haveRelativePattern = !0, this.next();
|
|
167
|
+
return R(
|
|
168
|
+
this.data.segments.slice(),
|
|
169
|
+
this.parseAtom(this.state.type)
|
|
170
|
+
);
|
|
171
|
+
} else
|
|
172
|
+
this.next();
|
|
173
|
+
return this.append(t, this.parseAtom(this.state.type)), t;
|
|
174
|
+
}
|
|
175
|
+
parseIgnoreExpression() {
|
|
176
|
+
this.next();
|
|
177
|
+
const t = String(this.state.value).replace(/\s*/g, ""), e = {
|
|
178
|
+
type: "IgnoreExpression",
|
|
179
|
+
value: t
|
|
180
|
+
};
|
|
181
|
+
return this.pushSegments(t), this.next(), this.append(e, this.parseAtom(this.state.type)), this.next(), e;
|
|
182
|
+
}
|
|
183
|
+
parseGroupExpression(t) {
|
|
184
|
+
const e = {
|
|
185
|
+
type: "GroupExpression",
|
|
186
|
+
value: []
|
|
187
|
+
};
|
|
188
|
+
this.isMatchPattern = !0, this.data.segments = [], this.next();
|
|
189
|
+
t: for (; ; )
|
|
190
|
+
switch (this.state.type) {
|
|
191
|
+
case v:
|
|
192
|
+
this.next();
|
|
193
|
+
break;
|
|
194
|
+
case S:
|
|
195
|
+
e.isExclude = !0, this.haveExcludePattern = !0, this.next();
|
|
196
|
+
break;
|
|
197
|
+
case p:
|
|
198
|
+
break t;
|
|
199
|
+
case O:
|
|
200
|
+
break t;
|
|
201
|
+
default:
|
|
202
|
+
e.value.push(this.parseAtom(this.state.type));
|
|
203
|
+
}
|
|
204
|
+
return this.next(), this.append(t, this.parseAtom(this.state.type)), e;
|
|
205
|
+
}
|
|
206
|
+
parseRangeExpression(t) {
|
|
207
|
+
const e = {
|
|
208
|
+
type: "RangeExpression"
|
|
209
|
+
};
|
|
210
|
+
this.next(), this.isMatchPattern = !0, this.data.segments = [];
|
|
211
|
+
let r = !1, i = !1;
|
|
212
|
+
t: for (; ; )
|
|
213
|
+
switch (this.state.type) {
|
|
214
|
+
case b:
|
|
215
|
+
i = !0, r = !0, this.next();
|
|
216
|
+
break;
|
|
217
|
+
case u:
|
|
218
|
+
!i && !e.end && (e.end = e.start);
|
|
219
|
+
break t;
|
|
220
|
+
case v:
|
|
221
|
+
throw this.unexpect();
|
|
222
|
+
case p:
|
|
223
|
+
break t;
|
|
224
|
+
default:
|
|
225
|
+
r ? e.end = this.parseAtom(this.state.type) : e.start = this.parseAtom(this.state.type);
|
|
226
|
+
}
|
|
227
|
+
return this.next(), this.append(t, this.parseAtom(this.state.type)), e;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export {
|
|
231
|
+
G as Parser
|
|
232
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const p = Object.prototype.toString;
|
|
2
|
+
function o(t) {
|
|
3
|
+
return (r) => p.call(r) === `[object ${t}]`;
|
|
4
|
+
}
|
|
5
|
+
const h = o("Function"), g = Array.isArray || o("Array"), O = o("Object"), a = o("String"), m = o("Boolean"), j = o("Number"), k = (t) => typeof t == "object", S = o("RegExp");
|
|
6
|
+
function E(t) {
|
|
7
|
+
return j(t) || /^(\d+)(\.\d+)?$/.test(t);
|
|
8
|
+
}
|
|
9
|
+
const u = g, y = Object.keys, A = Object.prototype.hasOwnProperty;
|
|
10
|
+
function $(t) {
|
|
11
|
+
return Array.isArray(t) ? t : t !== void 0 ? [t] : [];
|
|
12
|
+
}
|
|
13
|
+
function d(t) {
|
|
14
|
+
return typeof t == "object" || typeof t == "function";
|
|
15
|
+
}
|
|
16
|
+
function l(t, r) {
|
|
17
|
+
if (t === r)
|
|
18
|
+
return !0;
|
|
19
|
+
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
20
|
+
const c = u(t), f = u(r);
|
|
21
|
+
let e, n, s;
|
|
22
|
+
if (c && f) {
|
|
23
|
+
if (n = t.length, n !== r.length)
|
|
24
|
+
return !1;
|
|
25
|
+
for (e = n; e-- !== 0; )
|
|
26
|
+
if (!l(t[e], r[e]))
|
|
27
|
+
return !1;
|
|
28
|
+
return !0;
|
|
29
|
+
}
|
|
30
|
+
if (c !== f)
|
|
31
|
+
return !1;
|
|
32
|
+
const i = y(t);
|
|
33
|
+
if (n = i.length, n !== y(r).length)
|
|
34
|
+
return !1;
|
|
35
|
+
for (e = n; e-- !== 0; )
|
|
36
|
+
if (!A.call(r, i[e]))
|
|
37
|
+
return !1;
|
|
38
|
+
for (e = n; e-- !== 0; )
|
|
39
|
+
if (s = i[e], !l(t[s], r[s]))
|
|
40
|
+
return !1;
|
|
41
|
+
return !0;
|
|
42
|
+
}
|
|
43
|
+
return t !== t && r !== r;
|
|
44
|
+
}
|
|
45
|
+
function x(t, r) {
|
|
46
|
+
return t = typeof t == "symbol" ? t : `${t}`, r = typeof r == "symbol" ? r : `${r}`, t === r;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as isArr,
|
|
50
|
+
d as isAssignable,
|
|
51
|
+
m as isBool,
|
|
52
|
+
l as isEqual,
|
|
53
|
+
h as isFn,
|
|
54
|
+
j as isNum,
|
|
55
|
+
E as isNumberLike,
|
|
56
|
+
k as isObj,
|
|
57
|
+
O as isPlainObj,
|
|
58
|
+
S as isRegExp,
|
|
59
|
+
x as isSegmentEqual,
|
|
60
|
+
a as isStr,
|
|
61
|
+
$ as toArr
|
|
62
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { eofTok as p, nameTok as u, ignoreTok as c, bracketDRTok as k, braceLTok as T, braceRTok as g, dbStarTok as C, starTok as x, bangTok as d, dotTok as b, bracketDLTok as m, bracketLTok as P, expandTok as A, bracketRTok as w, parenLTok as S, parenRTok as _, commaTok as $, colonTok as v } from "./tokens.mjs";
|
|
2
|
+
import { bracketDContext as f } from "./contexts.mjs";
|
|
3
|
+
var F = Object.defineProperty, I = (e, t, s) => t in e ? F(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, n = (e, t, s) => I(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
const l = /[\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFEFF]/;
|
|
5
|
+
function N(e, t) {
|
|
6
|
+
if (String.fromCharCode)
|
|
7
|
+
return e.codePointAt(t);
|
|
8
|
+
const s = e.charCodeAt(t);
|
|
9
|
+
if (s <= 55295 || s >= 57344)
|
|
10
|
+
return s;
|
|
11
|
+
const i = e.charCodeAt(t + 1);
|
|
12
|
+
return (s << 10) + i - 56613888;
|
|
13
|
+
}
|
|
14
|
+
function R(e) {
|
|
15
|
+
return e === 42 || e === 46 || e === 33 || e === 91 || e === 93 || e === 40 || e === 41 || e === 44 || e === 58 || e === 126 || e === 123 || e === 125;
|
|
16
|
+
}
|
|
17
|
+
function r(e, t) {
|
|
18
|
+
const s = new Error(e);
|
|
19
|
+
return Object.assign(s, t), s;
|
|
20
|
+
}
|
|
21
|
+
function o(e, t, s) {
|
|
22
|
+
let i = "";
|
|
23
|
+
for (let h = t; h < s; h++) {
|
|
24
|
+
const a = e.charAt(h);
|
|
25
|
+
a !== "\\" && (i += a);
|
|
26
|
+
}
|
|
27
|
+
return i;
|
|
28
|
+
}
|
|
29
|
+
class W {
|
|
30
|
+
constructor(t) {
|
|
31
|
+
n(this, "input"), n(this, "state"), n(this, "type_"), this.input = t, this.state = {
|
|
32
|
+
context: [],
|
|
33
|
+
type: null,
|
|
34
|
+
pos: 0
|
|
35
|
+
}, this.type_ = null;
|
|
36
|
+
}
|
|
37
|
+
curContext() {
|
|
38
|
+
return this.state.context[this.state.context.length - 1];
|
|
39
|
+
}
|
|
40
|
+
includesContext(t) {
|
|
41
|
+
for (let s = this.state.context.length - 1; s >= 0; s--)
|
|
42
|
+
if (this.state.context[s] === t)
|
|
43
|
+
return !0;
|
|
44
|
+
return !1;
|
|
45
|
+
}
|
|
46
|
+
unexpect(t) {
|
|
47
|
+
return t = t || this.state.type, r(
|
|
48
|
+
`Unexpect token "${t.flag}" in ${this.state.pos} char.`,
|
|
49
|
+
{
|
|
50
|
+
pos: this.state.pos
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
expectNext(t, s) {
|
|
55
|
+
if (t && t.expectNext && s && !t.expectNext.call(this, s))
|
|
56
|
+
throw r(
|
|
57
|
+
`Unexpect token "${s.flag}" token should not be behind "${t.flag}" token.(${this.state.pos}th char)`,
|
|
58
|
+
{
|
|
59
|
+
pos: this.state.pos
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
expectPrev(t, s) {
|
|
64
|
+
if (t && t.expectPrev && s && !t.expectPrev.call(this, s))
|
|
65
|
+
throw r(
|
|
66
|
+
`Unexpect token "${t.flag}" should not be behind "${s.flag}"(${this.state.pos}th char).`,
|
|
67
|
+
{
|
|
68
|
+
pos: this.state.pos
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
match(t) {
|
|
73
|
+
return this.state.type === t;
|
|
74
|
+
}
|
|
75
|
+
skipSpace() {
|
|
76
|
+
if (this.curContext() !== f)
|
|
77
|
+
t: for (; this.state.pos < this.input.length; ) {
|
|
78
|
+
const t = this.input.charCodeAt(this.state.pos);
|
|
79
|
+
switch (t) {
|
|
80
|
+
case 32:
|
|
81
|
+
case 160:
|
|
82
|
+
++this.state.pos;
|
|
83
|
+
break;
|
|
84
|
+
case 13:
|
|
85
|
+
this.input.charCodeAt(this.state.pos + 1) === 10 && ++this.state.pos;
|
|
86
|
+
case 10:
|
|
87
|
+
case 8232:
|
|
88
|
+
case 8233:
|
|
89
|
+
++this.state.pos;
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
if (t > 8 && t < 14 || t >= 5760 && l.test(String.fromCharCode(t)))
|
|
93
|
+
++this.state.pos;
|
|
94
|
+
else
|
|
95
|
+
break t;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
next() {
|
|
100
|
+
if (this.type_ = this.state.type, this.input.length <= this.state.pos)
|
|
101
|
+
return this.finishToken(p);
|
|
102
|
+
this.skipSpace(), this.readToken(
|
|
103
|
+
this.getCode(),
|
|
104
|
+
this.state.pos > 0 ? this.getCode(this.state.pos - 1) : -1 / 0
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
getCode(t = this.state.pos) {
|
|
108
|
+
return N(this.input, t);
|
|
109
|
+
}
|
|
110
|
+
eat(t) {
|
|
111
|
+
return this.match(t) ? (this.next(), !0) : !1;
|
|
112
|
+
}
|
|
113
|
+
readKeyWord() {
|
|
114
|
+
const t = this.state.pos;
|
|
115
|
+
let s = "";
|
|
116
|
+
for (; ; ) {
|
|
117
|
+
const i = this.getCode(), h = this.getCode(this.state.pos - 1);
|
|
118
|
+
if (this.input.length === this.state.pos) {
|
|
119
|
+
s = o(this.input, t, this.state.pos + 1);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (!R(i) || h === 92) {
|
|
123
|
+
if (i === 32 || i === 160 || i === 10 || i === 8232 || i === 8233) {
|
|
124
|
+
s = o(this.input, t, this.state.pos);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (i === 13 && this.input.charCodeAt(this.state.pos + 1) === 10) {
|
|
128
|
+
s = o(this.input, t, this.state.pos);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
if (i > 8 && i < 14 || i >= 5760 && l.test(String.fromCharCode(i))) {
|
|
132
|
+
s = o(this.input, t, this.state.pos);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
this.state.pos++;
|
|
136
|
+
} else {
|
|
137
|
+
s = o(this.input, t, this.state.pos);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
this.finishToken(u, s);
|
|
142
|
+
}
|
|
143
|
+
readIgnoreString() {
|
|
144
|
+
const t = this.state.pos;
|
|
145
|
+
let s, i = "";
|
|
146
|
+
for (; ; ) {
|
|
147
|
+
const h = this.getCode();
|
|
148
|
+
if (this.state.pos >= this.input.length)
|
|
149
|
+
break;
|
|
150
|
+
if ((h === 91 || h === 93) && s === 92)
|
|
151
|
+
this.state.pos++, s = "";
|
|
152
|
+
else if (h === 93 && s === 93) {
|
|
153
|
+
i = this.input.slice(t, this.state.pos - 1).replace(/\\([[\]])/g, "$1"), this.state.pos++;
|
|
154
|
+
break;
|
|
155
|
+
} else
|
|
156
|
+
this.state.pos++, s = h;
|
|
157
|
+
}
|
|
158
|
+
this.finishToken(c, i), this.finishToken(k);
|
|
159
|
+
}
|
|
160
|
+
finishToken(t, s) {
|
|
161
|
+
const i = this.state.type;
|
|
162
|
+
this.state.type = t, s !== void 0 && (this.state.value = s), this.expectNext(i, t), this.expectPrev(t, i), t.updateContext && t.updateContext.call(this, i);
|
|
163
|
+
}
|
|
164
|
+
readToken(t, s) {
|
|
165
|
+
if (s === 92)
|
|
166
|
+
return this.readKeyWord();
|
|
167
|
+
if (this.input.length <= this.state.pos)
|
|
168
|
+
this.finishToken(p);
|
|
169
|
+
else if (this.curContext() === f)
|
|
170
|
+
this.readIgnoreString();
|
|
171
|
+
else if (t === 123)
|
|
172
|
+
this.state.pos++, this.finishToken(T);
|
|
173
|
+
else if (t === 125)
|
|
174
|
+
this.state.pos++, this.finishToken(g);
|
|
175
|
+
else if (t === 42) {
|
|
176
|
+
if (this.state.pos++, this.getCode() === 42)
|
|
177
|
+
return this.state.pos++, this.finishToken(C);
|
|
178
|
+
this.finishToken(x);
|
|
179
|
+
} else if (t === 33)
|
|
180
|
+
this.state.pos++, this.finishToken(d);
|
|
181
|
+
else if (t === 46)
|
|
182
|
+
this.state.pos++, this.finishToken(b);
|
|
183
|
+
else if (t === 91) {
|
|
184
|
+
if (this.state.pos++, this.getCode() === 91)
|
|
185
|
+
return this.state.pos++, this.finishToken(m);
|
|
186
|
+
this.finishToken(P);
|
|
187
|
+
} else t === 126 ? (this.state.pos++, this.finishToken(A)) : t === 93 ? (this.state.pos++, this.finishToken(w)) : t === 40 ? (this.state.pos++, this.finishToken(S)) : t === 41 ? (this.state.pos++, this.finishToken(_)) : t === 44 ? (this.state.pos++, this.finishToken($)) : t === 58 ? (this.state.pos++, this.finishToken(v)) : this.readKeyWord();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
W as Tokenizer
|
|
192
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { destructorContext as a, braceContext as f, bracketContext as N, bracketArrayContext as L, bracketDContext as b, parenContext as l } from "./contexts.mjs";
|
|
2
|
+
function o(t, x) {
|
|
3
|
+
return {
|
|
4
|
+
flag: t,
|
|
5
|
+
...x
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
const e = o("name", {
|
|
9
|
+
expectNext(t) {
|
|
10
|
+
return this.includesContext(a) ? t === e || t === c || t === u || t === k || t === h : t === s || t === c || t === i || t === u || t === p || t === h || t === P || t === r;
|
|
11
|
+
}
|
|
12
|
+
}), d = o("*", {
|
|
13
|
+
expectNext(t) {
|
|
14
|
+
return t === s || t === T || t === r || t === i || t === c || t === p;
|
|
15
|
+
}
|
|
16
|
+
}), R = o("**", {
|
|
17
|
+
expectNext(t) {
|
|
18
|
+
return t === s || t === r || t === i || t === c || t === p;
|
|
19
|
+
}
|
|
20
|
+
}), s = o(".", {
|
|
21
|
+
expectNext(t) {
|
|
22
|
+
return t === s || t === e || t === n || t === d || t === R || t === r || t === C || t === i;
|
|
23
|
+
},
|
|
24
|
+
expectPrev(t) {
|
|
25
|
+
return t === s || t === e || t === m || t === d || t === p || t === u || t === P || t === k;
|
|
26
|
+
}
|
|
27
|
+
}), g = o("!", {
|
|
28
|
+
expectNext(t) {
|
|
29
|
+
return t === e || t === n;
|
|
30
|
+
}
|
|
31
|
+
}), h = o(":", {
|
|
32
|
+
expectNext(t) {
|
|
33
|
+
return this.includesContext(a) ? t === e || t === C || t === r : t === e || t === n || t === u;
|
|
34
|
+
}
|
|
35
|
+
}), C = o("{", {
|
|
36
|
+
expectNext(t) {
|
|
37
|
+
return t === e;
|
|
38
|
+
},
|
|
39
|
+
expectPrev(t) {
|
|
40
|
+
return this.includesContext(a) ? t === h || t === c || t === r : t === s || t === h || t === T;
|
|
41
|
+
},
|
|
42
|
+
updateContext() {
|
|
43
|
+
this.state.context.push(f);
|
|
44
|
+
}
|
|
45
|
+
}), k = o("}", {
|
|
46
|
+
expectNext(t) {
|
|
47
|
+
return this.includesContext(a) ? t === c || t === k || t === i || t === u : t === s || t === i || t === c;
|
|
48
|
+
},
|
|
49
|
+
expectPrev(t) {
|
|
50
|
+
return t === e || t === k || t === u;
|
|
51
|
+
},
|
|
52
|
+
updateContext() {
|
|
53
|
+
this.state.context.pop(f);
|
|
54
|
+
}
|
|
55
|
+
}), r = o("[", {
|
|
56
|
+
expectNext(t) {
|
|
57
|
+
return this.includesContext(a) ? t === e || t === r || t === C || t === u : t === e || t === n || t === h || t === r || t === w || t === u;
|
|
58
|
+
},
|
|
59
|
+
expectPrev(t) {
|
|
60
|
+
return this.includesContext(a) ? t === h || t === c || t === r : t === d || t === r || t === s || t === e || t === T || t === c;
|
|
61
|
+
},
|
|
62
|
+
updateContext() {
|
|
63
|
+
this.state.context.push(N);
|
|
64
|
+
}
|
|
65
|
+
}), u = o("]", {
|
|
66
|
+
expectNext(t) {
|
|
67
|
+
return this.includesContext(a) ? t === c || t === k || t === u || t === i : t === s || t === i || t === c || t === p || t === u;
|
|
68
|
+
},
|
|
69
|
+
updateContext() {
|
|
70
|
+
if (!this.includesContext(L)) {
|
|
71
|
+
if (!this.includesContext(N))
|
|
72
|
+
throw this.unexpect();
|
|
73
|
+
this.state.context.pop();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}), n = o("[[", {
|
|
77
|
+
updateContext() {
|
|
78
|
+
this.state.context.push(b);
|
|
79
|
+
}
|
|
80
|
+
}), m = o("]]", {
|
|
81
|
+
updateContext() {
|
|
82
|
+
if (this.curContext() !== b)
|
|
83
|
+
throw this.unexpect();
|
|
84
|
+
this.state.context.pop();
|
|
85
|
+
}
|
|
86
|
+
}), T = o("(", {
|
|
87
|
+
expectNext(t) {
|
|
88
|
+
return t === e || t === n || t === C || t === g || t === r;
|
|
89
|
+
},
|
|
90
|
+
expectPrev(t) {
|
|
91
|
+
return t === d;
|
|
92
|
+
},
|
|
93
|
+
updateContext() {
|
|
94
|
+
this.state.context.push(l);
|
|
95
|
+
}
|
|
96
|
+
}), p = o(")", {
|
|
97
|
+
expectNext(t) {
|
|
98
|
+
return t === s || t === i || t === c || t === p;
|
|
99
|
+
},
|
|
100
|
+
updateContext() {
|
|
101
|
+
if (this.curContext() !== l)
|
|
102
|
+
throw this.unexpect();
|
|
103
|
+
this.state.context.pop();
|
|
104
|
+
}
|
|
105
|
+
}), c = o(",", {
|
|
106
|
+
expectNext(t) {
|
|
107
|
+
return t === e || t === n || t === r || t === C;
|
|
108
|
+
}
|
|
109
|
+
}), w = o("ignore", {
|
|
110
|
+
expectNext(t) {
|
|
111
|
+
return t === m;
|
|
112
|
+
},
|
|
113
|
+
expectPrev(t) {
|
|
114
|
+
return t === n;
|
|
115
|
+
}
|
|
116
|
+
}), P = o("expandTok", {
|
|
117
|
+
expectNext(t) {
|
|
118
|
+
return t === s || t === i || t === c || t === p;
|
|
119
|
+
}
|
|
120
|
+
}), i = o("eof");
|
|
121
|
+
export {
|
|
122
|
+
g as bangTok,
|
|
123
|
+
C as braceLTok,
|
|
124
|
+
k as braceRTok,
|
|
125
|
+
n as bracketDLTok,
|
|
126
|
+
m as bracketDRTok,
|
|
127
|
+
r as bracketLTok,
|
|
128
|
+
u as bracketRTok,
|
|
129
|
+
h as colonTok,
|
|
130
|
+
c as commaTok,
|
|
131
|
+
R as dbStarTok,
|
|
132
|
+
s as dotTok,
|
|
133
|
+
i as eofTok,
|
|
134
|
+
P as expandTok,
|
|
135
|
+
w as ignoreTok,
|
|
136
|
+
e as nameTok,
|
|
137
|
+
T as parenLTok,
|
|
138
|
+
p as parenRTok,
|
|
139
|
+
d as starTok
|
|
140
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function r(e) {
|
|
2
|
+
return (t) => t && t.type === e;
|
|
3
|
+
}
|
|
4
|
+
const s = r("Identifier"), n = r("IgnoreExpression"), o = r("DotOperator"), i = r("WildcardOperator"), p = r("ExpandOperator"), a = r("GroupExpression"), c = r("RangeExpression"), x = r("DestructorExpression"), E = r("ObjectPattern"), O = r("ObjectPatternProperty"), d = r("ArrayPattern");
|
|
5
|
+
export {
|
|
6
|
+
d as isArrayPattern,
|
|
7
|
+
x as isDestructorExpression,
|
|
8
|
+
o as isDotOperator,
|
|
9
|
+
p as isExpandOperator,
|
|
10
|
+
a as isGroupExpression,
|
|
11
|
+
s as isIdentifier,
|
|
12
|
+
n as isIgnoreExpression,
|
|
13
|
+
E as isObjectPattern,
|
|
14
|
+
O as isObjectPatternProperty,
|
|
15
|
+
c as isRangeExpression,
|
|
16
|
+
r as isType,
|
|
17
|
+
i as isWildcardOperator
|
|
18
|
+
};
|
package/dist/es/node_modules/.pnpm/@king-one_utils@1.0.14/node_modules/@king-one/utils/index.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getType as i, isArr as o, isBool as t, isFn as s, isHTMLElement as m, isMap as a, isNum as p, isNumberLike as f, isObj as l, isPlainObj as n, isReactElement as x, isRegExp as d, isSet as g, isStr as u, isWeakMap as b, isWeakSet as c } from "./src/checkers.mjs";
|
|
2
|
+
import { each as v, every as y, find as I, findIndex as S, includes as k, map as A, move as E, reduce as M, shuffleArray as N, some as R, toArr as T } from "./src/array.mjs";
|
|
3
|
+
import { getImgSize as w, mmtopx as F } from "./src/img.mjs";
|
|
4
|
+
import { uid as O } from "./src/uid.mjs";
|
|
5
|
+
import { validatePageRange as W } from "./src/validate.mjs";
|
|
6
|
+
import { rangeNumber as B } from "./src/number.mjs";
|
|
7
|
+
import { base64ToFile as H } from "./src/file.mjs";
|
|
8
|
+
import { withInstall as C, withInstallDirectives as G } from "./src/install.mjs";
|
|
9
|
+
import { delay as K } from "./src/delay.mjs";
|
|
10
|
+
export {
|
|
11
|
+
H as base64ToFile,
|
|
12
|
+
K as delay,
|
|
13
|
+
v as each,
|
|
14
|
+
y as every,
|
|
15
|
+
I as find,
|
|
16
|
+
S as findIndex,
|
|
17
|
+
w as getImgSize,
|
|
18
|
+
i as getType,
|
|
19
|
+
k as includes,
|
|
20
|
+
o as isArr,
|
|
21
|
+
t as isBool,
|
|
22
|
+
s as isFn,
|
|
23
|
+
m as isHTMLElement,
|
|
24
|
+
a as isMap,
|
|
25
|
+
p as isNum,
|
|
26
|
+
f as isNumberLike,
|
|
27
|
+
l as isObj,
|
|
28
|
+
n as isPlainObj,
|
|
29
|
+
x as isReactElement,
|
|
30
|
+
d as isRegExp,
|
|
31
|
+
g as isSet,
|
|
32
|
+
u as isStr,
|
|
33
|
+
b as isWeakMap,
|
|
34
|
+
c as isWeakSet,
|
|
35
|
+
A as map,
|
|
36
|
+
F as mmtopx,
|
|
37
|
+
E as move,
|
|
38
|
+
B as rangeNumber,
|
|
39
|
+
M as reduce,
|
|
40
|
+
N as shuffleArray,
|
|
41
|
+
R as some,
|
|
42
|
+
T as toArr,
|
|
43
|
+
O as uid,
|
|
44
|
+
W as validatePageRange,
|
|
45
|
+
C as withInstall,
|
|
46
|
+
G as withInstallDirectives
|
|
47
|
+
};
|