From 00b954b8f96726412d70161ade59701cae8fcf6c Mon Sep 17 00:00:00 2001 From: Andreas Kollegger Date: Tue, 19 Nov 2024 11:02:30 +0000 Subject: [PATCH] references must be a key; keys may be symbols, string literals or integers; parse result is nested string s-expressions --- .gitignore | 2 + gram.ne | 59 +- package-lock.json | 692 +++++----------------- package.json | 17 +- patterns.ne | 2 + public/index.html | 921 ++++++++++++----------------- src/lib/generated-grammar.ts | 90 +-- src/lib/gram-global-record.spec.ts | 26 +- src/lib/gram-nodes.spec.ts | 8 +- 9 files changed, 647 insertions(+), 1170 deletions(-) diff --git a/.gitignore b/.gitignore index 9a2dde1..eddcb9c 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ Thumbs.db .nx/cache .nx/workspace-data + +vite.config.*.timestamp* \ No newline at end of file diff --git a/gram.ne b/gram.ne index 73caed6..c271402 100644 --- a/gram.ne +++ b/gram.ne @@ -1,22 +1,25 @@ @preprocessor typescript -Gram -> Record:? (Pattern _):+ +Gram -> (Record _):? (Pattern _):* + {% ([record, patterns]) => `(gram ${record ? record : ""} ${patterns.filter(nonNull).join(",")})` %} Pattern -> PatternElement (_ "," _ PatternElement):* + {% ([p1, ps]) => `(pattern ${p1})` %} -PatternElement -> (Annotation _):* (Subject | Path) +PatternElement -> (Annotation _):* (Subject | Path | Reference) + {% ([anno, el]) => `${anno.filter(nonNull).join("@")}${el}?` %} Subject -> "[" _ Attributes _ Association:? "]" + {% () => `(subject)` %} -Association -> "|" (Labels:? Record:? _ "|"):? _ AssociationMember (_ "," _ AssociationMember):* - -AssociationMember -> (PatternElement | Reference) +Association -> "|" (Labels:? Record:? _ "|"):? _ Pattern Reference -> Identity + {% () => `(reference)` %} Path -> - Node - | Relationship + Node {% () => `(node)` %} + | Relationship {% () => `(relationship)` %} Node -> "(" _ Attributes _ ")" @@ -52,15 +55,17 @@ QualifiedArrow -> Attributes -> Identity:? Labels:? Record:? -Identity -> Value +Identity -> Key -Labels -> ( (Define | Declare | Annotate) Key):+ +Labels -> ( (Define | Declare ) Key):+ Record -> "{" _ "}" | "{" _ Property ("," _ Property ):* "}" + {% (d) => `(record ${(d.length > 2) ? d[2] : ""})` %} -Property -> Key _ ( Define | Declare | Annotate ) _ Value +Property -> Key _ ( Define | Declare ) _ Value + {% ([key, _1, binder, _2, value]) => `(property ${key} ${value})` %} # What something has Define -> ":" @@ -71,7 +76,7 @@ Declare -> "::" # What it means Annotate -> "@" -Key -> ( Symbol | StringLiteral ) +Key -> ( Symbol | StringLiteral | Integer) Value -> Null @@ -93,7 +98,8 @@ Null -> "null" Boolean -> "true" | "false" -Symbol -> [a-zA-Z_] [0-9a-zA-Z_\-]:* +Symbol -> [a-zA-Z_] [0-9a-zA-Z_\-@]:* +{% (d) => `(symbol)` %} Range -> NumericLiteral ".." NumericLiteral @@ -108,16 +114,18 @@ NumericLiteral -> | Percentage Integer -> ("-"|"+"):? [0-9]:+ + {% (d) => `(integer)` %} -Decimal -> "-":? [0-9]:+ ("." [0-9]:+):? ([eE] [+-]:? [0-9]:+):? +Decimal -> "-":? [0-9]:+ ("." [0-9]:+) ([eE] [+-]:? [0-9]:+):? + {% (d) => `(decimal)` %} Hexadecimal -> "-":? "0x" [0-9a-fA-F]:+ Octal -> "-":? "0" [0-7]:+ -Measurement -> Decimal Symbol +Measurement -> NumericLiteral Symbol -Percentage -> Decimal "%" +Percentage -> NumericLiteral "%" StringLiteral -> DoubleQuotedLiteral @@ -151,6 +159,25 @@ EscapedChars -> | "u" [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9] _ -> wschar:* + {% nothing %} __ -> wschar:+ + {% nothing %} + +wschar -> [ \t\n\v\f] + +@{% + const nothing = () => null; + + const nonNull = (x) => (x !== null && x !== '') + + const nonNullArray = (d) => { + let output = [d[2]]; + + for (let i in d[3]) { + output.push(d[3][i][3]); + } + + return output; +} -wschar -> [ \t\n\v\f] \ No newline at end of file +%} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8e6c5e5..c65d599 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,17 +9,18 @@ "version": "0.0.1", "license": "MIT", "dependencies": { - "effect": "^3.9.2", + "@types/nearley": "^2.11.5", + "effect": "^3.10.15", "nearley": "^2.20.1", "tslib": "^2.8.0" }, "devDependencies": { - "@nx/eslint": "20.0.3", - "@nx/eslint-plugin": "20.0.3", - "@nx/js": "20.0.3", - "@nx/vite": "20.0.3", - "@nx/web": "20.0.3", - "@nx/workspace": "20.0.3", + "@nx/eslint": "20.1.2", + "@nx/eslint-plugin": "20.1.2", + "@nx/js": "20.1.2", + "@nx/vite": "20.1.2", + "@nx/web": "20.1.2", + "@nx/workspace": "20.1.2", "@swc-node/register": "~1.9.1", "@swc/core": "~1.5.7", "@swc/helpers": "~0.5.11", @@ -30,7 +31,7 @@ "@vitest/ui": "^2.1.3", "eslint": "~8.57.0", "eslint-config-prettier": "^9.0.0", - "nx": "20.0.3", + "nx": "20.1.2", "prettier": "^2.6.2", "typescript": "~5.6.3", "vite": "^5.4.9", @@ -2548,59 +2549,6 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/config-array": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", - "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@eslint/object-schema": "^2.1.4", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@eslint/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@eslint/core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.7.0.tgz", - "integrity": "sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", @@ -2688,57 +2636,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.1.tgz", - "integrity": "sha512-HFZ4Mp26nbWk9d/BpvP0YNL6W4UoZF0VFcTw/aPPA8RpOxeFQgK+ClABGgAUXs9Y/RGX/l1vOmrqz1MQt9MNuw==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz", - "integrity": "sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.5.tgz", - "integrity": "sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@humanfs/core": "^0.19.0", - "@humanwhocodes/retry": "^0.3.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -2801,21 +2698,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -3046,9 +2928,9 @@ } }, "node_modules/@nx/devkit": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/devkit/-/devkit-20.0.3.tgz", - "integrity": "sha512-tB6iQ2opvipyy+4J0eImW/Nl8SoILPpDodwnThDJ2U2mflHG6/+3Wl6Q1hXieOnjT+ZE++ve91aYDEAi9OMwvA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/devkit/-/devkit-20.1.2.tgz", + "integrity": "sha512-MTEWiEST7DhzZ2QmrixLnHfYVDZk7QN9omLL8m+5Etcn/3ZKa1aAo9Amd2MkUM+0MPoTKnxoGdw0fQUpAy21Mg==", "dev": true, "license": "MIT", "dependencies": { @@ -3066,14 +2948,14 @@ } }, "node_modules/@nx/eslint": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/eslint/-/eslint-20.0.3.tgz", - "integrity": "sha512-uWS1jvGj5T2GOMRit8HqC0LOo1BxEzQejxEioIfLVaoO8bd67FdZQh2Tz3Qon9V05VXm8pEHQv/1NVNqanzgBQ==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/eslint/-/eslint-20.1.2.tgz", + "integrity": "sha512-VMJ65E0jUEjup8hxz6LtqYbYnk2TUoLCM7ZV4rZdPqm0rLvlHDmb7BfdY2u2sZa3dwRDtupeDMlbyPX/Eb8Rcw==", "dev": true, "license": "MIT", "dependencies": { - "@nx/devkit": "20.0.3", - "@nx/js": "20.0.3", + "@nx/devkit": "20.1.2", + "@nx/js": "20.1.2", "semver": "^7.5.3", "tslib": "^2.3.0", "typescript": "~5.4.2" @@ -3089,15 +2971,14 @@ } }, "node_modules/@nx/eslint-plugin": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/eslint-plugin/-/eslint-plugin-20.0.3.tgz", - "integrity": "sha512-KQi2rHwRQjQDqt7g4666LdKVBUNcHubX1MlXCB/f0ejCJunlybqK4aA+LiM0KIQpieevvIlAHJuTdZQ2M7q2HQ==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/eslint-plugin/-/eslint-plugin-20.1.2.tgz", + "integrity": "sha512-eLOVzaBPwS71Bb07jhJFZYtkvD33fZb3ObwLDXG5DmfpNpYBGOD4XX0qj6eq/5cfsIck6n8n7RKVm+7ZyqYowg==", "dev": true, "license": "MIT", "dependencies": { - "@eslint/compat": "^1.1.1", - "@nx/devkit": "20.0.3", - "@nx/js": "20.0.3", + "@nx/devkit": "20.1.2", + "@nx/js": "20.1.2", "@typescript-eslint/type-utils": "^8.0.0", "@typescript-eslint/utils": "^8.0.0", "chalk": "^4.1.0", @@ -3117,100 +2998,6 @@ } } }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/compat": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.2.1.tgz", - "integrity": "sha512-JbHG2TWuCeNzh87fXo+/46Z1LEo9DBA9T188d0fZgGxAD+cNyS6sx9fdiyxjGPBMyQVRlCutTByZ6a5+YMkF7g==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "peerDependencies": { - "eslint": "^9.10.0" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/@eslint/js": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.13.0.tgz", - "integrity": "sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@nx/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.10.0.tgz", @@ -3338,187 +3125,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@nx/eslint-plugin/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.13.0.tgz", - "integrity": "sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.11.0", - "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.7.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.13.0", - "@eslint/plugin-kit": "^0.2.0", - "@humanfs/node": "^0.16.5", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.3.1", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.1.0", - "eslint-visitor-keys": "^4.1.0", - "espree": "^10.2.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint-scope": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.1.0.tgz", - "integrity": "sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==", - "dev": true, - "license": "BSD-2-Clause", - "peer": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", - "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "peer": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/espree": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz", - "integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==", - "dev": true, - "license": "BSD-2-Clause", - "peer": true, - "dependencies": { - "acorn": "^8.12.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", - "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/@nx/eslint-plugin/node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -3536,35 +3142,6 @@ "node": ">=8.6.0" } }, - "node_modules/@nx/eslint-plugin/node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@nx/eslint-plugin/node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/@nx/eslint-plugin/node_modules/globals": { "version": "15.11.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.11.0.tgz", @@ -3578,20 +3155,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@nx/eslint-plugin/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/@nx/eslint-plugin/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -3623,9 +3186,9 @@ } }, "node_modules/@nx/js": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/js/-/js-20.0.3.tgz", - "integrity": "sha512-UbltxJyfEXL586kk7yxOTNHtigd7rq7atmcOmMphcxbeWk9HzeowVh6j6OA4MAKwYauomjCqsJbvWURI8qf+pg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/js/-/js-20.1.2.tgz", + "integrity": "sha512-+ULLy0vuAUyRicQqjMsG3JmgEylZdciJJOuOanwrmmG/+jv64nUJYycZbwPmGsioViHk/0WB1d5SWWfH7cZ+Ww==", "dev": true, "license": "MIT", "dependencies": { @@ -3636,8 +3199,8 @@ "@babel/preset-env": "^7.23.2", "@babel/preset-typescript": "^7.22.5", "@babel/runtime": "^7.22.6", - "@nx/devkit": "20.0.3", - "@nx/workspace": "20.0.3", + "@nx/devkit": "20.1.2", + "@nx/workspace": "20.1.2", "@zkochan/js-yaml": "0.0.7", "babel-plugin-const-enum": "^1.0.1", "babel-plugin-macros": "^2.8.0", @@ -3699,9 +3262,9 @@ } }, "node_modules/@nx/nx-darwin-arm64": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-darwin-arm64/-/nx-darwin-arm64-20.0.3.tgz", - "integrity": "sha512-/wjxSuQZOHwDopNAfuh2BTsaDtDECjTDrKHJdTknrSVjdsB2b1hwSdL7Ct0PXBiSnf+0gfYBR2fuPmLZYb3AXA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-arm64/-/nx-darwin-arm64-20.1.2.tgz", + "integrity": "sha512-PJ91TQhd28kitDBubKUOXMYvrtSDrG+rr8MsIe9cHo1CvU9smcGVBwuHBxniq0DXsyOX/5GL6ngq7hjN2nQ3XQ==", "cpu": [ "arm64" ], @@ -3716,9 +3279,9 @@ } }, "node_modules/@nx/nx-darwin-x64": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-darwin-x64/-/nx-darwin-x64-20.0.3.tgz", - "integrity": "sha512-Gobgkvsx61P5TI0uuDQTI/D2AXJt3xnBuAWQ4V/NW/OpkvL8j/q8zk81uK0tumVvIc4p5kSlGmQ46/ytSrdqvg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-x64/-/nx-darwin-x64-20.1.2.tgz", + "integrity": "sha512-1fopau7nxIhTF26vDTIzMxl15AtW4FvUSdy+r1mNRKrKyjjpqnlu00SQBW7JzGV0agDD1B/61yYei5Q2aMOt7Q==", "cpu": [ "x64" ], @@ -3733,9 +3296,9 @@ } }, "node_modules/@nx/nx-freebsd-x64": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-freebsd-x64/-/nx-freebsd-x64-20.0.3.tgz", - "integrity": "sha512-nbYp89BP0z0DzuaUH/yVVhCbL96vUUaKmCVmmdlvQRgiaX89BChAMuEdLNSeaDHFrhgTYB87ku3Ok6DRCAIOcg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-freebsd-x64/-/nx-freebsd-x64-20.1.2.tgz", + "integrity": "sha512-55YgIp3v4zz7xMzJO93dtglbOTER2XdS6jrCt8GbKaWGFl5drRrBoNGONtiGNU7C3hLx1VsorbynCkJT18PjKQ==", "cpu": [ "x64" ], @@ -3750,9 +3313,9 @@ } }, "node_modules/@nx/nx-linux-arm-gnueabihf": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-20.0.3.tgz", - "integrity": "sha512-eKIYJPvXO/N1FjteZHC4DLV0u+2h70RmrDQODPztfl3mI5AjCwFdLf9RPN1D+SuNdfK1WwZIszY+FiVxrpK19A==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-20.1.2.tgz", + "integrity": "sha512-sMhNA8uAV43UYVEXEa8TZ8Fjpom4CGq1umTptEGOF4TTtdNn2AUBreg+0bVODM8MMSzRWGI1VbkZzHESnAPwqw==", "cpu": [ "arm" ], @@ -3767,9 +3330,9 @@ } }, "node_modules/@nx/nx-linux-arm64-gnu": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-20.0.3.tgz", - "integrity": "sha512-CDFy2WNsMZvxshtGdFV/yCux1XkLtcqh0FiitNvGdgNugXXp3CLVEUx6dI3VBuIBNGbfozdr7n+fuXN6F2S4MQ==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-20.1.2.tgz", + "integrity": "sha512-bsevarNHglaYLmIvPNQOdHrBnBgaW3EOUM0flwaXdWuZbL1bWx8GoVwHp9yJpZOAOfIF/Nhq5iTpaZB2nYFrAA==", "cpu": [ "arm64" ], @@ -3784,9 +3347,9 @@ } }, "node_modules/@nx/nx-linux-arm64-musl": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-20.0.3.tgz", - "integrity": "sha512-BGrSRNPuDyj0yeP2MyzF1MMij1KO4Q/2YSgBbYzVSc8JdrUqf+3rqI8VXNTr3FcAKMTPgFjkFZ3XD3s/62gsdg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-20.1.2.tgz", + "integrity": "sha512-GFZTptkhZPL/iZ3tYDmspIcPEaXyy/L/o59gyp33GoFAAyDhiXIF7J1Lz81Xn8VKrX6TvEY8/9qSh86pb7qzDQ==", "cpu": [ "arm64" ], @@ -3801,9 +3364,9 @@ } }, "node_modules/@nx/nx-linux-x64-gnu": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-20.0.3.tgz", - "integrity": "sha512-xGGjQ8q5XuF0/432APvAi/OSMdR3LZ1yQ9hYh+JGvM5wh44I3UbgBXRCJlsHp+t2hdlilF6kpaeMSiP1Z9CEbg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-20.1.2.tgz", + "integrity": "sha512-yqEW/iglKT4d9lgfnwSNhmDzPxCkRhtdmZqOYpGDM0eZFwYwJF+WRGjW8xIqMj8PA1yrGItzXZOmyFjJqHAF2w==", "cpu": [ "x64" ], @@ -3818,9 +3381,9 @@ } }, "node_modules/@nx/nx-linux-x64-musl": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-20.0.3.tgz", - "integrity": "sha512-fTmZNbq3QQF5BLGPB8PGuFuNo3s2F86IQDOUYWpjXiuKjoI1Y5yM14RQpHLwYOGnUNoKYOhlv/JAyFrDX6ALZA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-20.1.2.tgz", + "integrity": "sha512-SP6PpWT4cQVrC4WJQdpfADrYJQzkbhgmcGleWbpr7II1HJgOsAcvoDwQGpPQX+3Wo+VBiNecvUAOzacMQkXPGw==", "cpu": [ "x64" ], @@ -3835,9 +3398,9 @@ } }, "node_modules/@nx/nx-win32-arm64-msvc": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-20.0.3.tgz", - "integrity": "sha512-hdtfg9pIzhtLqqGvsTemQYwe+kqqL1JGNgrlf3V59HSbbAADYZbHnliujoRybJo7dpeS/DDTNMNeblg99tFQLA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-20.1.2.tgz", + "integrity": "sha512-JZQx9gr39LY3D7uleiXlpxUsavuOrOQNBocwKHkAMnykaT/e1VCxTnm/hk+2b4foWwfURTqoRiFEba70iiCdYg==", "cpu": [ "arm64" ], @@ -3852,9 +3415,9 @@ } }, "node_modules/@nx/nx-win32-x64-msvc": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-20.0.3.tgz", - "integrity": "sha512-HcqE8AlWuwcsIOj0OnKDQ3q7L0RZsOrBRhDRKbJeUnIFz/t2R3q8Y6trrqTyFAafgW6JNLBp+tgcUyfHPUy/eQ==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-20.1.2.tgz", + "integrity": "sha512-6GmT8iswDiCvJaCtW9DpWeAQmLS/kfAuRLYBisfzlONuLPaDdjhgVIxZBqqUSFfclwcVz+NhIOGvdr0aGFZCtQ==", "cpu": [ "x64" ], @@ -3869,14 +3432,14 @@ } }, "node_modules/@nx/vite": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/vite/-/vite-20.0.3.tgz", - "integrity": "sha512-+C/nGgsLVNqPifY8DYtw1yM3pG53EoON6kahBR540hVECFcswgymHyTDDS+PUFqmXtANmYnt3eZxwnzCClegXw==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/vite/-/vite-20.1.2.tgz", + "integrity": "sha512-zcguviaEvudGS5rpPBosRP3gyniQa+/blNgEorE09GMyKedO7cbvacxV21iRH1l++D8a5bnx9Up3f66kZuRoeA==", "dev": true, "license": "MIT", "dependencies": { - "@nx/devkit": "20.0.3", - "@nx/js": "20.0.3", + "@nx/devkit": "20.1.2", + "@nx/js": "20.1.2", "@phenomnomnominal/tsquery": "~5.0.1", "@swc/helpers": "~0.5.0", "enquirer": "~2.3.6", @@ -3889,14 +3452,14 @@ } }, "node_modules/@nx/web": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/web/-/web-20.0.3.tgz", - "integrity": "sha512-b3KpUeA0cI9JIpRBYEk/4sIs9nCI6RcXCmxFoyW60vYsr2VtPZjtLKbo3bBT7HLOk3iwAYYWzCY1cu0Xzig3Lg==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/web/-/web-20.1.2.tgz", + "integrity": "sha512-CRMAJXwj375J+/GI9hRfOt2SJ0DQ5prCzOcmXJvQIfHy3CT5chrkSj2qc7IgKkkMiqZojr4VCTUHmJ2WAR3sCw==", "dev": true, "license": "MIT", "dependencies": { - "@nx/devkit": "20.0.3", - "@nx/js": "20.0.3", + "@nx/devkit": "20.1.2", + "@nx/js": "20.1.2", "detect-port": "^1.5.1", "http-server": "^14.1.0", "picocolors": "^1.1.0", @@ -3904,16 +3467,16 @@ } }, "node_modules/@nx/workspace": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/@nx/workspace/-/workspace-20.0.3.tgz", - "integrity": "sha512-ctStDr9UlXt63v9wC1qS9lqLABSDfcfCH/FtQ6ZF5RjWIkzZS672g29gkT83L9B87dfRJYCH8yGGbvMJzq0qRA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@nx/workspace/-/workspace-20.1.2.tgz", + "integrity": "sha512-YZiBwHU+NsJvJ7e7AZnyk5cP523AIHmHFf28nEpBY3zhxLghx/s9C99Swbw+uUyWlUf7JtTO9jB6OsEfMc38Uw==", "dev": true, "license": "MIT", "dependencies": { - "@nx/devkit": "20.0.3", + "@nx/devkit": "20.1.2", "chalk": "^4.1.0", "enquirer": "~2.3.6", - "nx": "20.0.3", + "nx": "20.1.2", "tslib": "^2.3.0", "yargs-parser": "21.1.1" } @@ -4524,13 +4087,11 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT", - "peer": true + "node_modules/@types/nearley": { + "version": "2.11.5", + "resolved": "https://registry.npmjs.org/@types/nearley/-/nearley-2.11.5.tgz", + "integrity": "sha512-dM7TrN0bVxGGXTYGx4YhGear8ysLO5SOuouAWM9oltjQ3m9oYa13qi8Z1DJp5zxVMPukvQdsrnZmgzpeuTSEQA==", + "license": "MIT" }, "node_modules/@types/node": { "version": "22.7.7", @@ -4942,9 +4503,9 @@ "license": "BSD-2-Clause" }, "node_modules/@yarnpkg/parsers": { - "version": "3.0.0-rc.46", - "resolved": "https://registry.npmjs.org/@yarnpkg/parsers/-/parsers-3.0.0-rc.46.tgz", - "integrity": "sha512-aiATs7pSutzda/rq8fnuPwTglyVwjM22bNnK2ZgjrpAjQHSSl3lztd2f9evst1W/qnC58DRz7T7QndUDumAR4Q==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@yarnpkg/parsers/-/parsers-3.0.2.tgz", + "integrity": "sha512-/HcYgtUSiJiot/XWGLOlGxPYUG65+/31V8oqk17vZLW1xlCoR4PampyePljOxY2n8/3jz9+tIFzICsyGujJZoA==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -4952,7 +4513,7 @@ "tslib": "^2.4.0" }, "engines": { - "node": ">=14.15.0" + "node": ">=18.12.0" } }, "node_modules/@zkochan/js-yaml": { @@ -5805,13 +5366,13 @@ } }, "node_modules/dotenv-expand": { - "version": "11.0.6", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.6.tgz", - "integrity": "sha512-8NHi73otpWsZGBSZwwknTXS5pqMOrk9+Ssrna8xCaxkzEpU9OTf9R5ArQGVw03//Zmk9MOwLPng9WwndvpAJ5g==", + "version": "11.0.7", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz", + "integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "dotenv": "^16.4.4" + "dotenv": "^16.4.5" }, "engines": { "node": ">=12" @@ -5828,10 +5389,13 @@ "license": "MIT" }, "node_modules/effect": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/effect/-/effect-3.9.2.tgz", - "integrity": "sha512-1sx/v1HTWHTodXfzWxAFg+SCF+ACgpJVruaAMIh/NmDVvrUsf0x9PzpXvkgJUbQ1fMdmKYK//FqxeHSQ+Zxv/Q==", - "license": "MIT" + "version": "3.10.15", + "resolved": "https://registry.npmjs.org/effect/-/effect-3.10.15.tgz", + "integrity": "sha512-LdczPAFbtij3xGr9i+8PyDtuWdlXjSY5UJ8PKrYrr0DClKfR/OW3j8sxtambWYljzJAYD865KFhv7LdbWdG7VQ==", + "license": "MIT", + "dependencies": { + "fast-check": "^3.21.0" + } }, "node_modules/ejs": { "version": "3.1.10", @@ -6251,6 +5815,28 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-check": { + "version": "3.23.1", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.23.1.tgz", + "integrity": "sha512-u/MudsoQEgBUZgR5N1v87vEgybeVYus9VnDVaIkxkkGP2jt54naghQ3PCQHJiogS8U/GavZCUPFfx3Xkp+NaHw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^6.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -6472,9 +6058,9 @@ } }, "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, "license": "MIT", "dependencies": { @@ -7716,16 +7302,16 @@ } }, "node_modules/nx": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/nx/-/nx-20.0.3.tgz", - "integrity": "sha512-6ZuZ09IdMIwbklKqEwUAHspuVMsDr7TIcCyeytmdDC1XbA+Tbb93wriyJyiI9EBQw4StrlJF9vSXAZsuDiOKeA==", + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/nx/-/nx-20.1.2.tgz", + "integrity": "sha512-CvjmuQmI0RWLYZxRSIgQZmzsQv6dPp9oI0YZE3L1dagBPfTf5Cun65I0GLt7bdkDnVx2PGYkDbIoJSv2/V+83Q==", "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { "@napi-rs/wasm-runtime": "0.2.4", "@yarnpkg/lockfile": "^1.1.0", - "@yarnpkg/parsers": "3.0.0-rc.46", + "@yarnpkg/parsers": "3.0.2", "@zkochan/js-yaml": "0.0.7", "axios": "^1.7.4", "chalk": "^4.1.0", @@ -7761,16 +7347,16 @@ "nx-cloud": "bin/nx-cloud.js" }, "optionalDependencies": { - "@nx/nx-darwin-arm64": "20.0.3", - "@nx/nx-darwin-x64": "20.0.3", - "@nx/nx-freebsd-x64": "20.0.3", - "@nx/nx-linux-arm-gnueabihf": "20.0.3", - "@nx/nx-linux-arm64-gnu": "20.0.3", - "@nx/nx-linux-arm64-musl": "20.0.3", - "@nx/nx-linux-x64-gnu": "20.0.3", - "@nx/nx-linux-x64-musl": "20.0.3", - "@nx/nx-win32-arm64-msvc": "20.0.3", - "@nx/nx-win32-x64-msvc": "20.0.3" + "@nx/nx-darwin-arm64": "20.1.2", + "@nx/nx-darwin-x64": "20.1.2", + "@nx/nx-freebsd-x64": "20.1.2", + "@nx/nx-linux-arm-gnueabihf": "20.1.2", + "@nx/nx-linux-arm64-gnu": "20.1.2", + "@nx/nx-linux-arm64-musl": "20.1.2", + "@nx/nx-linux-x64-gnu": "20.1.2", + "@nx/nx-linux-x64-musl": "20.1.2", + "@nx/nx-win32-arm64-msvc": "20.1.2", + "@nx/nx-win32-x64-msvc": "20.1.2" }, "peerDependencies": { "@swc-node/register": "^1.8.0", @@ -8234,6 +7820,22 @@ "node": ">=6" } }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, "node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", diff --git a/package.json b/package.json index cd3b326..21a93fb 100644 --- a/package.json +++ b/package.json @@ -10,17 +10,18 @@ "test": "nx test" }, "dependencies": { - "effect": "^3.9.2", + "@types/nearley": "^2.11.5", + "effect": "^3.10.15", "nearley": "^2.20.1", "tslib": "^2.8.0" }, "devDependencies": { - "@nx/eslint": "20.0.3", - "@nx/eslint-plugin": "20.0.3", - "@nx/js": "20.0.3", - "@nx/vite": "20.0.3", - "@nx/web": "20.0.3", - "@nx/workspace": "20.0.3", + "@nx/eslint": "20.1.2", + "@nx/eslint-plugin": "20.1.2", + "@nx/js": "20.1.2", + "@nx/vite": "20.1.2", + "@nx/web": "20.1.2", + "@nx/workspace": "20.1.2", "@swc-node/register": "~1.9.1", "@swc/core": "~1.5.7", "@swc/helpers": "~0.5.11", @@ -31,7 +32,7 @@ "@vitest/ui": "^2.1.3", "eslint": "~8.57.0", "eslint-config-prettier": "^9.0.0", - "nx": "20.0.3", + "nx": "20.1.2", "prettier": "^2.6.2", "typescript": "~5.6.3", "vite": "^5.4.9", diff --git a/patterns.ne b/patterns.ne index ef49762..ef41655 100644 --- a/patterns.ne +++ b/patterns.ne @@ -3,6 +3,8 @@ @builtin "number.ne" @builtin "whitespace.ne" +# A simplified grammar showing the primary elements + Pattern -> PatternElement ("," PatternElement):* PatternElement -> (Node | Relationship | Subject) diff --git a/public/index.html b/public/index.html index e8eeec7..9ef645f 100644 --- a/public/index.html +++ b/public/index.html @@ -32,76 +32,105 @@

