@witchcraft/expressit 0.0.2
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/README.md +86 -0
- package/dist/ast/builders/array.d.ts +8 -0
- package/dist/ast/builders/array.d.ts.map +1 -0
- package/dist/ast/builders/array.js +31 -0
- package/dist/ast/builders/condition.d.ts +20 -0
- package/dist/ast/builders/condition.d.ts.map +1 -0
- package/dist/ast/builders/condition.js +28 -0
- package/dist/ast/builders/delim.d.ts +11 -0
- package/dist/ast/builders/delim.d.ts.map +1 -0
- package/dist/ast/builders/delim.js +20 -0
- package/dist/ast/builders/error.d.ts +9 -0
- package/dist/ast/builders/error.d.ts.map +1 -0
- package/dist/ast/builders/error.js +16 -0
- package/dist/ast/builders/expression.d.ts +12 -0
- package/dist/ast/builders/expression.d.ts.map +1 -0
- package/dist/ast/builders/expression.js +31 -0
- package/dist/ast/builders/group.d.ts +20 -0
- package/dist/ast/builders/group.d.ts.map +1 -0
- package/dist/ast/builders/group.js +47 -0
- package/dist/ast/builders/index.d.ts +12 -0
- package/dist/ast/builders/index.d.ts.map +1 -0
- package/dist/ast/builders/index.js +24 -0
- package/dist/ast/builders/isFullPos.d.ts +6 -0
- package/dist/ast/builders/isFullPos.d.ts.map +1 -0
- package/dist/ast/builders/isFullPos.js +6 -0
- package/dist/ast/builders/pos.d.ts +21 -0
- package/dist/ast/builders/pos.d.ts.map +1 -0
- package/dist/ast/builders/pos.js +28 -0
- package/dist/ast/builders/token.d.ts +12 -0
- package/dist/ast/builders/token.d.ts.map +1 -0
- package/dist/ast/builders/token.js +26 -0
- package/dist/ast/builders/type.d.ts +6 -0
- package/dist/ast/builders/type.d.ts.map +1 -0
- package/dist/ast/builders/type.js +37 -0
- package/dist/ast/builders/variable.d.ts +17 -0
- package/dist/ast/builders/variable.d.ts.map +1 -0
- package/dist/ast/builders/variable.js +62 -0
- package/dist/ast/classes/ArrayNode.d.ts +18 -0
- package/dist/ast/classes/ArrayNode.d.ts.map +1 -0
- package/dist/ast/classes/ArrayNode.js +55 -0
- package/dist/ast/classes/Condition.d.ts +13 -0
- package/dist/ast/classes/Condition.d.ts.map +1 -0
- package/dist/ast/classes/Condition.js +21 -0
- package/dist/ast/classes/ConditionNode.d.ts +73 -0
- package/dist/ast/classes/ConditionNode.d.ts.map +1 -0
- package/dist/ast/classes/ConditionNode.js +101 -0
- package/dist/ast/classes/ErrorToken.d.ts +27 -0
- package/dist/ast/classes/ErrorToken.d.ts.map +1 -0
- package/dist/ast/classes/ErrorToken.js +47 -0
- package/dist/ast/classes/Expression.d.ts +13 -0
- package/dist/ast/classes/Expression.d.ts.map +1 -0
- package/dist/ast/classes/Expression.js +19 -0
- package/dist/ast/classes/ExpressionNode.d.ts +21 -0
- package/dist/ast/classes/ExpressionNode.d.ts.map +1 -0
- package/dist/ast/classes/ExpressionNode.js +57 -0
- package/dist/ast/classes/GroupNode.d.ts +64 -0
- package/dist/ast/classes/GroupNode.d.ts.map +1 -0
- package/dist/ast/classes/GroupNode.js +69 -0
- package/dist/ast/classes/Node.d.ts +22 -0
- package/dist/ast/classes/Node.d.ts.map +1 -0
- package/dist/ast/classes/Node.js +28 -0
- package/dist/ast/classes/Token.d.ts +27 -0
- package/dist/ast/classes/Token.d.ts.map +1 -0
- package/dist/ast/classes/Token.js +28 -0
- package/dist/ast/classes/ValidToken.d.ts +26 -0
- package/dist/ast/classes/ValidToken.d.ts.map +1 -0
- package/dist/ast/classes/ValidToken.js +49 -0
- package/dist/ast/classes/VariableNode.d.ts +33 -0
- package/dist/ast/classes/VariableNode.d.ts.map +1 -0
- package/dist/ast/classes/VariableNode.js +58 -0
- package/dist/ast/classes/index.d.ts +12 -0
- package/dist/ast/classes/index.d.ts.map +1 -0
- package/dist/ast/classes/index.js +24 -0
- package/dist/ast/handlers.d.ts +42 -0
- package/dist/ast/handlers.d.ts.map +1 -0
- package/dist/ast/handlers.js +150 -0
- package/dist/ast/index.d.ts +4 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +8 -0
- package/dist/examples/advancedValueComparer.d.ts +3 -0
- package/dist/examples/advancedValueComparer.d.ts.map +1 -0
- package/dist/examples/advancedValueComparer.js +28 -0
- package/dist/examples/shortcutContextParser.d.ts +22 -0
- package/dist/examples/shortcutContextParser.d.ts.map +1 -0
- package/dist/examples/shortcutContextParser.js +126 -0
- package/dist/global.d.js +1 -0
- package/dist/grammar/ParserBase.d.ts +51 -0
- package/dist/grammar/ParserBase.d.ts.map +1 -0
- package/dist/grammar/ParserBase.js +516 -0
- package/dist/grammar/createTokens.d.ts +56 -0
- package/dist/grammar/createTokens.d.ts.map +1 -0
- package/dist/grammar/createTokens.js +843 -0
- package/dist/grammar/index.d.ts +3 -0
- package/dist/grammar/index.d.ts.map +1 -0
- package/dist/grammar/index.js +6 -0
- package/dist/helpers/errors.d.ts +9 -0
- package/dist/helpers/errors.d.ts.map +1 -0
- package/dist/helpers/errors.js +41 -0
- package/dist/helpers/general/applyBoolean.d.ts +3 -0
- package/dist/helpers/general/applyBoolean.d.ts.map +1 -0
- package/dist/helpers/general/applyBoolean.js +17 -0
- package/dist/helpers/general/applyPrefix.d.ts +4 -0
- package/dist/helpers/general/applyPrefix.d.ts.map +1 -0
- package/dist/helpers/general/applyPrefix.js +9 -0
- package/dist/helpers/general/defaultConditionNormalizer.d.ts +3 -0
- package/dist/helpers/general/defaultConditionNormalizer.d.ts.map +1 -0
- package/dist/helpers/general/defaultConditionNormalizer.js +6 -0
- package/dist/helpers/general/defaultKeyParser.d.ts +3 -0
- package/dist/helpers/general/defaultKeyParser.d.ts.map +1 -0
- package/dist/helpers/general/defaultKeyParser.js +8 -0
- package/dist/helpers/general/defaultPrefixApplier.d.ts +3 -0
- package/dist/helpers/general/defaultPrefixApplier.d.ts.map +1 -0
- package/dist/helpers/general/defaultPrefixApplier.js +6 -0
- package/dist/helpers/general/defaultValueComparer.d.ts +3 -0
- package/dist/helpers/general/defaultValueComparer.d.ts.map +1 -0
- package/dist/helpers/general/defaultValueComparer.js +6 -0
- package/dist/helpers/general/index.d.ts +7 -0
- package/dist/helpers/general/index.d.ts.map +1 -0
- package/dist/helpers/general/index.js +14 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +8 -0
- package/dist/helpers/parser/assignParents.d.ts +4 -0
- package/dist/helpers/parser/assignParents.d.ts.map +1 -0
- package/dist/helpers/parser/assignParents.js +71 -0
- package/dist/helpers/parser/checkParserOpts.d.ts +3 -0
- package/dist/helpers/parser/checkParserOpts.d.ts.map +1 -0
- package/dist/helpers/parser/checkParserOpts.js +126 -0
- package/dist/helpers/parser/extractPosition.d.ts +9 -0
- package/dist/helpers/parser/extractPosition.d.ts.map +1 -0
- package/dist/helpers/parser/extractPosition.js +9 -0
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts +5 -0
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts.map +1 -0
- package/dist/helpers/parser/getUnclosedRightParenCount.js +20 -0
- package/dist/helpers/parser/index.d.ts +9 -0
- package/dist/helpers/parser/index.d.ts.map +1 -0
- package/dist/helpers/parser/index.js +18 -0
- package/dist/helpers/parser/parseParserOptions.d.ts +4 -0
- package/dist/helpers/parser/parseParserOptions.d.ts.map +1 -0
- package/dist/helpers/parser/parseParserOptions.js +45 -0
- package/dist/helpers/parser/seal.d.ts +8 -0
- package/dist/helpers/parser/seal.d.ts.map +1 -0
- package/dist/helpers/parser/seal.js +10 -0
- package/dist/helpers/parser/setParent.d.ts +6 -0
- package/dist/helpers/parser/setParent.d.ts.map +1 -0
- package/dist/helpers/parser/setParent.js +4 -0
- package/dist/helpers/parser/unescape.d.ts +3 -0
- package/dist/helpers/parser/unescape.d.ts.map +1 -0
- package/dist/helpers/parser/unescape.js +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/methods/autocomplete.d.ts +18 -0
- package/dist/methods/autocomplete.d.ts.map +1 -0
- package/dist/methods/autocomplete.js +109 -0
- package/dist/methods/autoreplace.d.ts +13 -0
- package/dist/methods/autoreplace.d.ts.map +1 -0
- package/dist/methods/autoreplace.js +36 -0
- package/dist/methods/autosuggest.d.ts +28 -0
- package/dist/methods/autosuggest.d.ts.map +1 -0
- package/dist/methods/autosuggest.js +371 -0
- package/dist/methods/evaluate.d.ts +11 -0
- package/dist/methods/evaluate.d.ts.map +1 -0
- package/dist/methods/evaluate.js +30 -0
- package/dist/methods/getBestIndex.d.ts +19 -0
- package/dist/methods/getBestIndex.d.ts.map +1 -0
- package/dist/methods/getBestIndex.js +53 -0
- package/dist/methods/getIndexes.d.ts +17 -0
- package/dist/methods/getIndexes.d.ts.map +1 -0
- package/dist/methods/getIndexes.js +97 -0
- package/dist/methods/index.d.ts +9 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +18 -0
- package/dist/methods/normalize.d.ts +12 -0
- package/dist/methods/normalize.d.ts.map +1 -0
- package/dist/methods/normalize.js +99 -0
- package/dist/methods/validate.d.ts +11 -0
- package/dist/methods/validate.d.ts.map +1 -0
- package/dist/methods/validate.js +111 -0
- package/dist/package.js +7 -0
- package/dist/package.json.js +193 -0
- package/dist/parser.d.ts +58 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +136 -0
- package/dist/types/ast.d.ts +70 -0
- package/dist/types/ast.d.ts.map +1 -0
- package/dist/types/ast.js +29 -0
- package/dist/types/autocomplete.d.ts +143 -0
- package/dist/types/autocomplete.d.ts.map +1 -0
- package/dist/types/autocomplete.js +24 -0
- package/dist/types/errors.d.ts +34 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +10 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/parser.d.ts +451 -0
- package/dist/types/parser.d.ts.map +1 -0
- package/dist/types/parser.js +1 -0
- package/dist/utils/extractTokens.d.ts +8 -0
- package/dist/utils/extractTokens.d.ts.map +1 -0
- package/dist/utils/extractTokens.js +50 -0
- package/dist/utils/getCursorInfo.d.ts +7 -0
- package/dist/utils/getCursorInfo.d.ts.map +1 -0
- package/dist/utils/getCursorInfo.js +86 -0
- package/dist/utils/getOppositeDelimiter.d.ts +6 -0
- package/dist/utils/getOppositeDelimiter.d.ts.map +1 -0
- package/dist/utils/getOppositeDelimiter.js +35 -0
- package/dist/utils/getSurroundingErrors.d.ts +25 -0
- package/dist/utils/getSurroundingErrors.d.ts.map +1 -0
- package/dist/utils/getSurroundingErrors.js +37 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/isBracket.d.ts +3 -0
- package/dist/utils/isBracket.d.ts.map +1 -0
- package/dist/utils/isBracket.js +7 -0
- package/dist/utils/isDelimiter.d.ts +6 -0
- package/dist/utils/isDelimiter.d.ts.map +1 -0
- package/dist/utils/isDelimiter.js +17 -0
- package/dist/utils/isParen.d.ts +3 -0
- package/dist/utils/isParen.d.ts.map +1 -0
- package/dist/utils/isParen.js +7 -0
- package/dist/utils/isQuote.d.ts +4 -0
- package/dist/utils/isQuote.d.ts.map +1 -0
- package/dist/utils/isQuote.js +7 -0
- package/dist/utils/prettyAst.d.ts +35 -0
- package/dist/utils/prettyAst.d.ts.map +1 -0
- package/dist/utils/prettyAst.js +112 -0
- package/package.json +152 -0
- package/src/ast/builders/array.ts +45 -0
- package/src/ast/builders/condition.ts +56 -0
- package/src/ast/builders/delim.ts +39 -0
- package/src/ast/builders/error.ts +22 -0
- package/src/ast/builders/expression.ts +66 -0
- package/src/ast/builders/group.ts +79 -0
- package/src/ast/builders/index.ts +13 -0
- package/src/ast/builders/isFullPos.ts +10 -0
- package/src/ast/builders/pos.ts +57 -0
- package/src/ast/builders/token.ts +46 -0
- package/src/ast/builders/type.ts +32 -0
- package/src/ast/builders/variable.ts +89 -0
- package/src/ast/classes/ArrayNode.ts +46 -0
- package/src/ast/classes/Condition.ts +22 -0
- package/src/ast/classes/ConditionNode.ts +141 -0
- package/src/ast/classes/ErrorToken.ts +49 -0
- package/src/ast/classes/Expression.ts +26 -0
- package/src/ast/classes/ExpressionNode.ts +62 -0
- package/src/ast/classes/GroupNode.ts +127 -0
- package/src/ast/classes/Node.ts +47 -0
- package/src/ast/classes/Token.ts +59 -0
- package/src/ast/classes/ValidToken.ts +56 -0
- package/src/ast/classes/VariableNode.ts +67 -0
- package/src/ast/classes/index.ts +13 -0
- package/src/ast/handlers.ts +190 -0
- package/src/ast/index.ts +5 -0
- package/src/examples/advancedValueComparer.ts +31 -0
- package/src/examples/shortcutContextParser.ts +140 -0
- package/src/global.d.ts +4 -0
- package/src/grammar/ParserBase.ts +715 -0
- package/src/grammar/createTokens.ts +512 -0
- package/src/grammar/index.ts +4 -0
- package/src/helpers/errors.ts +45 -0
- package/src/helpers/general/applyBoolean.ts +9 -0
- package/src/helpers/general/applyPrefix.ts +7 -0
- package/src/helpers/general/defaultConditionNormalizer.ts +9 -0
- package/src/helpers/general/defaultKeyParser.ts +8 -0
- package/src/helpers/general/defaultPrefixApplier.ts +7 -0
- package/src/helpers/general/defaultValueComparer.ts +7 -0
- package/src/helpers/general/index.ts +8 -0
- package/src/helpers/index.ts +5 -0
- package/src/helpers/parser/assignParents.ts +51 -0
- package/src/helpers/parser/checkParserOpts.ts +143 -0
- package/src/helpers/parser/extractPosition.ts +15 -0
- package/src/helpers/parser/getUnclosedRightParenCount.ts +22 -0
- package/src/helpers/parser/index.ts +10 -0
- package/src/helpers/parser/parseParserOptions.ts +54 -0
- package/src/helpers/parser/seal.ts +14 -0
- package/src/helpers/parser/setParent.ts +5 -0
- package/src/helpers/parser/unescape.ts +4 -0
- package/src/index.ts +7 -0
- package/src/methods/autocomplete.ts +128 -0
- package/src/methods/autoreplace.ts +46 -0
- package/src/methods/autosuggest.ts +543 -0
- package/src/methods/evaluate.ts +37 -0
- package/src/methods/getBestIndex.ts +53 -0
- package/src/methods/getIndexes.ts +99 -0
- package/src/methods/index.ts +10 -0
- package/src/methods/normalize.ts +138 -0
- package/src/methods/validate.ts +141 -0
- package/src/package.js +11 -0
- package/src/parser.ts +183 -0
- package/src/types/ast.ts +148 -0
- package/src/types/autocomplete.ts +152 -0
- package/src/types/errors.ts +40 -0
- package/src/types/index.ts +6 -0
- package/src/types/parser.ts +479 -0
- package/src/utils/extractTokens.ts +67 -0
- package/src/utils/getCursorInfo.ts +106 -0
- package/src/utils/getOppositeDelimiter.ts +36 -0
- package/src/utils/getSurroundingErrors.ts +57 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/isBracket.ts +6 -0
- package/src/utils/isDelimiter.ts +18 -0
- package/src/utils/isParen.ts +6 -0
- package/src/utils/isQuote.ts +6 -0
- package/src/utils/prettyAst.ts +152 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grammar/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ERROR_CODES, ErrorInfo } from "../types/errors.js";
|
|
2
|
+
export declare class BooleanParserLibraryError<T extends ERROR_CODES> extends Error {
|
|
3
|
+
version: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
type: T;
|
|
6
|
+
info: ErrorInfo<T>;
|
|
7
|
+
constructor(type: T, info: ErrorInfo<T>, message?: string);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/helpers/errors.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGhE,qBAAa,yBAAyB,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,KAAK;IAC1E,OAAO,EAAE,MAAM,CAAU;IAEzB,IAAI,EAAE,MAAM,CAAa;IAEzB,IAAI,EAAE,CAAC,CAAA;IAEP,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;gBAEN,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;CAYzD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { pretty, crop, indent } from "@alanscodelog/utils";
|
|
8
|
+
import { version, repository } from "../package.js";
|
|
9
|
+
class BooleanParserLibraryError extends Error {
|
|
10
|
+
constructor(type, info, message) {
|
|
11
|
+
super(
|
|
12
|
+
message ? `${message}
|
|
13
|
+
${pretty(info)}` : `This error should never happen, please file a bug report at ${repository}/issues with the following information:
|
|
14
|
+
${crop`
|
|
15
|
+
version: ${version}
|
|
16
|
+
type: ${type}
|
|
17
|
+
info: ${indent(JSON.stringify(info, forceStringifyErrors, " "), 5)}
|
|
18
|
+
`}`
|
|
19
|
+
);
|
|
20
|
+
__publicField(this, "version", version);
|
|
21
|
+
__publicField(this, "repo", repository);
|
|
22
|
+
__publicField(this, "type");
|
|
23
|
+
__publicField(this, "info");
|
|
24
|
+
this.type = type;
|
|
25
|
+
this.info = info;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function forceStringifyErrors(_key, value) {
|
|
29
|
+
if (value instanceof Error) {
|
|
30
|
+
return Object.fromEntries(
|
|
31
|
+
Object.getOwnPropertyNames(value).map((key) => [
|
|
32
|
+
key,
|
|
33
|
+
key === "stack" ? value[key].split(/\n/) : value[key]
|
|
34
|
+
])
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
BooleanParserLibraryError
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyBoolean.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/applyBoolean.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAO/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPrefix.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/applyPrefix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,gBAAgB;AAChB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM,CAGzG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultConditionNormalizer.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/defaultConditionNormalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAc,MAAM,uBAAuB,CAAA;AAG5E,eAAO,MAAM,0BAA0B,EAAE,mBAKxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultKeyParser.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/defaultKeyParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGtD,eAAO,MAAM,gBAAgB,EAAE,SAI7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultPrefixApplier.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/defaultPrefixApplier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,eAAO,MAAM,oBAAoB,EAAE,aAGlC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultValueComparer.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/defaultValueComparer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,eAAO,MAAM,oBAAoB,EAAE,aAGlC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { applyBoolean } from "./applyBoolean.js";
|
|
2
|
+
export { applyPrefix } from "./applyPrefix.js";
|
|
3
|
+
export { defaultConditionNormalizer } from "./defaultConditionNormalizer.js";
|
|
4
|
+
export { defaultKeyParser } from "./defaultKeyParser.js";
|
|
5
|
+
export { defaultPrefixApplier } from "./defaultPrefixApplier.js";
|
|
6
|
+
export { defaultValueComparer } from "./defaultValueComparer.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/general/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { applyBoolean } from "./applyBoolean.js";
|
|
2
|
+
import { applyPrefix } from "./applyPrefix.js";
|
|
3
|
+
import { defaultConditionNormalizer } from "./defaultConditionNormalizer.js";
|
|
4
|
+
import { defaultKeyParser } from "./defaultKeyParser.js";
|
|
5
|
+
import { defaultPrefixApplier } from "./defaultPrefixApplier.js";
|
|
6
|
+
import { defaultValueComparer } from "./defaultValueComparer.js";
|
|
7
|
+
export {
|
|
8
|
+
applyBoolean,
|
|
9
|
+
applyPrefix,
|
|
10
|
+
defaultConditionNormalizer,
|
|
11
|
+
defaultKeyParser,
|
|
12
|
+
defaultPrefixApplier,
|
|
13
|
+
defaultValueComparer
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assignParents.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/assignParents.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAyC9C"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ArrayNode } from "../../ast/classes/ArrayNode.js";
|
|
2
|
+
import { ConditionNode } from "../../ast/classes/ConditionNode.js";
|
|
3
|
+
import { ExpressionNode } from "../../ast/classes/ExpressionNode.js";
|
|
4
|
+
import { GroupNode } from "../../ast/classes/GroupNode.js";
|
|
5
|
+
import { Node } from "../../ast/classes/Node.js";
|
|
6
|
+
import { VariableNode } from "../../ast/classes/VariableNode.js";
|
|
7
|
+
function assignParents(ast) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
|
+
if (ast instanceof VariableNode) {
|
|
10
|
+
if (ast.prefix)
|
|
11
|
+
ast.prefix.parent = ast;
|
|
12
|
+
if ((_a = ast.quote) == null ? void 0 : _a.left)
|
|
13
|
+
ast.quote.left.parent = ast;
|
|
14
|
+
if ((_b = ast.quote) == null ? void 0 : _b.right)
|
|
15
|
+
ast.quote.right.parent = ast;
|
|
16
|
+
if ((_c = ast.quote) == null ? void 0 : _c.flags)
|
|
17
|
+
ast.quote.flags.parent = ast;
|
|
18
|
+
ast.value.parent = ast;
|
|
19
|
+
} else if (ast instanceof ConditionNode) {
|
|
20
|
+
if (ast.operator)
|
|
21
|
+
ast.operator.parent = ast;
|
|
22
|
+
if (ast.property) {
|
|
23
|
+
ast.property.parent = ast;
|
|
24
|
+
if (ast.property instanceof Node)
|
|
25
|
+
assignParents(ast.property);
|
|
26
|
+
}
|
|
27
|
+
if (ast.propertyOperator)
|
|
28
|
+
ast.propertyOperator.parent = ast;
|
|
29
|
+
if ((_d = ast.sep) == null ? void 0 : _d.left)
|
|
30
|
+
ast.sep.left.parent = ast;
|
|
31
|
+
if ((_e = ast.sep) == null ? void 0 : _e.right)
|
|
32
|
+
ast.sep.right.parent = ast;
|
|
33
|
+
ast.value.parent = ast;
|
|
34
|
+
if (ast.value instanceof Node)
|
|
35
|
+
assignParents(ast.value);
|
|
36
|
+
} else if (ast instanceof ExpressionNode) {
|
|
37
|
+
if (ast.operator)
|
|
38
|
+
ast.operator.parent = ast;
|
|
39
|
+
ast.right.parent = ast;
|
|
40
|
+
if (ast.right instanceof Node)
|
|
41
|
+
assignParents(ast.right);
|
|
42
|
+
ast.left.parent = ast;
|
|
43
|
+
if (ast.left instanceof Node)
|
|
44
|
+
assignParents(ast.left);
|
|
45
|
+
} else if (ast instanceof GroupNode) {
|
|
46
|
+
if (ast.prefix) {
|
|
47
|
+
ast.prefix.parent = ast;
|
|
48
|
+
if (ast.prefix instanceof Node)
|
|
49
|
+
assignParents(ast.prefix);
|
|
50
|
+
}
|
|
51
|
+
if ((_f = ast.paren) == null ? void 0 : _f.left)
|
|
52
|
+
ast.paren.left.parent = ast;
|
|
53
|
+
if ((_g = ast.paren) == null ? void 0 : _g.right)
|
|
54
|
+
ast.paren.right.parent = ast;
|
|
55
|
+
ast.expression.parent = ast;
|
|
56
|
+
if (ast.expression instanceof Node)
|
|
57
|
+
assignParents(ast.expression);
|
|
58
|
+
} else if (ast instanceof ArrayNode) {
|
|
59
|
+
if (ast.bracket.left)
|
|
60
|
+
ast.bracket.left.parent = ast;
|
|
61
|
+
if (ast.bracket.right)
|
|
62
|
+
ast.bracket.right.parent = ast;
|
|
63
|
+
for (const val of ast.values) {
|
|
64
|
+
val.parent = ast;
|
|
65
|
+
assignParents(val);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
assignParents
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkParserOpts.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/checkParserOpts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,uBAAuB,CAAA;AAM7E,wBAAgB,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,eAAe,GAAE,OAAe,EAAE,eAAe,GAAE,OAAe,GAAG,IAAI,CAoIlJ"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { pushIfNotIn, isBlank } from "@alanscodelog/utils";
|
|
2
|
+
import { ERROR_CODES } from "../../types/errors.js";
|
|
3
|
+
import { BooleanParserLibraryError } from "../errors.js";
|
|
4
|
+
import { defaultConditionNormalizer } from "../general/defaultConditionNormalizer.js";
|
|
5
|
+
import { defaultValueComparer } from "../general/defaultValueComparer.js";
|
|
6
|
+
function checkParserOpts(opts, evaluatorChecks = false, validatorChecks = false) {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
8
|
+
if (!evaluatorChecks) {
|
|
9
|
+
const keywordsList = [...opts.keywords.and, ...opts.keywords.or, ...opts.keywords.not].map((keyword) => keyword.value);
|
|
10
|
+
const symNots = opts.keywords.not.filter((op) => op.isSymbol).map((op) => op.value);
|
|
11
|
+
const keywords = [
|
|
12
|
+
...[...keywordsList].filter((val) => !symNots.includes(val)),
|
|
13
|
+
...["(", ")"],
|
|
14
|
+
...opts.arrayValues ? ["[", "]"] : [],
|
|
15
|
+
...opts.regexValues ? ["/"] : []
|
|
16
|
+
];
|
|
17
|
+
const extra = [];
|
|
18
|
+
if (opts.expandedPropertySeparator)
|
|
19
|
+
extra.push(opts.expandedPropertySeparator);
|
|
20
|
+
if (opts.customPropertyOperators)
|
|
21
|
+
pushIfNotIn(extra, ...opts.customPropertyOperators);
|
|
22
|
+
if (opts.expandedPropertySeparator && isBlank(opts.expandedPropertySeparator)) {
|
|
23
|
+
throw new BooleanParserLibraryError(
|
|
24
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
25
|
+
{ prohibited: [""], invalid: opts.expandedPropertySeparator },
|
|
26
|
+
`expandedPropertySeparator cannot be blank`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const customInvalid = (_a = opts.customPropertyOperators) == null ? void 0 : _a.find((_) => isBlank(_));
|
|
30
|
+
if (customInvalid !== void 0) {
|
|
31
|
+
throw new BooleanParserLibraryError(
|
|
32
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
33
|
+
{ prohibited: [""], invalid: customInvalid },
|
|
34
|
+
`customPropertyOperators cannot contain blank entries`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const prefixInvalid = (_b = opts.prefixableStrings) == null ? void 0 : _b.find((_) => isBlank(_));
|
|
38
|
+
if (prefixInvalid !== void 0) {
|
|
39
|
+
throw new BooleanParserLibraryError(
|
|
40
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
41
|
+
{ prohibited: [""], invalid: prefixInvalid },
|
|
42
|
+
`prefixableStrings cannot contain blank entries`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
for (const key of ["and", "or", "not"]) {
|
|
46
|
+
const invalid = (_d = (_c = opts.keywords[key]) == null ? void 0 : _c.find((_) => isBlank(_.value))) == null ? void 0 : _d.value;
|
|
47
|
+
if (invalid !== void 0) {
|
|
48
|
+
throw new BooleanParserLibraryError(
|
|
49
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
50
|
+
{ prohibited: [""], invalid },
|
|
51
|
+
`keywords.${key} cannot contain entries with blank values`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const all = [...keywords, ...symNots, ...extra];
|
|
56
|
+
const allKeywords = [...keywords, ...symNots];
|
|
57
|
+
const messageInvalidAny = "cannot contain operators or special symbols, but found";
|
|
58
|
+
const messageInvalidBool = "cannot contain boolean operators or special symbols, but found";
|
|
59
|
+
const invalidPrefixableString = (_e = opts.prefixableStrings) == null ? void 0 : _e.find((val) => all.includes(val));
|
|
60
|
+
if (invalidPrefixableString) {
|
|
61
|
+
throw new BooleanParserLibraryError(
|
|
62
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
63
|
+
{ prohibited: all, invalid: invalidPrefixableString },
|
|
64
|
+
`prefixableStrings ${messageInvalidAny} "${invalidPrefixableString}"`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const invalidExpandedPropertySeparator = allKeywords.find((_) => _ === opts.expandedPropertySeparator);
|
|
68
|
+
if (invalidExpandedPropertySeparator) {
|
|
69
|
+
throw new BooleanParserLibraryError(
|
|
70
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
71
|
+
{ prohibited: allKeywords, invalid: invalidExpandedPropertySeparator },
|
|
72
|
+
`expandedPropertySeparator ${messageInvalidBool} "${invalidExpandedPropertySeparator}"`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const invalidCustomPropertyOperator = ((_f = opts.customPropertyOperators) == null ? void 0 : _f.find((val) => keywords.includes(val))) ? opts.expandedPropertySeparator : void 0;
|
|
76
|
+
if (invalidCustomPropertyOperator) {
|
|
77
|
+
throw new BooleanParserLibraryError(
|
|
78
|
+
ERROR_CODES.PARSER_CONFLICTING_OPTIONS_ERROR,
|
|
79
|
+
{ prohibited: keywords, invalid: invalidCustomPropertyOperator },
|
|
80
|
+
`customPropertyOperator ${messageInvalidBool} "${invalidCustomPropertyOperator}"`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (evaluatorChecks) {
|
|
85
|
+
const requireCustomNormalizer = [];
|
|
86
|
+
if ((((_g = opts.prefixableStrings) == null ? void 0 : _g.length) ?? 0) > 0)
|
|
87
|
+
requireCustomNormalizer.push("prefixableStrings");
|
|
88
|
+
if ((((_h = opts.customPropertyOperators) == null ? void 0 : _h.length) ?? 0) > 0)
|
|
89
|
+
requireCustomNormalizer.push("customPropertyOperators");
|
|
90
|
+
if ((((_i = opts.expandedPropertySeparator) == null ? void 0 : _i.length) ?? 0) > 0)
|
|
91
|
+
requireCustomNormalizer.push("expandedPropertySeparator");
|
|
92
|
+
if (opts.regexValues)
|
|
93
|
+
requireCustomNormalizer.push("regexValues");
|
|
94
|
+
if (requireCustomNormalizer.length > 0 && opts.conditionNormalizer === defaultConditionNormalizer) {
|
|
95
|
+
throw new BooleanParserLibraryError(
|
|
96
|
+
ERROR_CODES.PARSER_OPTION_REQUIRED_ERROR,
|
|
97
|
+
{ options: requireCustomNormalizer, requires: "conditionNormalizer" },
|
|
98
|
+
`A custom conditionNormalizer function must be specified when using the following options: ${requireCustomNormalizer.join(", ")}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
const requireCustomComparer = [];
|
|
102
|
+
if (opts.regexValues)
|
|
103
|
+
requireCustomComparer.push("regexValues");
|
|
104
|
+
if (opts.regexValues)
|
|
105
|
+
requireCustomComparer.push("arrayValues");
|
|
106
|
+
if (requireCustomComparer.length > 0 && opts.valueComparer === defaultValueComparer) {
|
|
107
|
+
throw new BooleanParserLibraryError(
|
|
108
|
+
ERROR_CODES.PARSER_OPTION_REQUIRED_ERROR,
|
|
109
|
+
{ options: requireCustomComparer, requires: "valueComparer" },
|
|
110
|
+
`A custom valueComparer function must be specified when using the following options: ${requireCustomComparer.join(", ")}`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (validatorChecks) {
|
|
115
|
+
if (opts.valueValidator === void 0) {
|
|
116
|
+
throw new BooleanParserLibraryError(
|
|
117
|
+
ERROR_CODES.PARSER_OPTION_REQUIRED_ERROR,
|
|
118
|
+
{ requires: "valueValidator" },
|
|
119
|
+
`A custom valueValidator function must be specified when using the validate method.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
checkParserOpts
|
|
126
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Position } from "../../types/ast.js";
|
|
2
|
+
type ChevrotainLocation = {
|
|
3
|
+
startOffset?: number;
|
|
4
|
+
endOffset?: number;
|
|
5
|
+
};
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function extractPosition(loc: ChevrotainLocation, shift: number): Position;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=extractPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractPosition.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/extractPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGlD,KAAK,kBAAkB,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,gBAAgB;AAChB,wBAAgB,eAAe,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAKhF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IToken } from "chevrotain";
|
|
2
|
+
import type { createTokens } from "../../grammar/createTokens.js";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function getUnclosedRightParenCount(tokens: IToken[], t: ReturnType<typeof createTokens>["tokens"]): number;
|
|
5
|
+
//# sourceMappingURL=getUnclosedRightParenCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUnclosedRightParenCount.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/getUnclosedRightParenCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,YAAY,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,gBAAgB;AAChB,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAejH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { tokenMatcher } from "chevrotain";
|
|
2
|
+
function getUnclosedRightParenCount(tokens, t) {
|
|
3
|
+
let open = 0;
|
|
4
|
+
let unclosed = 0;
|
|
5
|
+
for (const token of tokens) {
|
|
6
|
+
if (tokenMatcher(token, t.PAREN_R)) {
|
|
7
|
+
if (open > 0) {
|
|
8
|
+
open--;
|
|
9
|
+
} else {
|
|
10
|
+
unclosed++;
|
|
11
|
+
}
|
|
12
|
+
} else if (tokenMatcher(token, t.PAREN_L)) {
|
|
13
|
+
open++;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return unclosed;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
getUnclosedRightParenCount
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { assignParents } from "./assignParents.js";
|
|
2
|
+
export { checkParserOpts } from "./checkParserOpts.js";
|
|
3
|
+
export { extractPosition } from "./extractPosition.js";
|
|
4
|
+
export { getUnclosedRightParenCount } from "./getUnclosedRightParenCount.js";
|
|
5
|
+
export { parseParserOptions } from "./parseParserOptions.js";
|
|
6
|
+
export { seal } from "./seal.js";
|
|
7
|
+
export { setParent } from "./setParent.js";
|
|
8
|
+
export { unescape } from "./unescape.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { assignParents } from "./assignParents.js";
|
|
2
|
+
import { checkParserOpts } from "./checkParserOpts.js";
|
|
3
|
+
import { extractPosition } from "./extractPosition.js";
|
|
4
|
+
import { getUnclosedRightParenCount } from "./getUnclosedRightParenCount.js";
|
|
5
|
+
import { parseParserOptions } from "./parseParserOptions.js";
|
|
6
|
+
import { seal } from "./seal.js";
|
|
7
|
+
import { setParent } from "./setParent.js";
|
|
8
|
+
import { unescape } from "./unescape.js";
|
|
9
|
+
export {
|
|
10
|
+
assignParents,
|
|
11
|
+
checkParserOpts,
|
|
12
|
+
extractPosition,
|
|
13
|
+
getUnclosedRightParenCount,
|
|
14
|
+
parseParserOptions,
|
|
15
|
+
seal,
|
|
16
|
+
setParent,
|
|
17
|
+
unescape
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseParserOptions.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/parseParserOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM7E,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,EACnD,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GACvB,iBAAiB,CAAC,CAAC,CAAC,CA4CtB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defaultConditionNormalizer } from "../general/defaultConditionNormalizer.js";
|
|
2
|
+
import { defaultKeyParser } from "../general/defaultKeyParser.js";
|
|
3
|
+
import { defaultPrefixApplier } from "../general/defaultPrefixApplier.js";
|
|
4
|
+
import { defaultValueComparer } from "../general/defaultValueComparer.js";
|
|
5
|
+
function parseParserOptions(options) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const opts = {
|
|
8
|
+
prefixApplier: defaultPrefixApplier,
|
|
9
|
+
keyParser: defaultKeyParser,
|
|
10
|
+
valueComparer: defaultValueComparer,
|
|
11
|
+
conditionNormalizer: defaultConditionNormalizer,
|
|
12
|
+
prefixableGroups: true,
|
|
13
|
+
prefixableStrings: void 0,
|
|
14
|
+
expandedPropertySeparator: void 0,
|
|
15
|
+
customPropertyOperators: void 0,
|
|
16
|
+
onMissingBooleanOperator: "error",
|
|
17
|
+
arrayValues: true,
|
|
18
|
+
regexValues: true,
|
|
19
|
+
...options,
|
|
20
|
+
// todo fix
|
|
21
|
+
keywords: {
|
|
22
|
+
or: ((_a = options.keywords) == null ? void 0 : _a.or) ? options.keywords.or : [
|
|
23
|
+
{ value: "||", isSymbol: true },
|
|
24
|
+
{ value: "|", isSymbol: true },
|
|
25
|
+
{ value: "or", isSymbol: false },
|
|
26
|
+
{ value: "OR", isSymbol: false }
|
|
27
|
+
],
|
|
28
|
+
and: ((_b = options.keywords) == null ? void 0 : _b.and) ? options.keywords.and : [
|
|
29
|
+
{ value: "&&", isSymbol: true },
|
|
30
|
+
{ value: "&", isSymbol: true },
|
|
31
|
+
{ value: "and", isSymbol: false },
|
|
32
|
+
{ value: "AND", isSymbol: false }
|
|
33
|
+
],
|
|
34
|
+
not: ((_c = options.keywords) == null ? void 0 : _c.not) ? options.keywords.not : [
|
|
35
|
+
{ value: "!", isSymbol: true },
|
|
36
|
+
{ value: "not", isSymbol: false },
|
|
37
|
+
{ value: "NOT", isSymbol: false }
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return opts;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
parseParserOptions
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../../../src/helpers/parser/seal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEzD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,CAGhD"}
|