functionalscript 0.32.4 → 0.34.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.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/fs/asserts/module.f.d.ts +1 -1
  3. package/fs/asserts/module.f.js +4 -1
  4. package/fs/bnf/data/module.f.d.ts +0 -103
  5. package/fs/bnf/data/module.f.js +10 -246
  6. package/fs/bnf/data/proof.f.d.ts +0 -7
  7. package/fs/bnf/data/proof.f.js +3 -636
  8. package/fs/bnf/descent/module.f.d.ts +56 -0
  9. package/fs/bnf/descent/module.f.js +119 -0
  10. package/fs/bnf/descent/proof.f.d.ts +5 -0
  11. package/fs/bnf/descent/proof.f.js +296 -0
  12. package/fs/bnf/ll1/module.f.d.ts +72 -0
  13. package/fs/bnf/ll1/module.f.js +153 -0
  14. package/fs/bnf/ll1/proof.f.d.ts +9 -0
  15. package/fs/bnf/ll1/proof.f.js +358 -0
  16. package/fs/cas/cli/module.f.d.ts +6 -0
  17. package/fs/cas/cli/module.f.js +56 -0
  18. package/fs/cas/cli/proof.f.d.ts +14 -0
  19. package/fs/cas/cli/proof.f.js +149 -0
  20. package/fs/cas/mcp/module.f.d.ts +9 -17
  21. package/fs/cas/mcp/module.f.js +117 -83
  22. package/fs/cas/mcp/proof.f.d.ts +5 -1
  23. package/fs/cas/mcp/proof.f.js +79 -32
  24. package/fs/cas/module.f.d.ts +33 -27
  25. package/fs/cas/module.f.js +151 -126
  26. package/fs/cas/proof.f.d.ts +16 -13
  27. package/fs/cas/proof.f.js +255 -130
  28. package/fs/ci/config/module.f.d.ts +15 -15
  29. package/fs/ci/config/module.f.js +15 -15
  30. package/fs/ci/proof.f.js +8 -6
  31. package/fs/cli/proof.f.js +2 -12
  32. package/fs/djs/parser/module.f.d.ts +0 -5
  33. package/fs/djs/proof.f.js +5 -6
  34. package/fs/djs/serializer/module.f.d.ts +1 -3
  35. package/fs/djs/tokenizer-new/module.f.js +3 -2
  36. package/fs/djs/tokenizer-new/proof.f.d.ts +3 -0
  37. package/fs/djs/tokenizer-new/proof.f.js +458 -296
  38. package/fs/djs/transpiler/proof.f.js +10 -10
  39. package/fs/effects/list/module.f.d.ts +31 -0
  40. package/fs/effects/list/module.f.js +16 -0
  41. package/fs/effects/module.f.d.ts +11 -5
  42. package/fs/effects/module.f.js +16 -6
  43. package/fs/effects/node/module.f.d.ts +29 -3
  44. package/fs/effects/node/module.f.js +35 -1
  45. package/fs/effects/node/module.js +32 -18
  46. package/fs/effects/node/proof.f.js +36 -36
  47. package/fs/effects/node/virtual/module.f.d.ts +16 -2
  48. package/fs/effects/node/virtual/module.f.js +129 -20
  49. package/fs/effects/node/virtual/proof.f.d.ts +4 -0
  50. package/fs/effects/node/virtual/proof.f.js +47 -14
  51. package/fs/effects/proof.f.d.ts +4 -0
  52. package/fs/effects/proof.f.js +18 -1
  53. package/fs/emergent_testing/proof.f.js +3 -11
  54. package/fs/fjs/module.f.js +2 -8
  55. package/fs/fjs/proof.f.js +2 -11
  56. package/fs/html/module.f.js +6 -8
  57. package/fs/js/tokenizer/module.f.d.ts +5 -0
  58. package/fs/js/tokenizer/module.f.js +13 -0
  59. package/fs/json/serializer/module.f.js +0 -1
  60. package/fs/mcp/module.f.d.ts +1 -1
  61. package/fs/mime/module.f.d.ts +101 -5
  62. package/fs/mime/module.f.js +159 -6
  63. package/fs/mime/proof.f.d.ts +25 -0
  64. package/fs/mime/proof.f.js +193 -3
  65. package/fs/text/code_point/module.f.d.ts +39 -2
  66. package/fs/text/code_point/module.f.js +74 -2
  67. package/fs/text/code_point/proof.f.d.ts +8 -0
  68. package/fs/text/code_point/proof.f.js +72 -0
  69. package/fs/text/sgr/proof.f.js +2 -11
  70. package/fs/text/utf16/module.f.js +4 -26
  71. package/fs/text/utf8/module.f.d.ts +27 -0
  72. package/fs/text/utf8/module.f.js +8 -14
  73. package/fs/types/bigint/module.f.d.ts +8 -15
  74. package/fs/types/bigint/module.f.js +9 -22
  75. package/fs/types/bigint/proof.f.d.ts +0 -2
  76. package/fs/types/bigint/proof.f.js +6 -16
  77. package/fs/types/function/operator/module.f.d.ts +26 -0
  78. package/fs/types/list/module.f.d.ts +3 -0
  79. package/fs/types/result/module.d.ts +2 -4
  80. package/fs/types/result/module.js +9 -3
  81. package/package.json +3 -3
  82. package/issues/demo/data/data.f.js +0 -12
  83. package/issues/demo/data/shared.f.js +0 -3
  84. package/issues/demo/fs/app.js +0 -4
  85. package/issues/demo/fs/math.f.js +0 -4
  86. package/issues/demo/sample/proof.f.js +0 -13
  87. /package/{issues → todo}/031-json.f.d.ts +0 -0
  88. /package/{issues → todo}/031-json.f.js +0 -0
  89. /package/{issues → todo}/proof.f.d.ts +0 -0
  90. /package/{issues → todo}/proof.f.js +0 -0