Gram

- + - + - + - + - + - + - - -Record - - - - + + + + + + + - + +Record + + - - - + + + +_ + + + + + + + - - - + + + - - - -Pattern + - - + + - - - -_ + + + + + + + + + + + + + + + +Pattern - + + + + + + +_ + + - + - - + + - + - + - + - - + + + @@ -200,16 +229,16 @@

Pattern

PatternElement

- + - + - + @@ -260,40 +289,54 @@

PatternElement

- + - - - + + + - - - -Subject + + + +Subject - + - + - - - + + + + + + + +Path + + + + + + + + + - - - -Path + + + +Reference - + - + - + - + @@ -377,58 +420,16 @@

Subject

Association

- - - - - - - - - - - - - - - -Membership - - - - - - - - - - - - - -Ordering - - - - - - - - - -
-

Membership

-
- + - + - + @@ -519,296 +520,15 @@

Membership

- - -AssociationMember - - - - - - - - - - - - - - - - - - - - - - - - - - - -_ - - - - - - - -"," - - - - - - - -_ - - - - - - - -AssociationMember - - + + +Pattern - + - - - - - - - - - - - - - - - - -
-

Ordering

-
- - - - - - - - - - - - - - - - - - - - - - -"->" - - - - - - - - - - - - - -"-[" - - - - - - - - - - - - - - - -Labels - - - - - - - - - - - - - - - - -Record - - - - - - - - -"]->" - - - - - - - - - - -_ - - - - - - - -AssociationMember - - - - - - - - - - - - - - - - - - - -_ - - - - - - - -"," - - - - - - - -_ - - - - - - - -AssociationMember - - - - - - - - - - - - - + - - - - - - -
-

