agency-lang 0.0.20 → 0.0.21
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.
|
@@ -4,7 +4,7 @@ import { optionalSemicolon } from "./parserUtils.js";
|
|
|
4
4
|
export const primitiveTypeParser = trace("primitiveTypeParser", seqC(set("type", "primitiveType"), capture(or(str("number"), str("string"), str("boolean"), str("undefined"), str("null")), "value")));
|
|
5
5
|
export const typeAliasVariableParser = trace("typeAliasVariableParser", seqC(set("type", "typeAliasVariable"), capture(many1WithJoin(varNameChar), "aliasName")));
|
|
6
6
|
export const arrayTypeParser = (input) => {
|
|
7
|
-
const parser = trace("arrayTypeParser", seqC(set("type", "arrayType"), capture(or(objectTypeParser, primitiveTypeParser), "elementType"), capture(count(str("[]")), "arrayDepth")));
|
|
7
|
+
const parser = trace("arrayTypeParser", seqC(set("type", "arrayType"), capture(or(objectTypeParser, primitiveTypeParser, typeAliasVariableParser), "elementType"), capture(count(str("[]")), "arrayDepth")));
|
|
8
8
|
const result = parser(input);
|
|
9
9
|
if (result.success) {
|
|
10
10
|
// Wrap the elementType in ArrayType according to arrayDepth
|
|
@@ -23,7 +23,7 @@ export const arrayTypeParser = (input) => {
|
|
|
23
23
|
}
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
|
-
export const angleBracketsArrayTypeParser = trace("angleBracketsArrayTypeParser", seqC(set("type", "arrayType"), str("array"), char("<"), capture(primitiveTypeParser, "elementType"), char(">")));
|
|
26
|
+
export const angleBracketsArrayTypeParser = trace("angleBracketsArrayTypeParser", seqC(set("type", "arrayType"), str("array"), char("<"), capture(or(primitiveTypeParser, typeAliasVariableParser), "elementType"), char(">")));
|
|
27
27
|
export const stringLiteralTypeParser = trace("stringLiteralTypeParser", seqC(set("type", "stringLiteralType"), char('"'), capture(many1Till(char('"')), "value"), char('"')));
|
|
28
28
|
export const numberLiteralTypeParser = trace("numberLiteralTypeParser", seqC(set("type", "numberLiteralType"), capture(many1WithJoin(or(char("-"), char("."), digit)), "value")));
|
|
29
29
|
export const booleanLiteralTypeParser = trace("booleanLiteralTypeParser", seqC(set("type", "booleanLiteralType"), capture(or(str("true"), str("false")), "value")));
|