@@ -6,13 +6,8 @@
6
6
  import { type Result } from '../../types/result/module.f.ts';
7
7
  import { type List } from '../../types/list/module.f.ts';
8
8
  import type { DjsTokenWithMetadata } from '../tokenizer/module.f.ts';
9
- import { type OrderedMap } from '../../types/ordered_map/module.f.ts';
10
9
  import type { AstModule } from '../ast/module.f.ts';
11
10
  import type { TokenMetadata } from '../../js/tokenizer/module.f.ts';
12
- export type ParseContext = {
13
- readonly complete: OrderedMap<Result<AstModule, string>>;
14
- readonly stack: List<string>;
15
- };
16
11
  export type ParseError = {
17
12
  readonly message: string;
18
13
  readonly metadata: TokenMetadata | null;
package/fs/djs/proof.f.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import { compile } from "./module.f.js";
2
2
  import { virtual, emptyState } from "../effects/node/virtual/module.f.js";
3
- import { isVec } from "../types/bit_vec/module.f.js";
4
3
  import { utf8, utf8ToString } from "../text/module.f.js";
5
4
  const readOutput = (root, path) => {
6
5
  const file = root[path];
7
- if (!isVec(file)) {
6
+ if (!Array.isArray(file) || file.length === 0) {
8
7
  throw `${path} is not a file`;
9
8
  }
10
- return utf8ToString(file);
9
+ return utf8ToString(file[0]);
11
10
  };
12
11
  export const proof = {
13
12
  tooFewArgs: {
@@ -31,7 +30,7 @@ export const proof = {
31
30
  },
32
31
  },
33
32
  success: () => {
34
- const root = { 'input.f.js': utf8('export default 42') };
33
+ const root = { 'input.f.js': [utf8('export default 42')] };
35
34
  const [state, code] = virtual({ ...emptyState, root })(compile(['input.f.js', 'output.f.js']));
36
35
  if (code !== 0) {
37
36
  throw code;
@@ -42,7 +41,7 @@ export const proof = {
42
41
  }
43
42
  },
44
43
  jsonOutput: () => {
45
- const root = { 'input.f.js': utf8('export default 42') };
44
+ const root = { 'input.f.js': [utf8('export default 42')] };
46
45
  const [state, code] = virtual({ ...emptyState, root })(compile(['input.f.js', 'output.json']));
47
46
  if (code !== 0) {
48
47
  throw code;
@@ -62,7 +61,7 @@ export const proof = {
62
61
  }
63
62
  },
64
63
  parseError: () => {
65
- const root = { 'bad.f.js': utf8('export default @') };
64
+ const root = { 'bad.f.js': [utf8('export default @')] };
66
65
  const [state, code] = virtual({ ...emptyState, root })(compile(['bad.f.js', 'output.f.js']));
67
66
  if (code !== 0) {
68
67
  throw code;
@@ -8,9 +8,7 @@ import type { Entry as ObjectEntry } from '../../types/object/module.f.ts';
8
8
  import { type List } from '../../types/list/module.f.ts';
9
9
  export declare const undefinedSerialize: string[];
10
10
  type RefCounter = readonly [number, number];
11
- type Entry = ObjectEntry<Unknown>;
12
- type Entries = List<Entry>;
13
- type MapEntries = (entries: Entries) => Entries;
11
+ type MapEntries = (entries: List<ObjectEntry<Unknown>>) => List<ObjectEntry<Unknown>>;
14
12
  type Refs = ReadonlyMap<Unknown, RefCounter>;
15
13
  export declare const serializeWithoutConst: (mapEntries: MapEntries) => (value: Unknown) => List<string>;
16
14
  export declare const stringify: (sort: MapEntries) => (djs: Unknown) => string;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { descentParser } from "../../bnf/data/module.f.js";
6
+ import { descentParser } from "../../bnf/descent/module.f.js";
7
7
  import { eof, join0Plus, max, none, not, notSet, oneEncode, option, range, remove, repeat, repeat0Plus, repeat1Plus, set, unicodeRange } from "../../bnf/module.f.js";
8
8
  import { todo } from "../../asserts/module.f.js";
9
9
  export const parse = (input) => {
@@ -20,7 +20,8 @@ export const jsGrammar = () => {
20
20
  escape: [
21
21
  '\\',
22
22
  {
23
- ...set('"\\/bfnrt'),
23
+ ...set('"\\bfnrt'),
24
+ solidus: '/',
24
25
  u: [
25
26
  'u',
26
27
  ...repeat(4)({
@@ -3,6 +3,9 @@ export declare const proof: {
3
3
  tokenizer: (() => void)[];
4
4
  djs: (() => void)[];
5
5
  operators: (() => void)[];
6
+ ws: (() => void)[];
7
+ id: (() => void)[];
8
+ keywords: (() => void)[];
6
9
  throw: {
7
10
  parse: () => void;
8
11
  };