@tachybase/schema 0.23.41 → 0.23.47
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/core/effects/index.d.ts +2 -0
- package/lib/core/effects/index.js +23 -0
- package/lib/core/effects/onFieldEffects.d.ts +27 -0
- package/lib/core/effects/onFieldEffects.js +158 -0
- package/lib/core/effects/onFormEffects.d.ts +24 -0
- package/lib/core/effects/onFormEffects.js +117 -0
- package/lib/core/global.d.js +0 -0
- package/lib/core/index.d.ts +4 -0
- package/lib/core/index.js +27 -0
- package/lib/core/models/ArrayField.d.ts +17 -0
- package/lib/core/models/ArrayField.js +145 -0
- package/lib/core/models/BaseField.d.ts +72 -0
- package/lib/core/models/BaseField.js +285 -0
- package/lib/core/models/Field.d.ts +70 -0
- package/lib/core/models/Field.js +426 -0
- package/lib/core/models/Form.d.ts +102 -0
- package/lib/core/models/Form.js +483 -0
- package/lib/core/models/Graph.d.ts +8 -0
- package/lib/core/models/Graph.js +77 -0
- package/lib/core/models/Heart.d.ts +16 -0
- package/lib/core/models/Heart.js +91 -0
- package/lib/core/models/LifeCycle.d.ts +14 -0
- package/lib/core/models/LifeCycle.js +64 -0
- package/lib/core/models/ObjectField.d.ts +12 -0
- package/lib/core/models/ObjectField.js +64 -0
- package/lib/core/models/Query.d.ts +18 -0
- package/lib/core/models/Query.js +105 -0
- package/lib/core/models/VoidField.d.ts +14 -0
- package/lib/core/models/VoidField.js +117 -0
- package/lib/core/models/index.d.ts +9 -0
- package/lib/core/models/index.js +37 -0
- package/lib/core/models/types.d.ts +9 -0
- package/lib/core/models/types.js +15 -0
- package/lib/core/shared/checkers.d.ts +117 -0
- package/lib/core/shared/checkers.js +109 -0
- package/lib/core/shared/constants.d.ts +48 -0
- package/lib/core/shared/constants.js +86 -0
- package/lib/core/shared/effective.d.ts +9 -0
- package/lib/core/shared/effective.js +91 -0
- package/lib/core/shared/externals.d.ts +8 -0
- package/lib/core/shared/externals.js +87 -0
- package/lib/core/shared/internals.d.ts +54 -0
- package/lib/core/shared/internals.js +956 -0
- package/lib/core/types.d.ts +275 -0
- package/lib/core/types.js +76 -0
- package/lib/grid/index.d.ts +67 -0
- package/lib/grid/index.js +378 -0
- package/lib/grid/observer.d.ts +19 -0
- package/lib/grid/observer.js +107 -0
- package/lib/index.d.ts +12 -24
- package/lib/index.js +27 -244
- package/lib/json-schema/compiler.d.ts +8 -0
- package/lib/json-schema/compiler.js +129 -0
- package/lib/json-schema/global.d.js +0 -0
- package/lib/json-schema/index.d.ts +2 -0
- package/lib/json-schema/index.js +23 -0
- package/lib/json-schema/patches.d.ts +5 -0
- package/lib/json-schema/patches.js +68 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.d.ts +2 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.js +132 -0
- package/lib/json-schema/polyfills/index.d.ts +1 -0
- package/lib/json-schema/polyfills/index.js +21 -0
- package/lib/json-schema/schema.d.ts +88 -0
- package/lib/json-schema/schema.js +231 -0
- package/lib/json-schema/shared.d.ts +62 -0
- package/lib/json-schema/shared.js +232 -0
- package/lib/json-schema/transformer.d.ts +4 -0
- package/lib/json-schema/transformer.js +238 -0
- package/lib/json-schema/types.d.ts +119 -0
- package/lib/json-schema/types.js +15 -0
- package/lib/path/contexts.d.ts +10 -0
- package/lib/path/contexts.js +49 -0
- package/lib/path/destructor.d.ts +15 -0
- package/lib/path/destructor.js +151 -0
- package/lib/path/index.d.ts +51 -0
- package/lib/path/index.js +513 -0
- package/lib/path/matcher.d.ts +33 -0
- package/lib/path/matcher.js +197 -0
- package/lib/path/parser.d.ts +33 -0
- package/lib/path/parser.js +379 -0
- package/lib/path/shared.d.ts +13 -0
- package/lib/path/shared.js +121 -0
- package/lib/path/tokenizer.d.ts +27 -0
- package/lib/path/tokenizer.js +269 -0
- package/lib/path/tokens.d.ts +27 -0
- package/lib/path/tokens.js +216 -0
- package/lib/path/types.d.ts +88 -0
- package/lib/path/types.js +63 -0
- package/lib/react/components/ArrayField.d.ts +6 -0
- package/lib/react/components/ArrayField.js +44 -0
- package/lib/react/components/ExpressionScope.d.ts +2 -0
- package/lib/react/components/ExpressionScope.js +35 -0
- package/lib/react/components/Field.d.ts +5 -0
- package/lib/react/components/Field.js +45 -0
- package/lib/react/components/FormConsumer.d.ts +2 -0
- package/lib/react/components/FormConsumer.js +36 -0
- package/lib/react/components/FormProvider.d.ts +2 -0
- package/lib/react/components/FormProvider.js +35 -0
- package/lib/react/components/ObjectField.d.ts +6 -0
- package/lib/react/components/ObjectField.js +39 -0
- package/lib/react/components/ReactiveField.d.ts +11 -0
- package/lib/react/components/ReactiveField.js +115 -0
- package/lib/react/components/RecordScope.d.ts +2 -0
- package/lib/react/components/RecordScope.js +65 -0
- package/lib/react/components/RecordsScope.d.ts +2 -0
- package/lib/react/components/RecordsScope.js +43 -0
- package/lib/react/components/RecursionField.d.ts +2 -0
- package/lib/react/components/RecursionField.js +105 -0
- package/lib/react/components/SchemaField.d.ts +41 -0
- package/lib/react/components/SchemaField.js +154 -0
- package/lib/react/components/VoidField.d.ts +5 -0
- package/lib/react/components/VoidField.js +39 -0
- package/lib/react/components/index.d.ts +11 -0
- package/lib/react/components/index.js +41 -0
- package/lib/react/global.d.js +0 -0
- package/lib/react/hooks/index.d.ts +6 -0
- package/lib/react/hooks/index.js +31 -0
- package/lib/react/hooks/useAttach.d.ts +6 -0
- package/lib/react/hooks/useAttach.js +35 -0
- package/lib/react/hooks/useExpressionScope.d.ts +1 -0
- package/lib/react/hooks/useExpressionScope.js +30 -0
- package/lib/react/hooks/useField.d.ts +2 -0
- package/lib/react/hooks/useField.js +32 -0
- package/lib/react/hooks/useFieldSchema.d.ts +2 -0
- package/lib/react/hooks/useFieldSchema.js +32 -0
- package/lib/react/hooks/useForm.d.ts +2 -0
- package/lib/react/hooks/useForm.js +32 -0
- package/lib/react/hooks/useFormEffects.d.ts +2 -0
- package/lib/react/hooks/useFormEffects.js +42 -0
- package/lib/react/hooks/useParentForm.d.ts +2 -0
- package/lib/react/hooks/useParentForm.js +40 -0
- package/lib/react/index.d.ts +5 -0
- package/lib/react/index.js +29 -0
- package/lib/react/shared/connect.d.ts +9 -0
- package/lib/react/shared/connect.js +118 -0
- package/lib/react/shared/context.d.ts +14 -0
- package/lib/react/shared/context.js +74 -0
- package/lib/react/shared/index.d.ts +2 -0
- package/lib/react/shared/index.js +23 -0
- package/lib/react/shared/render.d.ts +2 -0
- package/lib/react/shared/render.js +69 -0
- package/lib/react/types.d.ts +84 -0
- package/lib/react/types.js +15 -0
- package/lib/reactive/action.d.ts +2 -0
- package/lib/reactive/action.js +48 -0
- package/lib/reactive/annotations/box.d.ts +7 -0
- package/lib/reactive/annotations/box.js +76 -0
- package/lib/reactive/annotations/computed.d.ts +12 -0
- package/lib/reactive/annotations/computed.js +154 -0
- package/lib/reactive/annotations/index.d.ts +5 -0
- package/lib/reactive/annotations/index.js +29 -0
- package/lib/reactive/annotations/observable.d.ts +4 -0
- package/lib/reactive/annotations/observable.js +67 -0
- package/lib/reactive/annotations/ref.d.ts +6 -0
- package/lib/reactive/annotations/ref.js +78 -0
- package/lib/reactive/annotations/shallow.d.ts +2 -0
- package/lib/reactive/annotations/shallow.js +67 -0
- package/lib/reactive/array.d.ts +12 -0
- package/lib/reactive/array.js +83 -0
- package/lib/reactive/autorun.d.ts +7 -0
- package/lib/reactive/autorun.js +155 -0
- package/lib/reactive/batch.d.ts +2 -0
- package/lib/reactive/batch.js +40 -0
- package/lib/reactive/checkers.d.ts +10 -0
- package/lib/reactive/checkers.js +60 -0
- package/lib/reactive/environment.d.ts +28 -0
- package/lib/reactive/environment.js +76 -0
- package/lib/reactive/externals.d.ts +10 -0
- package/lib/reactive/externals.js +156 -0
- package/lib/reactive/global.d.js +0 -0
- package/lib/reactive/handlers.d.ts +4 -0
- package/lib/reactive/handlers.js +246 -0
- package/lib/reactive/index.d.ts +10 -0
- package/lib/reactive/index.js +39 -0
- package/lib/reactive/internals.d.ts +17 -0
- package/lib/reactive/internals.js +139 -0
- package/lib/reactive/model.d.ts +3 -0
- package/lib/reactive/model.js +68 -0
- package/lib/reactive/observable.d.ts +9 -0
- package/lib/reactive/observable.js +50 -0
- package/lib/reactive/observe.d.ts +2 -0
- package/lib/reactive/observe.js +58 -0
- package/lib/reactive/reaction.d.ts +21 -0
- package/lib/reactive/reaction.js +278 -0
- package/lib/reactive/tracker.d.ts +7 -0
- package/lib/reactive/tracker.js +63 -0
- package/lib/reactive/tree.d.ts +25 -0
- package/lib/reactive/tree.js +106 -0
- package/lib/reactive/types.d.ts +79 -0
- package/lib/reactive/types.js +21 -0
- package/lib/reactive/untracked.d.ts +4 -0
- package/lib/reactive/untracked.js +29 -0
- package/lib/reactive-react/hooks/index.d.ts +9 -0
- package/lib/reactive-react/hooks/index.js +48 -0
- package/lib/reactive-react/hooks/useCompatEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useCompatEffect.js +60 -0
- package/lib/reactive-react/hooks/useCompatFactory.d.ts +3 -0
- package/lib/reactive-react/hooks/useCompatFactory.js +74 -0
- package/lib/reactive-react/hooks/useDidUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useDidUpdate.js +38 -0
- package/lib/reactive-react/hooks/useForceUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useForceUpdate.js +76 -0
- package/lib/reactive-react/hooks/useLayoutEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useLayoutEffect.js +28 -0
- package/lib/reactive-react/hooks/useObserver.d.ts +2 -0
- package/lib/reactive-react/hooks/useObserver.js +43 -0
- package/lib/reactive-react/index.d.ts +3 -0
- package/lib/reactive-react/index.js +25 -0
- package/lib/reactive-react/observer.d.ts +8 -0
- package/lib/reactive-react/observer.js +64 -0
- package/lib/reactive-react/shared/gc.d.ts +8 -0
- package/lib/reactive-react/shared/gc.js +59 -0
- package/lib/reactive-react/shared/global.d.ts +1 -0
- package/lib/reactive-react/shared/global.js +50 -0
- package/lib/reactive-react/shared/immediate.d.ts +1 -0
- package/lib/reactive-react/shared/immediate.js +40 -0
- package/lib/reactive-react/shared/index.d.ts +2 -0
- package/lib/reactive-react/shared/index.js +23 -0
- package/lib/reactive-react/types.d.ts +14 -0
- package/lib/reactive-react/types.js +15 -0
- package/lib/shared/array.d.ts +35 -0
- package/lib/shared/array.js +189 -0
- package/lib/shared/case.d.ts +6 -0
- package/lib/shared/case.js +39 -0
- package/lib/shared/checkers.d.ts +21 -0
- package/lib/shared/checkers.js +77 -0
- package/lib/shared/clone.d.ts +2 -0
- package/lib/shared/clone.js +97 -0
- package/lib/shared/compare.d.ts +1 -0
- package/lib/shared/compare.js +129 -0
- package/lib/shared/defaults.d.ts +6 -0
- package/lib/shared/defaults.js +63 -0
- package/lib/shared/deprecate.d.ts +1 -0
- package/lib/shared/deprecate.js +42 -0
- package/lib/shared/global.d.ts +1 -0
- package/lib/shared/global.js +50 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +51 -0
- package/lib/shared/instanceof.d.ts +1 -0
- package/lib/shared/instanceof.js +36 -0
- package/lib/shared/isEmpty.d.ts +3 -0
- package/lib/shared/isEmpty.js +94 -0
- package/lib/shared/merge.d.ts +12 -0
- package/lib/shared/merge.js +214 -0
- package/lib/shared/middleware.d.ts +4 -0
- package/lib/shared/middleware.js +41 -0
- package/lib/shared/path.d.ts +3 -0
- package/lib/shared/path.js +27 -0
- package/lib/shared/string.d.ts +1 -0
- package/lib/shared/string.js +38 -0
- package/lib/shared/subscribable.d.ts +11 -0
- package/lib/shared/subscribable.js +74 -0
- package/lib/shared/uid.d.ts +1 -0
- package/lib/shared/uid.js +35 -0
- package/lib/validator/formats.d.ts +16 -0
- package/lib/validator/formats.js +40 -0
- package/lib/validator/index.d.ts +4 -0
- package/lib/validator/index.js +27 -0
- package/lib/validator/locale.d.ts +219 -0
- package/lib/validator/locale.js +240 -0
- package/lib/validator/parser.d.ts +5 -0
- package/lib/validator/parser.js +153 -0
- package/lib/validator/registry.d.ts +15 -0
- package/lib/validator/registry.js +116 -0
- package/lib/validator/rules.d.ts +3 -0
- package/lib/validator/rules.js +154 -0
- package/lib/validator/template.d.ts +2 -0
- package/lib/validator/template.js +42 -0
- package/lib/validator/types.d.ts +62 -0
- package/lib/validator/types.js +28 -0
- package/lib/validator/validator.d.ts +2 -0
- package/lib/validator/validator.js +63 -0
- package/package.json +16 -10
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shared_exports = {};
|
|
20
|
+
__export(shared_exports, {
|
|
21
|
+
isArr: () => isArr,
|
|
22
|
+
isAssignable: () => isAssignable,
|
|
23
|
+
isBool: () => isBool,
|
|
24
|
+
isEqual: () => isEqual,
|
|
25
|
+
isFn: () => isFn,
|
|
26
|
+
isNum: () => isNum,
|
|
27
|
+
isNumberLike: () => isNumberLike,
|
|
28
|
+
isObj: () => isObj,
|
|
29
|
+
isPlainObj: () => isPlainObj,
|
|
30
|
+
isRegExp: () => isRegExp,
|
|
31
|
+
isSegmentEqual: () => isSegmentEqual,
|
|
32
|
+
isStr: () => isStr,
|
|
33
|
+
toArr: () => toArr
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(shared_exports);
|
|
36
|
+
const toString = Object.prototype.toString;
|
|
37
|
+
const isType = /* @__PURE__ */ __name((type) => (obj) => toString.call(obj) === `[object ${type}]`, "isType");
|
|
38
|
+
const isFn = isType("Function");
|
|
39
|
+
const isArr = Array.isArray || isType("Array");
|
|
40
|
+
const isPlainObj = isType("Object");
|
|
41
|
+
const isStr = isType("String");
|
|
42
|
+
const isBool = isType("Boolean");
|
|
43
|
+
const isNum = isType("Number");
|
|
44
|
+
const isObj = /* @__PURE__ */ __name((val) => typeof val === "object", "isObj");
|
|
45
|
+
const isRegExp = isType("RegExp");
|
|
46
|
+
const isNumberLike = /* @__PURE__ */ __name((t) => {
|
|
47
|
+
return isNum(t) || /^(\d+)(\.\d+)?$/.test(t);
|
|
48
|
+
}, "isNumberLike");
|
|
49
|
+
const isArray = isArr;
|
|
50
|
+
const keyList = Object.keys;
|
|
51
|
+
const hasProp = Object.prototype.hasOwnProperty;
|
|
52
|
+
const toArr = /* @__PURE__ */ __name((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : [], "toArr");
|
|
53
|
+
const isAssignable = /* @__PURE__ */ __name((val) => {
|
|
54
|
+
return typeof val === "object" || typeof val === "function";
|
|
55
|
+
}, "isAssignable");
|
|
56
|
+
const isEqual = /* @__PURE__ */ __name((a, b) => {
|
|
57
|
+
if (a === b) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
61
|
+
const arrA = isArray(a);
|
|
62
|
+
const arrB = isArray(b);
|
|
63
|
+
let i;
|
|
64
|
+
let length;
|
|
65
|
+
let key;
|
|
66
|
+
if (arrA && arrB) {
|
|
67
|
+
length = a.length;
|
|
68
|
+
if (length !== b.length) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
for (i = length; i-- !== 0; ) {
|
|
72
|
+
if (!isEqual(a[i], b[i])) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (arrA !== arrB) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const keys = keyList(a);
|
|
82
|
+
length = keys.length;
|
|
83
|
+
if (length !== keyList(b).length) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
for (i = length; i-- !== 0; ) {
|
|
87
|
+
if (!hasProp.call(b, keys[i])) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (i = length; i-- !== 0; ) {
|
|
92
|
+
key = keys[i];
|
|
93
|
+
if (!isEqual(a[key], b[key])) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return a !== a && b !== b;
|
|
100
|
+
}, "isEqual");
|
|
101
|
+
const isSegmentEqual = /* @__PURE__ */ __name((a, b) => {
|
|
102
|
+
a = typeof a === "symbol" ? a : `${a}`;
|
|
103
|
+
b = typeof b === "symbol" ? b : `${b}`;
|
|
104
|
+
return a === b;
|
|
105
|
+
}, "isSegmentEqual");
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
isArr,
|
|
109
|
+
isAssignable,
|
|
110
|
+
isBool,
|
|
111
|
+
isEqual,
|
|
112
|
+
isFn,
|
|
113
|
+
isNum,
|
|
114
|
+
isNumberLike,
|
|
115
|
+
isObj,
|
|
116
|
+
isPlainObj,
|
|
117
|
+
isRegExp,
|
|
118
|
+
isSegmentEqual,
|
|
119
|
+
isStr,
|
|
120
|
+
toArr
|
|
121
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Context } from './contexts';
|
|
2
|
+
import { Token } from './tokens';
|
|
3
|
+
export declare class Tokenizer {
|
|
4
|
+
input: string;
|
|
5
|
+
state: {
|
|
6
|
+
context: Context[];
|
|
7
|
+
type: Token;
|
|
8
|
+
pos: number;
|
|
9
|
+
value?: any;
|
|
10
|
+
};
|
|
11
|
+
type_: Token;
|
|
12
|
+
constructor(input: string);
|
|
13
|
+
curContext(): Context;
|
|
14
|
+
includesContext(context: Context): boolean;
|
|
15
|
+
unexpect(type?: Token): Error;
|
|
16
|
+
expectNext(type?: Token, next?: Token): void;
|
|
17
|
+
expectPrev(type?: Token, prev?: Token): void;
|
|
18
|
+
match(type?: Token): boolean;
|
|
19
|
+
skipSpace(): void;
|
|
20
|
+
next(): void;
|
|
21
|
+
getCode(pos?: number): number;
|
|
22
|
+
eat(type: any): boolean;
|
|
23
|
+
readKeyWord(): void;
|
|
24
|
+
readIgnoreString(): void;
|
|
25
|
+
finishToken(type: Token, value?: any): void;
|
|
26
|
+
readToken(code: number, prevCode: number): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tokenizer_exports = {};
|
|
20
|
+
__export(tokenizer_exports, {
|
|
21
|
+
Tokenizer: () => Tokenizer
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tokenizer_exports);
|
|
24
|
+
var import_contexts = require("./contexts");
|
|
25
|
+
var import_tokens = require("./tokens");
|
|
26
|
+
const nonASCIIWhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
|
27
|
+
const fullCharCodeAtPos = /* @__PURE__ */ __name((input, pos) => {
|
|
28
|
+
if (String.fromCharCode) return input.codePointAt(pos);
|
|
29
|
+
const code = input.charCodeAt(pos);
|
|
30
|
+
if (code <= 55295 || code >= 57344) return code;
|
|
31
|
+
const next = input.charCodeAt(pos + 1);
|
|
32
|
+
return (code << 10) + next - 56613888;
|
|
33
|
+
}, "fullCharCodeAtPos");
|
|
34
|
+
const isRewordCode = /* @__PURE__ */ __name((code) => code === 42 || code === 46 || code === 33 || code === 91 || code === 93 || code === 40 || code === 41 || code === 44 || code === 58 || code === 126 || code === 123 || code === 125, "isRewordCode");
|
|
35
|
+
const getError = /* @__PURE__ */ __name((message, props) => {
|
|
36
|
+
const err = new Error(message);
|
|
37
|
+
Object.assign(err, props);
|
|
38
|
+
return err;
|
|
39
|
+
}, "getError");
|
|
40
|
+
const slice = /* @__PURE__ */ __name((string, start, end) => {
|
|
41
|
+
let str = "";
|
|
42
|
+
for (let i = start; i < end; i++) {
|
|
43
|
+
const ch = string.charAt(i);
|
|
44
|
+
if (ch !== "\\") {
|
|
45
|
+
str += ch;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return str;
|
|
49
|
+
}, "slice");
|
|
50
|
+
const _Tokenizer = class _Tokenizer {
|
|
51
|
+
constructor(input) {
|
|
52
|
+
this.input = input;
|
|
53
|
+
this.state = {
|
|
54
|
+
context: [],
|
|
55
|
+
type: null,
|
|
56
|
+
pos: 0
|
|
57
|
+
};
|
|
58
|
+
this.type_ = null;
|
|
59
|
+
}
|
|
60
|
+
curContext() {
|
|
61
|
+
return this.state.context[this.state.context.length - 1];
|
|
62
|
+
}
|
|
63
|
+
includesContext(context) {
|
|
64
|
+
for (let len = this.state.context.length - 1; len >= 0; len--) {
|
|
65
|
+
if (this.state.context[len] === context) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
unexpect(type) {
|
|
72
|
+
type = type || this.state.type;
|
|
73
|
+
return getError(`Unexpect token "${type.flag}" in ${this.state.pos} char.`, {
|
|
74
|
+
pos: this.state.pos
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
expectNext(type, next) {
|
|
78
|
+
if (type && type.expectNext) {
|
|
79
|
+
if (next && !type.expectNext.call(this, next)) {
|
|
80
|
+
throw getError(
|
|
81
|
+
`Unexpect token "${next.flag}" token should not be behind "${type.flag}" token.(${this.state.pos}th char)`,
|
|
82
|
+
{
|
|
83
|
+
pos: this.state.pos
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
expectPrev(type, prev) {
|
|
90
|
+
if (type && type.expectPrev) {
|
|
91
|
+
if (prev && !type.expectPrev.call(this, prev)) {
|
|
92
|
+
throw getError(`Unexpect token "${type.flag}" should not be behind "${prev.flag}"(${this.state.pos}th char).`, {
|
|
93
|
+
pos: this.state.pos
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
match(type) {
|
|
99
|
+
return this.state.type === type;
|
|
100
|
+
}
|
|
101
|
+
skipSpace() {
|
|
102
|
+
if (this.curContext() === import_contexts.bracketDContext) return;
|
|
103
|
+
loop: while (this.state.pos < this.input.length) {
|
|
104
|
+
const ch = this.input.charCodeAt(this.state.pos);
|
|
105
|
+
switch (ch) {
|
|
106
|
+
case 32:
|
|
107
|
+
case 160:
|
|
108
|
+
++this.state.pos;
|
|
109
|
+
break;
|
|
110
|
+
case 13:
|
|
111
|
+
if (this.input.charCodeAt(this.state.pos + 1) === 10) {
|
|
112
|
+
++this.state.pos;
|
|
113
|
+
}
|
|
114
|
+
case 10:
|
|
115
|
+
case 8232:
|
|
116
|
+
case 8233:
|
|
117
|
+
++this.state.pos;
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIWhitespace.test(String.fromCharCode(ch))) {
|
|
121
|
+
++this.state.pos;
|
|
122
|
+
} else {
|
|
123
|
+
break loop;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
next() {
|
|
129
|
+
this.type_ = this.state.type;
|
|
130
|
+
if (this.input.length <= this.state.pos) {
|
|
131
|
+
return this.finishToken(import_tokens.eofTok);
|
|
132
|
+
}
|
|
133
|
+
this.skipSpace();
|
|
134
|
+
this.readToken(this.getCode(), this.state.pos > 0 ? this.getCode(this.state.pos - 1) : -Infinity);
|
|
135
|
+
}
|
|
136
|
+
getCode(pos = this.state.pos) {
|
|
137
|
+
return fullCharCodeAtPos(this.input, pos);
|
|
138
|
+
}
|
|
139
|
+
eat(type) {
|
|
140
|
+
if (this.match(type)) {
|
|
141
|
+
this.next();
|
|
142
|
+
return true;
|
|
143
|
+
} else {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
readKeyWord() {
|
|
148
|
+
let startPos = this.state.pos, string = "";
|
|
149
|
+
while (true) {
|
|
150
|
+
const code = this.getCode();
|
|
151
|
+
const prevCode = this.getCode(this.state.pos - 1);
|
|
152
|
+
if (this.input.length === this.state.pos) {
|
|
153
|
+
string = slice(this.input, startPos, this.state.pos + 1);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (!isRewordCode(code) || prevCode === 92) {
|
|
157
|
+
if (code === 32 || code === 160 || code === 10 || code === 8232 || code === 8233) {
|
|
158
|
+
string = slice(this.input, startPos, this.state.pos);
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (code === 13 && this.input.charCodeAt(this.state.pos + 1) === 10) {
|
|
162
|
+
string = slice(this.input, startPos, this.state.pos);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
if (code > 8 && code < 14 || code >= 5760 && nonASCIIWhitespace.test(String.fromCharCode(code))) {
|
|
166
|
+
string = slice(this.input, startPos, this.state.pos);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
this.state.pos++;
|
|
170
|
+
} else {
|
|
171
|
+
string = slice(this.input, startPos, this.state.pos);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
this.finishToken(import_tokens.nameTok, string);
|
|
176
|
+
}
|
|
177
|
+
readIgnoreString() {
|
|
178
|
+
let startPos = this.state.pos, prevCode, string = "";
|
|
179
|
+
while (true) {
|
|
180
|
+
const code = this.getCode();
|
|
181
|
+
if (this.state.pos >= this.input.length) break;
|
|
182
|
+
if ((code === 91 || code === 93) && prevCode === 92) {
|
|
183
|
+
this.state.pos++;
|
|
184
|
+
prevCode = "";
|
|
185
|
+
} else if (code === 93 && prevCode === 93) {
|
|
186
|
+
string = this.input.slice(startPos, this.state.pos - 1).replace(/\\([[\]])/g, "$1");
|
|
187
|
+
this.state.pos++;
|
|
188
|
+
break;
|
|
189
|
+
} else {
|
|
190
|
+
this.state.pos++;
|
|
191
|
+
prevCode = code;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
this.finishToken(import_tokens.ignoreTok, string);
|
|
195
|
+
this.finishToken(import_tokens.bracketDRTok);
|
|
196
|
+
}
|
|
197
|
+
finishToken(type, value) {
|
|
198
|
+
const preType = this.state.type;
|
|
199
|
+
this.state.type = type;
|
|
200
|
+
if (value !== void 0) this.state.value = value;
|
|
201
|
+
this.expectNext(preType, type);
|
|
202
|
+
this.expectPrev(type, preType);
|
|
203
|
+
if (type.updateContext) {
|
|
204
|
+
type.updateContext.call(this, preType);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
readToken(code, prevCode) {
|
|
208
|
+
if (prevCode === 92) {
|
|
209
|
+
return this.readKeyWord();
|
|
210
|
+
}
|
|
211
|
+
if (this.input.length <= this.state.pos) {
|
|
212
|
+
this.finishToken(import_tokens.eofTok);
|
|
213
|
+
} else if (this.curContext() === import_contexts.bracketDContext) {
|
|
214
|
+
this.readIgnoreString();
|
|
215
|
+
} else if (code === 123) {
|
|
216
|
+
this.state.pos++;
|
|
217
|
+
this.finishToken(import_tokens.braceLTok);
|
|
218
|
+
} else if (code === 125) {
|
|
219
|
+
this.state.pos++;
|
|
220
|
+
this.finishToken(import_tokens.braceRTok);
|
|
221
|
+
} else if (code === 42) {
|
|
222
|
+
this.state.pos++;
|
|
223
|
+
if (this.getCode() === 42) {
|
|
224
|
+
this.state.pos++;
|
|
225
|
+
return this.finishToken(import_tokens.dbStarTok);
|
|
226
|
+
}
|
|
227
|
+
this.finishToken(import_tokens.starTok);
|
|
228
|
+
} else if (code === 33) {
|
|
229
|
+
this.state.pos++;
|
|
230
|
+
this.finishToken(import_tokens.bangTok);
|
|
231
|
+
} else if (code === 46) {
|
|
232
|
+
this.state.pos++;
|
|
233
|
+
this.finishToken(import_tokens.dotTok);
|
|
234
|
+
} else if (code === 91) {
|
|
235
|
+
this.state.pos++;
|
|
236
|
+
if (this.getCode() === 91) {
|
|
237
|
+
this.state.pos++;
|
|
238
|
+
return this.finishToken(import_tokens.bracketDLTok);
|
|
239
|
+
}
|
|
240
|
+
this.finishToken(import_tokens.bracketLTok);
|
|
241
|
+
} else if (code === 126) {
|
|
242
|
+
this.state.pos++;
|
|
243
|
+
this.finishToken(import_tokens.expandTok);
|
|
244
|
+
} else if (code === 93) {
|
|
245
|
+
this.state.pos++;
|
|
246
|
+
this.finishToken(import_tokens.bracketRTok);
|
|
247
|
+
} else if (code === 40) {
|
|
248
|
+
this.state.pos++;
|
|
249
|
+
this.finishToken(import_tokens.parenLTok);
|
|
250
|
+
} else if (code === 41) {
|
|
251
|
+
this.state.pos++;
|
|
252
|
+
this.finishToken(import_tokens.parenRTok);
|
|
253
|
+
} else if (code === 44) {
|
|
254
|
+
this.state.pos++;
|
|
255
|
+
this.finishToken(import_tokens.commaTok);
|
|
256
|
+
} else if (code === 58) {
|
|
257
|
+
this.state.pos++;
|
|
258
|
+
this.finishToken(import_tokens.colonTok);
|
|
259
|
+
} else {
|
|
260
|
+
this.readKeyWord();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
__name(_Tokenizer, "Tokenizer");
|
|
265
|
+
let Tokenizer = _Tokenizer;
|
|
266
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
267
|
+
0 && (module.exports = {
|
|
268
|
+
Tokenizer
|
|
269
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface ITokenProps {
|
|
2
|
+
expectNext?: (next?: Token) => boolean;
|
|
3
|
+
expectPrev?: (prev?: Token) => boolean;
|
|
4
|
+
updateContext?: (prev?: Token) => void;
|
|
5
|
+
}
|
|
6
|
+
export type Token = ITokenProps & {
|
|
7
|
+
flag: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const nameTok: Token;
|
|
10
|
+
export declare const starTok: Token;
|
|
11
|
+
export declare const dbStarTok: Token;
|
|
12
|
+
export declare const dotTok: Token;
|
|
13
|
+
export declare const bangTok: Token;
|
|
14
|
+
export declare const colonTok: Token;
|
|
15
|
+
export declare const braceLTok: Token;
|
|
16
|
+
export declare const braceRTok: Token;
|
|
17
|
+
export declare const bracketLTok: Token;
|
|
18
|
+
export declare const bracketRTok: Token;
|
|
19
|
+
export declare const bracketDLTok: Token;
|
|
20
|
+
export declare const bracketDRTok: Token;
|
|
21
|
+
export declare const parenLTok: Token;
|
|
22
|
+
export declare const parenRTok: Token;
|
|
23
|
+
export declare const commaTok: Token;
|
|
24
|
+
export declare const ignoreTok: Token;
|
|
25
|
+
export declare const expandTok: Token;
|
|
26
|
+
export declare const eofTok: Token;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tokens_exports = {};
|
|
20
|
+
__export(tokens_exports, {
|
|
21
|
+
bangTok: () => bangTok,
|
|
22
|
+
braceLTok: () => braceLTok,
|
|
23
|
+
braceRTok: () => braceRTok,
|
|
24
|
+
bracketDLTok: () => bracketDLTok,
|
|
25
|
+
bracketDRTok: () => bracketDRTok,
|
|
26
|
+
bracketLTok: () => bracketLTok,
|
|
27
|
+
bracketRTok: () => bracketRTok,
|
|
28
|
+
colonTok: () => colonTok,
|
|
29
|
+
commaTok: () => commaTok,
|
|
30
|
+
dbStarTok: () => dbStarTok,
|
|
31
|
+
dotTok: () => dotTok,
|
|
32
|
+
eofTok: () => eofTok,
|
|
33
|
+
expandTok: () => expandTok,
|
|
34
|
+
ignoreTok: () => ignoreTok,
|
|
35
|
+
nameTok: () => nameTok,
|
|
36
|
+
parenLTok: () => parenLTok,
|
|
37
|
+
parenRTok: () => parenRTok,
|
|
38
|
+
starTok: () => starTok
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(tokens_exports);
|
|
41
|
+
var import_contexts = require("./contexts");
|
|
42
|
+
const TokenType = /* @__PURE__ */ __name((flag, props) => {
|
|
43
|
+
return {
|
|
44
|
+
flag,
|
|
45
|
+
...props
|
|
46
|
+
};
|
|
47
|
+
}, "TokenType");
|
|
48
|
+
const nameTok = TokenType("name", {
|
|
49
|
+
expectNext(next) {
|
|
50
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
51
|
+
return next === nameTok || next === commaTok || next === bracketRTok || next === braceRTok || next === colonTok;
|
|
52
|
+
}
|
|
53
|
+
return next === dotTok || next === commaTok || next === eofTok || next === bracketRTok || next === parenRTok || next === colonTok || next === expandTok || next === bracketLTok;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const starTok = TokenType("*", {
|
|
57
|
+
expectNext(next) {
|
|
58
|
+
return next === dotTok || next === parenLTok || next === bracketLTok || next === eofTok || next === commaTok || next === parenRTok;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const dbStarTok = TokenType("**", {
|
|
62
|
+
expectNext(next) {
|
|
63
|
+
return next === dotTok || next === bracketLTok || next === eofTok || next === commaTok || next === parenRTok;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const dotTok = TokenType(".", {
|
|
67
|
+
expectNext(next) {
|
|
68
|
+
return next === dotTok || next === nameTok || next === bracketDLTok || next === starTok || next === dbStarTok || next === bracketLTok || next === braceLTok || next === eofTok;
|
|
69
|
+
},
|
|
70
|
+
expectPrev(prev) {
|
|
71
|
+
return prev === dotTok || prev === nameTok || prev === bracketDRTok || prev === starTok || prev === parenRTok || prev === bracketRTok || prev === expandTok || prev === braceRTok;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const bangTok = TokenType("!", {
|
|
75
|
+
expectNext(next) {
|
|
76
|
+
return next === nameTok || next === bracketDLTok;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const colonTok = TokenType(":", {
|
|
80
|
+
expectNext(next) {
|
|
81
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
82
|
+
return next === nameTok || next === braceLTok || next === bracketLTok;
|
|
83
|
+
}
|
|
84
|
+
return next === nameTok || next === bracketDLTok || next === bracketRTok;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const braceLTok = TokenType("{", {
|
|
88
|
+
expectNext(next) {
|
|
89
|
+
return next === nameTok;
|
|
90
|
+
},
|
|
91
|
+
expectPrev(prev) {
|
|
92
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
93
|
+
return prev === colonTok || prev === commaTok || prev === bracketLTok;
|
|
94
|
+
}
|
|
95
|
+
return prev === dotTok || prev === colonTok || prev === parenLTok;
|
|
96
|
+
},
|
|
97
|
+
updateContext() {
|
|
98
|
+
this.state.context.push(import_contexts.braceContext);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const braceRTok = TokenType("}", {
|
|
102
|
+
expectNext(next) {
|
|
103
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
104
|
+
return next === commaTok || next === braceRTok || next === eofTok || next === bracketRTok;
|
|
105
|
+
}
|
|
106
|
+
return next === dotTok || next === eofTok || next === commaTok;
|
|
107
|
+
},
|
|
108
|
+
expectPrev(prev) {
|
|
109
|
+
return prev === nameTok || prev === braceRTok || prev === bracketRTok;
|
|
110
|
+
},
|
|
111
|
+
updateContext() {
|
|
112
|
+
this.state.context.pop(import_contexts.braceContext);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const bracketLTok = TokenType("[", {
|
|
116
|
+
expectNext(next) {
|
|
117
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
118
|
+
return next === nameTok || next === bracketLTok || next === braceLTok || next === bracketRTok;
|
|
119
|
+
}
|
|
120
|
+
return next === nameTok || next === bracketDLTok || next === colonTok || next === bracketLTok || next === ignoreTok || next === bracketRTok;
|
|
121
|
+
},
|
|
122
|
+
expectPrev(prev) {
|
|
123
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
124
|
+
return prev === colonTok || prev === commaTok || prev === bracketLTok;
|
|
125
|
+
}
|
|
126
|
+
return prev === starTok || prev === bracketLTok || prev === dotTok || prev === nameTok || prev === parenLTok || // never reach
|
|
127
|
+
prev === commaTok;
|
|
128
|
+
},
|
|
129
|
+
updateContext() {
|
|
130
|
+
this.state.context.push(import_contexts.bracketContext);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const bracketRTok = TokenType("]", {
|
|
134
|
+
expectNext(next) {
|
|
135
|
+
if (this.includesContext(import_contexts.destructorContext)) {
|
|
136
|
+
return next === commaTok || next === braceRTok || next === bracketRTok || next === eofTok;
|
|
137
|
+
}
|
|
138
|
+
return next === dotTok || next === eofTok || next === commaTok || next === parenRTok || next === bracketRTok;
|
|
139
|
+
},
|
|
140
|
+
updateContext() {
|
|
141
|
+
if (this.includesContext(import_contexts.bracketArrayContext)) return;
|
|
142
|
+
if (!this.includesContext(import_contexts.bracketContext)) throw this.unexpect();
|
|
143
|
+
this.state.context.pop();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const bracketDLTok = TokenType("[[", {
|
|
147
|
+
updateContext() {
|
|
148
|
+
this.state.context.push(import_contexts.bracketDContext);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const bracketDRTok = TokenType("]]", {
|
|
152
|
+
updateContext() {
|
|
153
|
+
if (this.curContext() !== import_contexts.bracketDContext) throw this.unexpect();
|
|
154
|
+
this.state.context.pop();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const parenLTok = TokenType("(", {
|
|
158
|
+
expectNext(next) {
|
|
159
|
+
return next === nameTok || next === bracketDLTok || next === braceLTok || next === bangTok || next === bracketLTok;
|
|
160
|
+
},
|
|
161
|
+
expectPrev(prev) {
|
|
162
|
+
return prev === starTok;
|
|
163
|
+
},
|
|
164
|
+
updateContext() {
|
|
165
|
+
this.state.context.push(import_contexts.parenContext);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const parenRTok = TokenType(")", {
|
|
169
|
+
expectNext(next) {
|
|
170
|
+
return next === dotTok || next === eofTok || next === commaTok || next === parenRTok;
|
|
171
|
+
},
|
|
172
|
+
updateContext() {
|
|
173
|
+
if (this.curContext() !== import_contexts.parenContext) throw this.unexpect();
|
|
174
|
+
this.state.context.pop();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const commaTok = TokenType(",", {
|
|
178
|
+
expectNext(next) {
|
|
179
|
+
return next === nameTok || next === bracketDLTok || next === bracketLTok || next === braceLTok;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const ignoreTok = TokenType("ignore", {
|
|
183
|
+
expectNext(next) {
|
|
184
|
+
return next === bracketDRTok;
|
|
185
|
+
},
|
|
186
|
+
expectPrev(prev) {
|
|
187
|
+
return prev === bracketDLTok;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
const expandTok = TokenType("expandTok", {
|
|
191
|
+
expectNext(next) {
|
|
192
|
+
return next === dotTok || next === eofTok || next === commaTok || next === parenRTok;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const eofTok = TokenType("eof");
|
|
196
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
197
|
+
0 && (module.exports = {
|
|
198
|
+
bangTok,
|
|
199
|
+
braceLTok,
|
|
200
|
+
braceRTok,
|
|
201
|
+
bracketDLTok,
|
|
202
|
+
bracketDRTok,
|
|
203
|
+
bracketLTok,
|
|
204
|
+
bracketRTok,
|
|
205
|
+
colonTok,
|
|
206
|
+
commaTok,
|
|
207
|
+
dbStarTok,
|
|
208
|
+
dotTok,
|
|
209
|
+
eofTok,
|
|
210
|
+
expandTok,
|
|
211
|
+
ignoreTok,
|
|
212
|
+
nameTok,
|
|
213
|
+
parenLTok,
|
|
214
|
+
parenRTok,
|
|
215
|
+
starTok
|
|
216
|
+
});
|