AssociationMember

-
- - - - - - - - - - - - - - - - - - - - - - -PatternElement - - - - - - - - - - - - - -Reference - - - - - - - - - + @@ -1648,97 +1368,83 @@

Identity

Labels

- + - + - + - + - + - + - + - - - + + + - - - -Define + + + +Define - + - + - - - + + + - - - -Declare - - - - - - - - - - - - - -Annotate + + + +Declare - + - + - + - - - -Key + + + +Key - + - + - - + + - + - + - + - + - + @@ -1883,16 +1589,16 @@

Record

Property

- + - + - + @@ -1911,70 +1617,56 @@

Property

- + - - - + + + - - - -Define + + + +Define - + - + - - - - - - - -Declare - - - - - + + + - - - - - - - -Annotate + + + +Declare - + - + - + - - - -_ + + + +_ - - + + - - - -Value + + + +Value - + - + - + @@ -2495,56 +2187,56 @@

Boolean

Symbol

- + - + - + - - -/[a-zA-Z_]/ + + +/[a-zA-Z_@]/ - + - - - + + + - + - - + + - - - + + + - - - -/[0-9a-zA-Z_@]/ + + + +/[0-9a-zA-Z_\-@]/ - - + + - + - + - + - + - + @@ -3174,7 +2866,7 @@

