@witchcraft/expressit 0.1.2 → 0.2.0
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 +9 -5
- package/dist/Lexer.js +2 -2
- package/dist/Parser.d.ts +14 -29
- package/dist/Parser.d.ts.map +1 -1
- package/dist/Parser.js +120 -135
- package/dist/ast/builders/array.d.ts +1 -3
- package/dist/ast/builders/array.d.ts.map +1 -1
- package/dist/ast/builders/array.js +3 -5
- package/dist/ast/builders/condition.d.ts +5 -11
- package/dist/ast/builders/condition.d.ts.map +1 -1
- package/dist/ast/builders/condition.js +2 -3
- package/dist/ast/builders/delim.d.ts +1 -1
- package/dist/ast/builders/error.d.ts +3 -4
- package/dist/ast/builders/error.d.ts.map +1 -1
- package/dist/ast/builders/error.js +6 -2
- package/dist/ast/builders/expression.d.ts +3 -7
- package/dist/ast/builders/expression.d.ts.map +1 -1
- package/dist/ast/builders/expression.js +3 -5
- package/dist/ast/builders/group.d.ts +3 -8
- package/dist/ast/builders/group.d.ts.map +1 -1
- package/dist/ast/builders/group.js +3 -3
- package/dist/ast/builders/pos.d.ts +1 -2
- package/dist/ast/builders/pos.d.ts.map +1 -1
- package/dist/ast/builders/token.d.ts +3 -5
- package/dist/ast/builders/token.d.ts.map +1 -1
- package/dist/ast/builders/token.js +3 -4
- package/dist/ast/builders/type.d.ts +1 -1
- package/dist/ast/builders/variable.d.ts +3 -5
- package/dist/ast/builders/variable.d.ts.map +1 -1
- package/dist/ast/builders/variable.js +2 -3
- package/dist/ast/createArrayNode.d.ts +3 -0
- package/dist/ast/createArrayNode.d.ts.map +1 -0
- package/dist/ast/createArrayNode.js +12 -0
- package/dist/ast/createConditionNode.d.ts +11 -0
- package/dist/ast/createConditionNode.d.ts.map +1 -0
- package/dist/ast/createConditionNode.js +18 -0
- package/dist/ast/createExpressionNode.d.ts +3 -0
- package/dist/ast/createExpressionNode.d.ts.map +1 -0
- package/dist/ast/createExpressionNode.js +14 -0
- package/dist/ast/createGroupNode.d.ts +5 -0
- package/dist/ast/createGroupNode.d.ts.map +1 -0
- package/dist/ast/createGroupNode.js +14 -0
- package/dist/ast/createNormalizedCondition.d.ts +3 -0
- package/dist/ast/createNormalizedCondition.d.ts.map +1 -0
- package/dist/ast/createNormalizedCondition.js +10 -0
- package/dist/ast/createNormalizedExpression.d.ts +3 -0
- package/dist/ast/createNormalizedExpression.d.ts.map +1 -0
- package/dist/ast/createNormalizedExpression.js +10 -0
- package/dist/ast/createToken.d.ts +6 -0
- package/dist/ast/createToken.d.ts.map +1 -0
- package/dist/ast/createToken.js +15 -0
- package/dist/ast/createVariableNode.d.ts +3 -0
- package/dist/ast/createVariableNode.d.ts.map +1 -0
- package/dist/ast/createVariableNode.js +12 -0
- package/dist/ast/error.d.ts +3 -0
- package/dist/ast/error.d.ts.map +1 -0
- package/dist/ast/error.js +9 -0
- package/dist/ast/handlers.d.ts +5 -12
- package/dist/ast/handlers.d.ts.map +1 -1
- package/dist/ast/handlers.js +21 -29
- package/dist/ast/index.d.ts +9 -1
- package/dist/ast/index.d.ts.map +1 -1
- package/dist/ast/index.js +18 -2
- package/dist/defaults/defaultConditionNormalizer.d.ts +3 -0
- package/dist/defaults/defaultConditionNormalizer.d.ts.map +1 -0
- package/dist/defaults/defaultKeyParser.d.ts +3 -0
- package/dist/defaults/defaultKeyParser.d.ts.map +1 -0
- package/dist/defaults/defaultPrefixApplier.d.ts +3 -0
- package/dist/defaults/defaultPrefixApplier.d.ts.map +1 -0
- package/dist/defaults/defaultValueComparer.d.ts +3 -0
- package/dist/defaults/defaultValueComparer.d.ts.map +1 -0
- package/dist/{helpers/general → defaults}/index.d.ts +0 -2
- package/dist/defaults/index.d.ts.map +1 -0
- package/dist/{helpers/general → defaults}/index.js +0 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/{helpers/errors.d.ts → internal/ExpressitError.d.ts} +3 -2
- package/dist/internal/ExpressitError.d.ts.map +1 -0
- package/dist/{helpers/errors.js → internal/ExpressitError.js} +2 -2
- package/dist/internal/applyBoolean.d.ts.map +1 -0
- package/dist/{helpers/general → internal}/applyPrefix.d.ts +1 -1
- package/dist/internal/applyPrefix.d.ts.map +1 -0
- package/dist/{helpers/parser → internal}/checkParserOpts.d.ts +2 -1
- package/dist/internal/checkParserOpts.d.ts.map +1 -0
- package/dist/{helpers/parser → internal}/checkParserOpts.js +14 -14
- package/dist/internal/escapeVariableOrPrefix.d.ts +2 -0
- package/dist/internal/escapeVariableOrPrefix.d.ts.map +1 -0
- package/dist/internal/escapeVariableOrPrefix.js +38 -0
- package/dist/internal/extractPosition.d.ts +5 -0
- package/dist/internal/extractPosition.d.ts.map +1 -0
- package/dist/internal/getUnclosedRightParenCount.d.ts +4 -0
- package/dist/internal/getUnclosedRightParenCount.d.ts.map +1 -0
- package/dist/{helpers/parser → internal}/getUnclosedRightParenCount.js +1 -1
- package/dist/{helpers/parser → internal}/parseParserOptions.d.ts +1 -1
- package/dist/internal/parseParserOptions.d.ts.map +1 -0
- package/dist/{helpers/parser → internal}/parseParserOptions.js +4 -4
- package/dist/internal/unescape.d.ts.map +1 -0
- package/dist/package.json.js +7 -7
- package/dist/types/ast.d.ts +195 -6
- package/dist/types/ast.d.ts.map +1 -1
- package/dist/types/ast.js +2 -0
- package/dist/types/autocomplete.d.ts +5 -6
- package/dist/types/autocomplete.d.ts.map +1 -1
- package/dist/types/parser.d.ts +17 -22
- package/dist/types/parser.d.ts.map +1 -1
- package/dist/utils/extractTokens.d.ts +2 -4
- package/dist/utils/extractTokens.d.ts.map +1 -1
- package/dist/utils/extractTokens.js +14 -18
- package/dist/utils/generateParentsMap.d.ts +10 -0
- package/dist/utils/generateParentsMap.d.ts.map +1 -0
- package/dist/utils/generateParentsMap.js +73 -0
- package/dist/utils/getCursorInfo.d.ts +1 -1
- package/dist/utils/getCursorInfo.d.ts.map +1 -1
- package/dist/utils/getCursorInfo.js +3 -5
- package/dist/utils/getOppositeDelimiter.d.ts +2 -1
- package/dist/utils/getOppositeDelimiter.d.ts.map +1 -1
- package/dist/utils/getOppositeDelimiter.js +6 -5
- package/dist/utils/getParent.d.ts +5 -0
- package/dist/utils/getParent.d.ts.map +1 -0
- package/dist/utils/getParent.js +6 -0
- package/dist/utils/getSurroundingErrors.d.ts +3 -4
- package/dist/utils/getSurroundingErrors.d.ts.map +1 -1
- package/dist/utils/getSurroundingErrors.js +3 -3
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +8 -0
- package/dist/utils/isNode.d.ts +10 -0
- package/dist/utils/isNode.d.ts.map +1 -0
- package/dist/utils/isNode.js +6 -0
- package/dist/utils/isToken.d.ts +8 -0
- package/dist/utils/isToken.d.ts.map +1 -0
- package/dist/utils/isToken.js +6 -0
- package/dist/utils/prettyAst.d.ts +1 -2
- package/dist/utils/prettyAst.d.ts.map +1 -1
- package/dist/utils/prettyAst.js +19 -26
- package/package.json +7 -7
- package/src/Lexer.ts +2 -2
- package/src/Parser.ts +158 -165
- package/src/ast/builders/array.ts +4 -9
- package/src/ast/builders/condition.ts +10 -15
- package/src/ast/builders/delim.ts +1 -1
- package/src/ast/builders/error.ts +10 -6
- package/src/ast/builders/expression.ts +17 -23
- package/src/ast/builders/group.ts +7 -11
- package/src/ast/builders/pos.ts +2 -3
- package/src/ast/builders/token.ts +6 -7
- package/src/ast/builders/type.ts +1 -1
- package/src/ast/builders/variable.ts +6 -8
- package/src/ast/createArrayNode.ts +17 -0
- package/src/ast/createConditionNode.ts +58 -0
- package/src/ast/createExpressionNode.ts +21 -0
- package/src/ast/createGroupNode.ts +46 -0
- package/src/ast/createNormalizedCondition.ts +12 -0
- package/src/ast/createNormalizedExpression.ts +9 -0
- package/src/ast/createToken.ts +26 -0
- package/src/ast/createVariableNode.ts +18 -0
- package/src/ast/error.ts +9 -0
- package/src/ast/handlers.ts +26 -37
- package/src/ast/index.ts +9 -1
- package/src/{helpers/general → defaults}/defaultConditionNormalizer.ts +1 -1
- package/src/{helpers/general → defaults}/defaultKeyParser.ts +1 -1
- package/src/{helpers/general → defaults}/defaultPrefixApplier.ts +1 -1
- package/src/{helpers/general → defaults}/defaultValueComparer.ts +1 -1
- package/src/{helpers/general → defaults}/index.ts +0 -2
- package/src/index.ts +2 -1
- package/src/{helpers/errors.ts → internal/ExpressitError.ts} +2 -2
- package/src/{helpers/general → internal}/applyPrefix.ts +1 -1
- package/src/{helpers/parser → internal}/checkParserOpts.ts +16 -15
- package/src/internal/escapeVariableOrPrefix.ts +36 -0
- package/src/{helpers/parser → internal}/extractPosition.ts +2 -2
- package/src/{helpers/parser → internal}/getUnclosedRightParenCount.ts +1 -2
- package/src/{helpers/parser → internal}/parseParserOptions.ts +5 -5
- package/src/types/ast.ts +292 -7
- package/src/types/autocomplete.ts +5 -7
- package/src/types/parser.ts +17 -22
- package/src/utils/extractTokens.ts +16 -20
- package/src/utils/generateParentsMap.ts +60 -0
- package/src/utils/getCursorInfo.ts +4 -6
- package/src/utils/getOppositeDelimiter.ts +11 -10
- package/src/utils/getParent.ts +16 -0
- package/src/utils/getSurroundingErrors.ts +10 -9
- package/src/utils/index.ts +4 -0
- package/src/utils/isNode.ts +12 -0
- package/src/utils/isToken.ts +10 -0
- package/src/utils/prettyAst.ts +20 -17
- package/dist/ast/classes/ArrayNode.d.ts +0 -18
- package/dist/ast/classes/ArrayNode.d.ts.map +0 -1
- package/dist/ast/classes/ArrayNode.js +0 -55
- package/dist/ast/classes/Condition.d.ts +0 -13
- package/dist/ast/classes/Condition.d.ts.map +0 -1
- package/dist/ast/classes/Condition.js +0 -21
- package/dist/ast/classes/ConditionNode.d.ts +0 -73
- package/dist/ast/classes/ConditionNode.d.ts.map +0 -1
- package/dist/ast/classes/ConditionNode.js +0 -101
- package/dist/ast/classes/ErrorToken.d.ts +0 -27
- package/dist/ast/classes/ErrorToken.d.ts.map +0 -1
- package/dist/ast/classes/ErrorToken.js +0 -47
- package/dist/ast/classes/Expression.d.ts +0 -13
- package/dist/ast/classes/Expression.d.ts.map +0 -1
- package/dist/ast/classes/Expression.js +0 -19
- package/dist/ast/classes/ExpressionNode.d.ts +0 -21
- package/dist/ast/classes/ExpressionNode.d.ts.map +0 -1
- package/dist/ast/classes/ExpressionNode.js +0 -57
- package/dist/ast/classes/GroupNode.d.ts +0 -64
- package/dist/ast/classes/GroupNode.d.ts.map +0 -1
- package/dist/ast/classes/GroupNode.js +0 -69
- package/dist/ast/classes/Node.d.ts +0 -22
- package/dist/ast/classes/Node.d.ts.map +0 -1
- package/dist/ast/classes/Node.js +0 -28
- package/dist/ast/classes/Token.d.ts +0 -27
- package/dist/ast/classes/Token.d.ts.map +0 -1
- package/dist/ast/classes/Token.js +0 -28
- package/dist/ast/classes/ValidToken.d.ts +0 -26
- package/dist/ast/classes/ValidToken.d.ts.map +0 -1
- package/dist/ast/classes/ValidToken.js +0 -49
- package/dist/ast/classes/VariableNode.d.ts +0 -33
- package/dist/ast/classes/VariableNode.d.ts.map +0 -1
- package/dist/ast/classes/VariableNode.js +0 -58
- package/dist/ast/classes/index.d.ts +0 -12
- package/dist/ast/classes/index.d.ts.map +0 -1
- package/dist/ast/classes/index.js +0 -24
- package/dist/helpers/errors.d.ts.map +0 -1
- package/dist/helpers/general/applyBoolean.d.ts.map +0 -1
- package/dist/helpers/general/applyPrefix.d.ts.map +0 -1
- package/dist/helpers/general/defaultConditionNormalizer.d.ts +0 -3
- package/dist/helpers/general/defaultConditionNormalizer.d.ts.map +0 -1
- package/dist/helpers/general/defaultKeyParser.d.ts +0 -3
- package/dist/helpers/general/defaultKeyParser.d.ts.map +0 -1
- package/dist/helpers/general/defaultPrefixApplier.d.ts +0 -3
- package/dist/helpers/general/defaultPrefixApplier.d.ts.map +0 -1
- package/dist/helpers/general/defaultValueComparer.d.ts +0 -3
- package/dist/helpers/general/defaultValueComparer.d.ts.map +0 -1
- package/dist/helpers/general/index.d.ts.map +0 -1
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/index.js +0 -8
- package/dist/helpers/parser/assignParents.d.ts +0 -4
- package/dist/helpers/parser/assignParents.d.ts.map +0 -1
- package/dist/helpers/parser/assignParents.js +0 -71
- package/dist/helpers/parser/checkParserOpts.d.ts.map +0 -1
- package/dist/helpers/parser/extractPosition.d.ts +0 -5
- package/dist/helpers/parser/extractPosition.d.ts.map +0 -1
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts +0 -4
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts.map +0 -1
- package/dist/helpers/parser/index.d.ts +0 -9
- package/dist/helpers/parser/index.d.ts.map +0 -1
- package/dist/helpers/parser/index.js +0 -18
- package/dist/helpers/parser/parseParserOptions.d.ts.map +0 -1
- package/dist/helpers/parser/seal.d.ts +0 -8
- package/dist/helpers/parser/seal.d.ts.map +0 -1
- package/dist/helpers/parser/seal.js +0 -10
- package/dist/helpers/parser/setParent.d.ts +0 -6
- package/dist/helpers/parser/setParent.d.ts.map +0 -1
- package/dist/helpers/parser/setParent.js +0 -4
- package/dist/helpers/parser/unescape.d.ts.map +0 -1
- package/src/ast/classes/ArrayNode.ts +0 -46
- package/src/ast/classes/Condition.ts +0 -22
- package/src/ast/classes/ConditionNode.ts +0 -141
- package/src/ast/classes/ErrorToken.ts +0 -49
- package/src/ast/classes/Expression.ts +0 -26
- package/src/ast/classes/ExpressionNode.ts +0 -62
- package/src/ast/classes/GroupNode.ts +0 -127
- package/src/ast/classes/Node.ts +0 -47
- package/src/ast/classes/Token.ts +0 -59
- package/src/ast/classes/ValidToken.ts +0 -56
- package/src/ast/classes/VariableNode.ts +0 -67
- package/src/ast/classes/index.ts +0 -13
- package/src/helpers/index.ts +0 -6
- package/src/helpers/parser/assignParents.ts +0 -51
- package/src/helpers/parser/index.ts +0 -10
- package/src/helpers/parser/seal.ts +0 -14
- package/src/helpers/parser/setParent.ts +0 -5
- /package/dist/{helpers/general → defaults}/defaultConditionNormalizer.js +0 -0
- /package/dist/{helpers/general → defaults}/defaultKeyParser.js +0 -0
- /package/dist/{helpers/general → defaults}/defaultPrefixApplier.js +0 -0
- /package/dist/{helpers/general → defaults}/defaultValueComparer.js +0 -0
- /package/dist/{helpers/general → internal}/applyBoolean.d.ts +0 -0
- /package/dist/{helpers/general → internal}/applyBoolean.js +0 -0
- /package/dist/{helpers/general → internal}/applyPrefix.js +0 -0
- /package/dist/{helpers/parser → internal}/extractPosition.js +0 -0
- /package/dist/{helpers/parser → internal}/unescape.d.ts +0 -0
- /package/dist/{helpers/parser → internal}/unescape.js +0 -0
- /package/src/{helpers/general → internal}/applyBoolean.ts +0 -0
- /package/src/{helpers/parser → internal}/unescape.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCursorInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getCursorInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCursorInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getCursorInfo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1D;;GAEG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,aAAa,GAAG,QAAQ,EAAE,EAC/B,KAAK,EAAE,MAAM,GACX,UAAU,CAoDZ"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { isArray } from "@alanscodelog/utils/isArray.js";
|
|
2
2
|
import { unreachable } from "@alanscodelog/utils/unreachable.js";
|
|
3
3
|
import { extractTokens } from "./extractTokens.js";
|
|
4
|
-
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
5
|
-
import { ValidToken } from "../ast/classes/ValidToken.js";
|
|
6
4
|
function getCursorInfo(input, ast, index) {
|
|
7
5
|
const tokens = isArray(ast) ? ast : extractTokens(ast);
|
|
8
6
|
if (input.length < index || index < 0) {
|
|
@@ -24,7 +22,7 @@ function getCursorInfo(input, ast, index) {
|
|
|
24
22
|
};
|
|
25
23
|
for (const token of tokens) {
|
|
26
24
|
if (token.end <= index) {
|
|
27
|
-
if (token
|
|
25
|
+
if (token.valid) {
|
|
28
26
|
info.prev = token;
|
|
29
27
|
info.valid.prev = token;
|
|
30
28
|
} else if (token.end !== index) {
|
|
@@ -32,7 +30,7 @@ function getCursorInfo(input, ast, index) {
|
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
if (token.start < index && token.end > index) {
|
|
35
|
-
if (token
|
|
33
|
+
if (!token.valid) {
|
|
36
34
|
unreachable();
|
|
37
35
|
} else {
|
|
38
36
|
info.at = token;
|
|
@@ -40,7 +38,7 @@ function getCursorInfo(input, ast, index) {
|
|
|
40
38
|
}
|
|
41
39
|
if (token.start >= index) {
|
|
42
40
|
info.next || (info.next = token);
|
|
43
|
-
if (token
|
|
41
|
+
if (token.valid && !info.valid.next) {
|
|
44
42
|
info.valid.next = token;
|
|
45
43
|
break;
|
|
46
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { generateParentsMap } from "./generateParentsMap.js";
|
|
1
2
|
import { type AnyToken, type TokenDelimiterTypes } from "../types/ast.js";
|
|
2
3
|
/**
|
|
3
4
|
* Given a delimiter token, returns it's opposite pair, or undefined if the type passed was not a delimiter token (so you can pass any type without checking).
|
|
4
5
|
*/
|
|
5
|
-
export declare function getOppositeDelimiter(token: AnyToken): AnyToken<TokenDelimiterTypes> | undefined;
|
|
6
|
+
export declare function getOppositeDelimiter(token: AnyToken, parentsMap: ReturnType<typeof generateParentsMap>): AnyToken<TokenDelimiterTypes> | undefined;
|
|
6
7
|
//# sourceMappingURL=getOppositeDelimiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOppositeDelimiter.d.ts","sourceRoot":"","sources":["../../src/utils/getOppositeDelimiter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getOppositeDelimiter.d.ts","sourceRoot":"","sources":["../../src/utils/getOppositeDelimiter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,OAAO,EAAE,KAAK,QAAQ,EAAiE,KAAK,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAE3J;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAC/C,QAAQ,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAuB3C"}
|
|
@@ -4,25 +4,26 @@ import { isDelimiter } from "./isDelimiter.js";
|
|
|
4
4
|
import { isParen } from "./isParen.js";
|
|
5
5
|
import { isQuote } from "./isQuote.js";
|
|
6
6
|
import { TOKEN_TYPE } from "../types/ast.js";
|
|
7
|
-
function getOppositeDelimiter(token) {
|
|
7
|
+
function getOppositeDelimiter(token, parentsMap) {
|
|
8
|
+
const parent = parentsMap.get(token);
|
|
8
9
|
if (!isDelimiter(token))
|
|
9
10
|
throw new Error("Token is not a delimiter type.");
|
|
10
11
|
if (isParen(token)) {
|
|
11
|
-
const paren =
|
|
12
|
+
const paren = parent.paren;
|
|
12
13
|
const opposite = paren.left === token ? "right" : "left";
|
|
13
14
|
return paren[opposite];
|
|
14
15
|
} else if (isBracket(token)) {
|
|
15
|
-
const bracket =
|
|
16
|
+
const bracket = parent.bracket;
|
|
16
17
|
const opposite = bracket.left === token ? "right" : "left";
|
|
17
18
|
return bracket[opposite];
|
|
18
19
|
} else if (isQuote(token)) {
|
|
19
|
-
const quotes =
|
|
20
|
+
const quotes = parent.quote;
|
|
20
21
|
if (quotes === void 0)
|
|
21
22
|
unreachable();
|
|
22
23
|
const opposite = quotes.left === token ? "right" : "left";
|
|
23
24
|
return quotes[opposite];
|
|
24
25
|
} else if (token.type === TOKEN_TYPE.OP_EXPANDED_SEP) {
|
|
25
|
-
const sep =
|
|
26
|
+
const sep = parent.sep;
|
|
26
27
|
if (sep === void 0)
|
|
27
28
|
unreachable();
|
|
28
29
|
const opposite = sep.left === token ? "right" : "left";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { generateParentsMap } from "./generateParentsMap.js";
|
|
2
|
+
import type { AnyToken, ArrayNode, ConditionNode, ExpressionNode, GroupNode, ParentTypes, VariableNode } from "../types/ast.js";
|
|
3
|
+
/** See {@link generateParentsMap} */
|
|
4
|
+
export declare function getParent<T extends ExpressionNode | ConditionNode | GroupNode | VariableNode | ArrayNode | AnyToken | undefined>(node: T, map: ReturnType<typeof generateParentsMap>): ParentTypes<T> | undefined;
|
|
5
|
+
//# sourceMappingURL=getParent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getParent.d.ts","sourceRoot":"","sources":["../../src/utils/getParent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAC,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9H,qCAAqC;AACrC,wBAAgB,SAAS,CACxB,CAAC,SACC,cAAc,GACd,aAAa,GACb,SAAS,GACT,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,SAAS,EACV,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAEjF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mostly for internal use by @
|
|
2
|
+
* Mostly for internal use by {@link autosuggest}.
|
|
3
3
|
*
|
|
4
4
|
* Returns all error tokens immediately before/after cursor (since there might be multiple error tokens one after the other).
|
|
5
5
|
*
|
|
6
|
-
* The errors are sorted by closeness to the given cursor (inside @
|
|
6
|
+
* The errors are sorted by closeness to the given cursor (inside {@link CursorInfo}), with quote errors having priority, then paren errors, then any other errors. They can be sorted by closeness because although two errors might follow each other, their positions might be different because of whitespace, but they can still be fixed from any cursor position between their ends.
|
|
7
7
|
*
|
|
8
8
|
* For example:
|
|
9
9
|
* ```
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
* either insertion would fix the issue for either position would fix the issue, albeit with different results
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
import { ErrorToken } from "../ast
|
|
22
|
-
import { type AnyToken } from "../types/ast.js";
|
|
21
|
+
import { type AnyToken, type ErrorToken } from "../types/ast.js";
|
|
23
22
|
import type { CursorInfo } from "../types/autocomplete.js";
|
|
24
23
|
export declare function getSurroundingErrors(tokens: AnyToken[], token: CursorInfo): ErrorToken[];
|
|
25
24
|
//# sourceMappingURL=getSurroundingErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSurroundingErrors.d.ts","sourceRoot":"","sources":["../../src/utils/getSurroundingErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getSurroundingErrors.d.ts","sourceRoot":"","sources":["../../src/utils/getSurroundingErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAC,KAAK,UAAU,EAAa,MAAM,iBAAiB,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,CAgCxF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
2
1
|
import { TOKEN_TYPE } from "../types/ast.js";
|
|
3
2
|
function getSurroundingErrors(tokens, token) {
|
|
3
|
+
var _a, _b;
|
|
4
4
|
if (token.at) {
|
|
5
5
|
return [];
|
|
6
6
|
}
|
|
@@ -8,11 +8,11 @@ function getSurroundingErrors(tokens, token) {
|
|
|
8
8
|
let iNext = tokens[i] === token.next ? i : i + 1;
|
|
9
9
|
let iPrev = tokens[i] === token.next ? i - 1 : i;
|
|
10
10
|
const errors = [];
|
|
11
|
-
while (tokens[iNext]
|
|
11
|
+
while (((_a = tokens[iNext]) == null ? void 0 : _a.valid) === false) {
|
|
12
12
|
errors.push(tokens[iNext]);
|
|
13
13
|
iNext++;
|
|
14
14
|
}
|
|
15
|
-
while (tokens[iPrev]
|
|
15
|
+
while (((_b = tokens[iPrev]) == null ? void 0 : _b.valid) === false) {
|
|
16
16
|
errors.push(tokens[iPrev]);
|
|
17
17
|
iPrev--;
|
|
18
18
|
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export { extractTokens } from "./extractTokens.js";
|
|
2
|
+
export { generateParentsMap } from "./generateParentsMap.js";
|
|
2
3
|
export { getCursorInfo } from "./getCursorInfo.js";
|
|
3
4
|
export { getOppositeDelimiter } from "./getOppositeDelimiter.js";
|
|
5
|
+
export { getParent } from "./getParent.js";
|
|
4
6
|
export { getSurroundingErrors } from "./getSurroundingErrors.js";
|
|
5
7
|
export { isBracket } from "./isBracket.js";
|
|
6
8
|
export { isDelimiter } from "./isDelimiter.js";
|
|
9
|
+
export { isNode } from "./isNode.js";
|
|
7
10
|
export { isParen } from "./isParen.js";
|
|
8
11
|
export { isQuote } from "./isQuote.js";
|
|
12
|
+
export { isToken } from "./isToken.js";
|
|
9
13
|
export { prettyAst } from "./prettyAst.js";
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { extractTokens } from "./extractTokens.js";
|
|
2
|
+
import { generateParentsMap } from "./generateParentsMap.js";
|
|
2
3
|
import { getCursorInfo } from "./getCursorInfo.js";
|
|
3
4
|
import { getOppositeDelimiter } from "./getOppositeDelimiter.js";
|
|
5
|
+
import { getParent } from "./getParent.js";
|
|
4
6
|
import { getSurroundingErrors } from "./getSurroundingErrors.js";
|
|
5
7
|
import { isBracket } from "./isBracket.js";
|
|
6
8
|
import { isDelimiter } from "./isDelimiter.js";
|
|
9
|
+
import { isNode } from "./isNode.js";
|
|
7
10
|
import { isParen } from "./isParen.js";
|
|
8
11
|
import { isQuote } from "./isQuote.js";
|
|
12
|
+
import { isToken } from "./isToken.js";
|
|
9
13
|
import { prettyAst } from "./prettyAst.js";
|
|
10
14
|
export {
|
|
11
15
|
extractTokens,
|
|
16
|
+
generateParentsMap,
|
|
12
17
|
getCursorInfo,
|
|
13
18
|
getOppositeDelimiter,
|
|
19
|
+
getParent,
|
|
14
20
|
getSurroundingErrors,
|
|
15
21
|
isBracket,
|
|
16
22
|
isDelimiter,
|
|
23
|
+
isNode,
|
|
17
24
|
isParen,
|
|
18
25
|
isQuote,
|
|
26
|
+
isToken,
|
|
19
27
|
prettyAst
|
|
20
28
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Node } from "../types/ast.js";
|
|
2
|
+
/**
|
|
3
|
+
* A simple wrapper around checking an object's `isNode` property that casts the object to a {@link Nodes} type for typescript.
|
|
4
|
+
*
|
|
5
|
+
* Does not actually do any checking of the object, and assumes the object was created using one of the `create*` functions.
|
|
6
|
+
*
|
|
7
|
+
* Also note that passing a NormalizedCondition or NormalizedExpression will return false even though they have their own {@link AST_TYPE} since they are not technically nodes (with positions).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNode(node: any): node is Node;
|
|
10
|
+
//# sourceMappingURL=isNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNode.d.ts","sourceRoot":"","sources":["../../src/utils/isNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,IAAI,CAE9C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ErrorToken, ValidToken } from "../types/ast.js";
|
|
2
|
+
/**
|
|
3
|
+
* A simple wrapper around checking an object's `isToken` property that casts the object to a {@link ValidToken} or {@link ErrorToken} for typescript.
|
|
4
|
+
*
|
|
5
|
+
* Does not actually do any checking of the object, and assumes the object was created using one of the `create*` functions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isToken(token: any): token is ValidToken | ErrorToken;
|
|
8
|
+
//# sourceMappingURL=isToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isToken.d.ts","sourceRoot":"","sources":["../../src/utils/isToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE7D;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,UAAU,GAAG,UAAU,CAEpE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ArrayNode, GroupNode, VariableNode } from "../ast
|
|
2
|
-
import { type AnyToken, type ParserResults } from "../types/ast.js";
|
|
1
|
+
import { type AnyToken, type ArrayNode, type GroupNode, type ParserResults, type VariableNode } from "../types/ast.js";
|
|
3
2
|
type Colors = {
|
|
4
3
|
/** Color used to highlight the actual text content of the token nodes. */
|
|
5
4
|
values: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettyAst.d.ts","sourceRoot":"","sources":["../../src/utils/prettyAst.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prettyAst.d.ts","sourceRoot":"","sources":["../../src/utils/prettyAst.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAA8B,KAAK,SAAS,EAAE,KAAK,aAAa,EAAc,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9J,KAAK,MAAM,GAAG;IACb,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,6NAA6N;IAC7N,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,mKAAmK;IACnK,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;CACb,CAAA;AAoBD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,SAAS,CACxB,GAAG,EAAE,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,EACpE,EAAE,MAAc,EAAE,QAAe,EAAE,IAAW,EAAE,MAAY,EAAE,KAAU,EAAE,GAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE,MAAM,CAAC,CAAM,EAC7J,MAAM,GAAE,OAAO,CAAC,MAAM,CAAC,GAAG,KAAU,GAClC,MAAM,CA2FR"}
|
package/dist/utils/prettyAst.js
CHANGED
|
@@ -2,17 +2,8 @@ import * as color from "@alanscodelog/utils/colors.js";
|
|
|
2
2
|
import { isBlank } from "@alanscodelog/utils/isBlank.js";
|
|
3
3
|
import "@alanscodelog/utils/types";
|
|
4
4
|
import { unreachable } from "@alanscodelog/utils/unreachable.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
8
|
-
import { ExpressionNode } from "../ast/classes/ExpressionNode.js";
|
|
9
|
-
import { GroupNode } from "../ast/classes/GroupNode.js";
|
|
10
|
-
import "@alanscodelog/utils/crop.js";
|
|
11
|
-
import "@alanscodelog/utils/indent.js";
|
|
12
|
-
import "@alanscodelog/utils/pretty.js";
|
|
13
|
-
import { ValidToken } from "../ast/classes/ValidToken.js";
|
|
14
|
-
import { VariableNode } from "../ast/classes/VariableNode.js";
|
|
15
|
-
import { TOKEN_TYPE } from "../types/ast.js";
|
|
5
|
+
import { isToken } from "./isToken.js";
|
|
6
|
+
import { AST_TYPE, TOKEN_TYPE } from "../types/ast.js";
|
|
16
7
|
const defaultColors = {
|
|
17
8
|
values: color.yellow,
|
|
18
9
|
info: color.cyan,
|
|
@@ -42,23 +33,25 @@ function prettyAst(ast, { indent = " ", children = "├╴", last = "└╴",
|
|
|
42
33
|
const ___ = __ + _ + branch;
|
|
43
34
|
const __L = __ + _ + indent[0];
|
|
44
35
|
const prettyAst_ = prettyAst;
|
|
45
|
-
if (ast
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
if (isToken(ast)) {
|
|
37
|
+
if (ast.valid) {
|
|
38
|
+
const value = `${ast.value}`;
|
|
39
|
+
return `TOKEN ${pos} ${c.values}${quote}${value}${quote}${c.reset}${extra}`;
|
|
40
|
+
}
|
|
41
|
+
if (!ast.valid) {
|
|
42
|
+
const value = `[${ast.expected.join(", ")}]`;
|
|
43
|
+
return `ERROR ${pos} ${c.error}${value}${c.reset}${extra}`;
|
|
44
|
+
}
|
|
48
45
|
}
|
|
49
|
-
if (ast
|
|
50
|
-
const value = `[${ast.expected.join(", ")}]`;
|
|
51
|
-
return `ERROR ${pos} ${c.error}${value}${c.reset}${extra}`;
|
|
52
|
-
}
|
|
53
|
-
if (ast instanceof ConditionNode) {
|
|
46
|
+
if (ast.type === AST_TYPE.CONDITION) {
|
|
54
47
|
const header = `${c.info}${ast.operator === void 0}${c.reset}`;
|
|
55
48
|
const not = ast.operator ? prettyAst_(ast.operator, opts, c, ___, `(negation)`) : "";
|
|
56
49
|
const property = ast.property ? prettyAst_(ast.property, opts, c, ___, `(property)`) : "";
|
|
57
50
|
const sepL = ((_a = ast.sep) == null ? void 0 : _a.left) ? prettyAst_(ast.sep.left, opts, c, ___, `(separator)`) : "";
|
|
58
51
|
const op = ast.propertyOperator ? prettyAst_(ast.propertyOperator, opts, c, ___, `(property operator)`) : "";
|
|
59
52
|
const sepR = ((_b = ast.sep) == null ? void 0 : _b.right) ? prettyAst_(ast.sep.right, opts, c, ___, `(separator)`) : "";
|
|
60
|
-
const isRegex = ast.value
|
|
61
|
-
const isArray = ast.value
|
|
53
|
+
const isRegex = ast.value.type === AST_TYPE.VARIABLE && ((_c = ast.value.quote) == null ? void 0 : _c.left.type) === TOKEN_TYPE.REGEX;
|
|
54
|
+
const isArray = ast.value.type === AST_TYPE.ARRAY;
|
|
62
55
|
const variable = prettyAst_(ast.value, opts, c, __L, `(${property ? "value" : "variable/alone"}${isRegex ? " - regex" : isArray ? "- array" : ""})`);
|
|
63
56
|
return [
|
|
64
57
|
`CONDITION ${pos} ${header}${extra}`,
|
|
@@ -66,7 +59,7 @@ function prettyAst(ast, { indent = " ", children = "├╴", last = "└╴",
|
|
|
66
59
|
].join(`
|
|
67
60
|
${__}`);
|
|
68
61
|
}
|
|
69
|
-
if (ast
|
|
62
|
+
if (ast.type === AST_TYPE.VARIABLE) {
|
|
70
63
|
const prefix = ast.prefix ? prettyAst_(ast.prefix, opts, c, ___, `(value prefix)`) : "";
|
|
71
64
|
const left = ((_d = ast.quote) == null ? void 0 : _d.left) ? prettyAst_(ast.quote.left, opts, c, ___, "") : "";
|
|
72
65
|
const value = prettyAst_(ast.value, opts, c, !ast.quote ? __L : !((_e = ast.quote) == null ? void 0 : _e.right) ? __L : ___, "");
|
|
@@ -78,7 +71,7 @@ ${__}`);
|
|
|
78
71
|
].join(`
|
|
79
72
|
${__}`);
|
|
80
73
|
}
|
|
81
|
-
if (ast
|
|
74
|
+
if (ast.type === AST_TYPE.GROUP) {
|
|
82
75
|
const header = `${c.info}${ast.prefix === void 0 || ast.prefix.operator === void 0}${c.reset}`;
|
|
83
76
|
const prefix = ast.prefix ? prettyAst_(ast.prefix, opts, c, ___, `(group prefix)`) : "";
|
|
84
77
|
const expression = prettyAst_(ast.expression, opts, c, __L, "");
|
|
@@ -88,7 +81,7 @@ ${__}`);
|
|
|
88
81
|
].join(`
|
|
89
82
|
${__}`);
|
|
90
83
|
}
|
|
91
|
-
if (ast
|
|
84
|
+
if (ast.type === AST_TYPE.ARRAY) {
|
|
92
85
|
const bracketL = ast.bracket.left ? prettyAst_(ast.bracket.left, opts, c, ast.values.length === 0 && !ast.bracket.right ? __L : ___, "") : "";
|
|
93
86
|
const values = ast.values.length > 0 ? ast.values.map(
|
|
94
87
|
(node, i) => prettyAst_(node, opts, c, !ast.bracket.right && i === ast.values.length - 1 ? __L : ___, "")
|
|
@@ -100,11 +93,11 @@ ${__}`);
|
|
|
100
93
|
].join(`
|
|
101
94
|
${__}`);
|
|
102
95
|
}
|
|
103
|
-
if (ast
|
|
96
|
+
if (ast.type === AST_TYPE.EXPRESSION) {
|
|
104
97
|
const left = prettyAst_(ast.left, opts, c, ___, "");
|
|
105
98
|
const operator = prettyAst_(ast.operator, opts, c, ___, `(boolean operator)`);
|
|
106
99
|
const right = prettyAst_(ast.right, opts, c, __L, "");
|
|
107
|
-
const header = ast.operator
|
|
100
|
+
const header = !ast.operator.valid ? `${c.info}[${ast.operator.expected.join(",")}]${c.reset}` : `${c.info}"${ast.operator.value}"${c.reset}`;
|
|
108
101
|
return [
|
|
109
102
|
`EXPRESSION ${pos} ${header}${extra}`,
|
|
110
103
|
...toRows([left, operator, right], opts)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/expressit",
|
|
3
3
|
"description": "A blazing fast, customizable, error-tolerant expression parser that creates safe to eval expressions + a few other goodies like autocomplete.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"types": "./dist/ast/*",
|
|
20
20
|
"import": "./dist/ast/*"
|
|
21
21
|
},
|
|
22
|
-
"./
|
|
23
|
-
"types": "./dist/
|
|
24
|
-
"import": "./dist/
|
|
22
|
+
"./internal": {
|
|
23
|
+
"types": "./dist/internal/index.d.ts",
|
|
24
|
+
"import": "./dist/internal/index.js"
|
|
25
25
|
},
|
|
26
|
-
"./
|
|
27
|
-
"types": "./dist/
|
|
28
|
-
"import": "./dist/
|
|
26
|
+
"./internal/*": {
|
|
27
|
+
"types": "./dist/internal/*",
|
|
28
|
+
"import": "./dist/internal/*"
|
|
29
29
|
},
|
|
30
30
|
"./methods": {
|
|
31
31
|
"types": "./dist/methods/index.d.ts",
|
package/src/Lexer.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isBlank } from "@alanscodelog/utils/isBlank.js"
|
|
2
2
|
import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn.js"
|
|
3
3
|
|
|
4
|
-
import { checkParserOpts } from "./
|
|
5
|
-
import { parseParserOptions } from "./
|
|
4
|
+
import { checkParserOpts } from "./internal/checkParserOpts.js"
|
|
5
|
+
import { parseParserOptions } from "./internal/parseParserOptions.js"
|
|
6
6
|
import type { FullParserOptions } from "./types/index.js"
|
|
7
7
|
|
|
8
8
|
const regexFlags = /^[a-zA-Z]+/
|