Percentage

StringLiteral

- + @@ -3222,6 +2914,20 @@

StringLiteral

+ + + + + + + + + +FencedStringLiteral + + + + @@ -3358,16 +3064,16 @@

SingleQuotedLiteral

BacktickStringLiteral

- + - + - + @@ -3378,44 +3084,99 @@

BacktickStringLiteral

- + - + - + - + - - -/[^`]/ + + +NonBacktickChar - + - + - + - + - + - - - -"`" + + + +"`" - + - + - + + + + +
+

FencedStringLiteral

+
+ + + + + + + + + + + + + + + +"```\n" + + + + + + + + + + + +/[\s\S]/ + + + + + + + + + + + + + + +"\n```" + + + + + + @@ -3569,6 +3330,70 @@

NonSingleQuoteChar

+
+

NonBacktickChar

+
+ + + + + + + + + + + + + + + +/[^`\n]/ + + + + + + + + + + + + + +"\\" + + + + + + + +EscapedChars + + + + + + + + + + + + + +"\\`" + + + + + + + + +

EscapedChars

diff --git a/src/lib/generated-grammar.ts b/src/lib/generated-grammar.ts index b556c1f..3c5ad02 100644 --- a/src/lib/generated-grammar.ts +++ b/src/lib/generated-grammar.ts @@ -3,6 +3,21 @@ // Bypasses TS6133. Allow declared but unused functions. // @ts-ignore function id(d: any[]): any { return d[0]; } + + const nothing = () => null; + + const nonNull = (x) => (x !== null && x !== '') + + const nonNullArray = (d) => { + let output = [d[2]]; + + for (let i in d[3]) { + output.push(d[3][i][3]); + } + + return output; +} + interface NearleyToken { value: any; @@ -34,26 +49,27 @@ interface Grammar { const grammar: Grammar = { Lexer: undefined, ParserRules: [ - {"name": "Gram$ebnf$1", "symbols": ["Record"], "postprocess": id}, + {"name": "Gram$ebnf$1$subexpression$1", "symbols": ["Record", "_"]}, + {"name": "Gram$ebnf$1", "symbols": ["Gram$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "Gram$ebnf$1", "symbols": [], "postprocess": () => null}, + {"name": "Gram$ebnf$2", "symbols": []}, {"name": "Gram$ebnf$2$subexpression$1", "symbols": ["Pattern", "_"]}, - {"name": "Gram$ebnf$2", "symbols": ["Gram$ebnf$2$subexpression$1"]}, - {"name": "Gram$ebnf$2$subexpression$2", "symbols": ["Pattern", "_"]}, - {"name": "Gram$ebnf$2", "symbols": ["Gram$ebnf$2", "Gram$ebnf$2$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Gram", "symbols": ["Gram$ebnf$1", "Gram$ebnf$2"]}, + {"name": "Gram$ebnf$2", "symbols": ["Gram$ebnf$2", "Gram$ebnf$2$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, + {"name": "Gram", "symbols": ["Gram$ebnf$1", "Gram$ebnf$2"], "postprocess": ([record, patterns]) => `(gram ${record ? record : ""} ${patterns.filter(nonNull).join(",")})`}, {"name": "Pattern$ebnf$1", "symbols": []}, {"name": "Pattern$ebnf$1$subexpression$1", "symbols": ["_", {"literal":","}, "_", "PatternElement"]}, {"name": "Pattern$ebnf$1", "symbols": ["Pattern$ebnf$1", "Pattern$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Pattern", "symbols": ["PatternElement", "Pattern$ebnf$1"]}, + {"name": "Pattern", "symbols": ["PatternElement", "Pattern$ebnf$1"], "postprocess": ([p1, ps]) => `(pattern ${p1})`}, {"name": "PatternElement$ebnf$1", "symbols": []}, {"name": "PatternElement$ebnf$1$subexpression$1", "symbols": ["Annotation", "_"]}, {"name": "PatternElement$ebnf$1", "symbols": ["PatternElement$ebnf$1", "PatternElement$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "PatternElement$subexpression$1", "symbols": ["Subject"]}, {"name": "PatternElement$subexpression$1", "symbols": ["Path"]}, - {"name": "PatternElement", "symbols": ["PatternElement$ebnf$1", "PatternElement$subexpression$1"]}, + {"name": "PatternElement$subexpression$1", "symbols": ["Reference"]}, + {"name": "PatternElement", "symbols": ["PatternElement$ebnf$1", "PatternElement$subexpression$1"], "postprocess": ([anno, el]) => `${anno.filter(nonNull).join("@")}${el}?`}, {"name": "Subject$ebnf$1", "symbols": ["Association"], "postprocess": id}, {"name": "Subject$ebnf$1", "symbols": [], "postprocess": () => null}, - {"name": "Subject", "symbols": [{"literal":"["}, "_", "Attributes", "_", "Subject$ebnf$1", {"literal":"]"}]}, + {"name": "Subject", "symbols": [{"literal":"["}, "_", "Attributes", "_", "Subject$ebnf$1", {"literal":"]"}], "postprocess": () => `(subject)`}, {"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": ["Labels"], "postprocess": id}, {"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "Association$ebnf$1$subexpression$1$ebnf$2", "symbols": ["Record"], "postprocess": id}, @@ -61,16 +77,10 @@ const grammar: Grammar = { {"name": "Association$ebnf$1$subexpression$1", "symbols": ["Association$ebnf$1$subexpression$1$ebnf$1", "Association$ebnf$1$subexpression$1$ebnf$2", "_", {"literal":"|"}]}, {"name": "Association$ebnf$1", "symbols": ["Association$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "Association$ebnf$1", "symbols": [], "postprocess": () => null}, - {"name": "Association$ebnf$2", "symbols": []}, - {"name": "Association$ebnf$2$subexpression$1", "symbols": ["_", {"literal":","}, "_", "AssociationMember"]}, - {"name": "Association$ebnf$2", "symbols": ["Association$ebnf$2", "Association$ebnf$2$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Association", "symbols": [{"literal":"|"}, "Association$ebnf$1", "_", "AssociationMember", "Association$ebnf$2"]}, - {"name": "AssociationMember$subexpression$1", "symbols": ["PatternElement"]}, - {"name": "AssociationMember$subexpression$1", "symbols": ["Reference"]}, - {"name": "AssociationMember", "symbols": ["AssociationMember$subexpression$1"]}, - {"name": "Reference", "symbols": ["Identity"]}, - {"name": "Path", "symbols": ["Node"]}, - {"name": "Path", "symbols": ["Relationship"]}, + {"name": "Association", "symbols": [{"literal":"|"}, "Association$ebnf$1", "_", "Pattern"]}, + {"name": "Reference", "symbols": ["Identity"], "postprocess": () => `(reference)`}, + {"name": "Path", "symbols": ["Node"], "postprocess": () => `(node)`}, + {"name": "Path", "symbols": ["Relationship"], "postprocess": () => `(relationship)`}, {"name": "Node", "symbols": [{"literal":"("}, "_", "Attributes", "_", {"literal":")"}]}, {"name": "Relationship", "symbols": ["Node", "Arrow", "Path"]}, {"name": "Annotation$subexpression$1$subexpression$1", "symbols": [{"literal":"("}, "Value", {"literal":")"}]}, @@ -131,15 +141,13 @@ const grammar: Grammar = { {"name": "Attributes$ebnf$3", "symbols": ["Record"], "postprocess": id}, {"name": "Attributes$ebnf$3", "symbols": [], "postprocess": () => null}, {"name": "Attributes", "symbols": ["Attributes$ebnf$1", "Attributes$ebnf$2", "Attributes$ebnf$3"]}, - {"name": "Identity", "symbols": ["Value"]}, + {"name": "Identity", "symbols": ["Key"]}, {"name": "Labels$ebnf$1$subexpression$1$subexpression$1", "symbols": ["Define"]}, {"name": "Labels$ebnf$1$subexpression$1$subexpression$1", "symbols": ["Declare"]}, - {"name": "Labels$ebnf$1$subexpression$1$subexpression$1", "symbols": ["Annotate"]}, {"name": "Labels$ebnf$1$subexpression$1", "symbols": ["Labels$ebnf$1$subexpression$1$subexpression$1", "Key"]}, {"name": "Labels$ebnf$1", "symbols": ["Labels$ebnf$1$subexpression$1"]}, {"name": "Labels$ebnf$1$subexpression$2$subexpression$1", "symbols": ["Define"]}, {"name": "Labels$ebnf$1$subexpression$2$subexpression$1", "symbols": ["Declare"]}, - {"name": "Labels$ebnf$1$subexpression$2$subexpression$1", "symbols": ["Annotate"]}, {"name": "Labels$ebnf$1$subexpression$2", "symbols": ["Labels$ebnf$1$subexpression$2$subexpression$1", "Key"]}, {"name": "Labels$ebnf$1", "symbols": ["Labels$ebnf$1", "Labels$ebnf$1$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "Labels", "symbols": ["Labels$ebnf$1"]}, @@ -147,17 +155,17 @@ const grammar: Grammar = { {"name": "Record$ebnf$1", "symbols": []}, {"name": "Record$ebnf$1$subexpression$1", "symbols": [{"literal":","}, "_", "Property"]}, {"name": "Record$ebnf$1", "symbols": ["Record$ebnf$1", "Record$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Record", "symbols": [{"literal":"{"}, "_", "Property", "Record$ebnf$1", {"literal":"}"}]}, + {"name": "Record", "symbols": [{"literal":"{"}, "_", "Property", "Record$ebnf$1", {"literal":"}"}], "postprocess": (d) => `(record ${(d.length > 2) ? d[2] : ""})`}, {"name": "Property$subexpression$1", "symbols": ["Define"]}, {"name": "Property$subexpression$1", "symbols": ["Declare"]}, - {"name": "Property$subexpression$1", "symbols": ["Annotate"]}, - {"name": "Property", "symbols": ["Key", "_", "Property$subexpression$1", "_", "Value"]}, + {"name": "Property", "symbols": ["Key", "_", "Property$subexpression$1", "_", "Value"], "postprocess": ([key, _1, binder, _2, value]) => `(property ${key} ${value})`}, {"name": "Define", "symbols": [{"literal":":"}]}, {"name": "Declare$string$1", "symbols": [{"literal":":"}, {"literal":":"}], "postprocess": (d) => d.join('')}, {"name": "Declare", "symbols": ["Declare$string$1"]}, {"name": "Annotate", "symbols": [{"literal":"@"}]}, {"name": "Key$subexpression$1", "symbols": ["Symbol"]}, {"name": "Key$subexpression$1", "symbols": ["StringLiteral"]}, + {"name": "Key$subexpression$1", "symbols": ["Integer"]}, {"name": "Key", "symbols": ["Key$subexpression$1"]}, {"name": "Value", "symbols": ["Null"]}, {"name": "Value", "symbols": ["Boolean"]}, @@ -181,8 +189,8 @@ const grammar: Grammar = { {"name": "Boolean$string$2", "symbols": [{"literal":"f"}, {"literal":"a"}, {"literal":"l"}, {"literal":"s"}, {"literal":"e"}], "postprocess": (d) => d.join('')}, {"name": "Boolean", "symbols": ["Boolean$string$2"]}, {"name": "Symbol$ebnf$1", "symbols": []}, - {"name": "Symbol$ebnf$1", "symbols": ["Symbol$ebnf$1", /[0-9a-zA-Z_\-]/], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Symbol", "symbols": [/[a-zA-Z_]/, "Symbol$ebnf$1"]}, + {"name": "Symbol$ebnf$1", "symbols": ["Symbol$ebnf$1", /[0-9a-zA-Z_\-@]/], "postprocess": (d) => d[0].concat([d[1]])}, + {"name": "Symbol", "symbols": [/[a-zA-Z_]/, "Symbol$ebnf$1"], "postprocess": (d) => `(symbol)`}, {"name": "Range$string$1", "symbols": [{"literal":"."}, {"literal":"."}], "postprocess": (d) => d.join('')}, {"name": "Range", "symbols": ["NumericLiteral", "Range$string$1", "NumericLiteral"]}, {"name": "Range$string$2", "symbols": [{"literal":"."}, {"literal":"."}, {"literal":"."}], "postprocess": (d) => d.join('')}, @@ -200,24 +208,22 @@ const grammar: Grammar = { {"name": "Integer$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "Integer$ebnf$2", "symbols": [/[0-9]/]}, {"name": "Integer$ebnf$2", "symbols": ["Integer$ebnf$2", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Integer", "symbols": ["Integer$ebnf$1", "Integer$ebnf$2"]}, + {"name": "Integer", "symbols": ["Integer$ebnf$1", "Integer$ebnf$2"], "postprocess": (d) => `(integer)`}, {"name": "Decimal$ebnf$1", "symbols": [{"literal":"-"}], "postprocess": id}, {"name": "Decimal$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "Decimal$ebnf$2", "symbols": [/[0-9]/]}, {"name": "Decimal$ebnf$2", "symbols": ["Decimal$ebnf$2", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": [/[0-9]/]}, - {"name": "Decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": ["Decimal$ebnf$3$subexpression$1$ebnf$1", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Decimal$ebnf$3$subexpression$1", "symbols": [{"literal":"."}, "Decimal$ebnf$3$subexpression$1$ebnf$1"]}, + {"name": "Decimal$subexpression$1$ebnf$1", "symbols": [/[0-9]/]}, + {"name": "Decimal$subexpression$1$ebnf$1", "symbols": ["Decimal$subexpression$1$ebnf$1", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, + {"name": "Decimal$subexpression$1", "symbols": [{"literal":"."}, "Decimal$subexpression$1$ebnf$1"]}, + {"name": "Decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": [/[+-]/], "postprocess": id}, + {"name": "Decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null}, + {"name": "Decimal$ebnf$3$subexpression$1$ebnf$2", "symbols": [/[0-9]/]}, + {"name": "Decimal$ebnf$3$subexpression$1$ebnf$2", "symbols": ["Decimal$ebnf$3$subexpression$1$ebnf$2", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, + {"name": "Decimal$ebnf$3$subexpression$1", "symbols": [/[eE]/, "Decimal$ebnf$3$subexpression$1$ebnf$1", "Decimal$ebnf$3$subexpression$1$ebnf$2"]}, {"name": "Decimal$ebnf$3", "symbols": ["Decimal$ebnf$3$subexpression$1"], "postprocess": id}, {"name": "Decimal$ebnf$3", "symbols": [], "postprocess": () => null}, - {"name": "Decimal$ebnf$4$subexpression$1$ebnf$1", "symbols": [/[+-]/], "postprocess": id}, - {"name": "Decimal$ebnf$4$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null}, - {"name": "Decimal$ebnf$4$subexpression$1$ebnf$2", "symbols": [/[0-9]/]}, - {"name": "Decimal$ebnf$4$subexpression$1$ebnf$2", "symbols": ["Decimal$ebnf$4$subexpression$1$ebnf$2", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "Decimal$ebnf$4$subexpression$1", "symbols": [/[eE]/, "Decimal$ebnf$4$subexpression$1$ebnf$1", "Decimal$ebnf$4$subexpression$1$ebnf$2"]}, - {"name": "Decimal$ebnf$4", "symbols": ["Decimal$ebnf$4$subexpression$1"], "postprocess": id}, - {"name": "Decimal$ebnf$4", "symbols": [], "postprocess": () => null}, - {"name": "Decimal", "symbols": ["Decimal$ebnf$1", "Decimal$ebnf$2", "Decimal$ebnf$3", "Decimal$ebnf$4"]}, + {"name": "Decimal", "symbols": ["Decimal$ebnf$1", "Decimal$ebnf$2", "Decimal$subexpression$1", "Decimal$ebnf$3"], "postprocess": (d) => `(decimal)`}, {"name": "Hexadecimal$ebnf$1", "symbols": [{"literal":"-"}], "postprocess": id}, {"name": "Hexadecimal$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "Hexadecimal$string$1", "symbols": [{"literal":"0"}, {"literal":"x"}], "postprocess": (d) => d.join('')}, @@ -229,8 +235,8 @@ const grammar: Grammar = { {"name": "Octal$ebnf$2", "symbols": [/[0-7]/]}, {"name": "Octal$ebnf$2", "symbols": ["Octal$ebnf$2", /[0-7]/], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "Octal", "symbols": ["Octal$ebnf$1", {"literal":"0"}, "Octal$ebnf$2"]}, - {"name": "Measurement", "symbols": ["Decimal", "Symbol"]}, - {"name": "Percentage", "symbols": ["Decimal", {"literal":"%"}]}, + {"name": "Measurement", "symbols": ["NumericLiteral", "Symbol"]}, + {"name": "Percentage", "symbols": ["NumericLiteral", {"literal":"%"}]}, {"name": "StringLiteral", "symbols": ["DoubleQuotedLiteral"]}, {"name": "StringLiteral", "symbols": ["SingleQuotedLiteral"]}, {"name": "StringLiteral", "symbols": ["BacktickStringLiteral"]}, @@ -264,10 +270,10 @@ const grammar: Grammar = { {"name": "EscapedChars", "symbols": [{"literal":"u"}, /[a-fA-F0-9]/, /[a-fA-F0-9]/, /[a-fA-F0-9]/, /[a-fA-F0-9]/]}, {"name": "_$ebnf$1", "symbols": []}, {"name": "_$ebnf$1", "symbols": ["_$ebnf$1", "wschar"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "_", "symbols": ["_$ebnf$1"]}, + {"name": "_", "symbols": ["_$ebnf$1"], "postprocess": nothing}, {"name": "__$ebnf$1", "symbols": ["wschar"]}, {"name": "__$ebnf$1", "symbols": ["__$ebnf$1", "wschar"], "postprocess": (d) => d[0].concat([d[1]])}, - {"name": "__", "symbols": ["__$ebnf$1"]}, + {"name": "__", "symbols": ["__$ebnf$1"], "postprocess": nothing}, {"name": "wschar", "symbols": [/[ \t\n\v\f]/]} ], ParserStart: "Gram", diff --git a/src/lib/gram-global-record.spec.ts b/src/lib/gram-global-record.spec.ts index a3cc4aa..d206058 100644 --- a/src/lib/gram-global-record.spec.ts +++ b/src/lib/gram-global-record.spec.ts @@ -1,8 +1,15 @@ -import * as Effect from "effect/Micro" -import * as Either from "effect/Either" + +import { Effect, Either, Exit, Cause } from "effect" import { parse } from './nearley-gram'; +import { Parser } from "nearley"; +const debugExit = (x:Exit.Exit) => Exit.match(x, + { + onSuccess: (success) => JSON.stringify(success.results), + onFailure: (error) => Cause.pretty(error) + } +) describe('global record', () => { test.each([ @@ -28,7 +35,8 @@ describe('global record', () => { ('can define values like %s, which is %s', async (gram, description) => { const task = parse(gram); const result = await Effect.runPromiseExit(task) - expect(Either.isRight(result)).toBeTruthy(); + if (Exit.isFailure(result)) console.error(debugExit(result)) + expect(Exit.isSuccess(result)).toBeTruthy(); }) test.each([ @@ -38,13 +46,15 @@ describe('global record', () => { ('can define multiple values like: %s', async (gram) => { const task = parse(gram); const result = await Effect.runPromiseExit(task) - expect(Either.isRight(result)).toBeTruthy(); + if (Exit.isFailure(result)) console.error(debugExit(result)) + expect(Exit.isSuccess(result)).toBeTruthy(); }) - it('cannot appear twice', async () => { - const gram = `{k:1} {k:2}`; + it('can not appear twice', async () => { + const gram = `{k:1} {k:2} {k:3} {k:4}`; const task = parse(gram); const result = await Effect.runPromiseExit(task) - expect(Either.isLeft(result)).toBeTruthy(); + if (Exit.isSuccess(result)) console.error(debugExit(result)) + expect(Exit.isFailure(result)).toBeTruthy(); }) @@ -54,6 +64,6 @@ describe('global record', () => { ('can declare multiple keys like: %s', async (gram) => { const task = parse(gram); const result = await Effect.runPromiseExit(task) - expect(Either.isRight(result)).toBeTruthy(); + expect(Exit.isSuccess(result)).toBeTruthy(); }) }) diff --git a/src/lib/gram-nodes.spec.ts b/src/lib/gram-nodes.spec.ts index afaffd1..69236a1 100644 --- a/src/lib/gram-nodes.spec.ts +++ b/src/lib/gram-nodes.spec.ts @@ -29,7 +29,6 @@ describe('node identifiers', () => { '(a-b-k)', '("a sentence of words")', '(1)', - '(0xBE)', ]) ('can be: %s', async (gram) => { const task = parse(gram); @@ -39,6 +38,9 @@ describe('node identifiers', () => { test.each([ '(-)', '(*)', + '(@abk)', + '(@@metabk)', + '(0xBE)', ]) ('can not be: %s', async (gram) => { const task = parse(gram); @@ -53,7 +55,8 @@ describe('node labels', () => { '(ab:Aye:Bee)', '(a:"A few words with whitespace")', "(a:'Words within single quotes')", - "(a:`Words within backticks`)" + "(a:`Words within backticks`)", + '(a:1)', ]) ('can be Symbols like: %s', async (gram) => { const task = parse(gram); @@ -82,7 +85,6 @@ describe('node labels', () => { test.each([ '(a:)', - '(a:1)', `(a:0x1337)` ]) ('can not be things like: %s', async (gram) => {