goscript 0.0.26 → 0.0.28

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 (168) hide show
  1. package/README.md +4 -4
  2. package/cmd/goscript/cmd_compile.go +0 -3
  3. package/cmd/goscript/deps.go +11 -0
  4. package/compiler/analysis.go +259 -55
  5. package/compiler/assignment.go +2 -2
  6. package/compiler/builtin_test.go +1 -1
  7. package/compiler/compiler.go +200 -68
  8. package/compiler/compiler_test.go +17 -24
  9. package/compiler/composite-lit.go +32 -8
  10. package/compiler/decl.go +6 -6
  11. package/compiler/expr-call.go +83 -0
  12. package/compiler/expr.go +1 -1
  13. package/compiler/protobuf.go +557 -0
  14. package/compiler/spec-struct.go +4 -0
  15. package/compiler/spec-value.go +10 -2
  16. package/compiler/spec.go +18 -1
  17. package/compiler/stmt-assign.go +35 -0
  18. package/compiler/type-assert.go +87 -0
  19. package/compiler/type.go +4 -1
  20. package/dist/gs/builtin/builtin.d.ts +19 -1
  21. package/dist/gs/builtin/builtin.js +84 -4
  22. package/dist/gs/builtin/builtin.js.map +1 -1
  23. package/dist/gs/builtin/slice.d.ts +1 -1
  24. package/dist/gs/builtin/slice.js +21 -2
  25. package/dist/gs/builtin/slice.js.map +1 -1
  26. package/dist/gs/errors/errors.d.ts +5 -6
  27. package/dist/gs/errors/errors.js.map +1 -1
  28. package/dist/gs/io/index.d.ts +1 -0
  29. package/dist/gs/io/index.js +2 -0
  30. package/dist/gs/io/index.js.map +1 -0
  31. package/dist/gs/io/io.d.ts +107 -0
  32. package/dist/gs/io/io.js +385 -0
  33. package/dist/gs/io/io.js.map +1 -0
  34. package/dist/gs/strings/builder.d.ts +18 -0
  35. package/dist/gs/strings/builder.js +205 -0
  36. package/dist/gs/strings/builder.js.map +1 -0
  37. package/dist/gs/strings/clone.d.ts +1 -0
  38. package/dist/gs/strings/clone.js +16 -0
  39. package/dist/gs/strings/clone.js.map +1 -0
  40. package/dist/gs/strings/compare.d.ts +1 -0
  41. package/dist/gs/strings/compare.js +14 -0
  42. package/dist/gs/strings/compare.js.map +1 -0
  43. package/dist/gs/strings/index.d.ts +2 -0
  44. package/dist/gs/strings/index.js +3 -0
  45. package/dist/gs/strings/index.js.map +1 -0
  46. package/dist/gs/strings/iter.d.ts +8 -0
  47. package/dist/gs/strings/iter.js +160 -0
  48. package/dist/gs/strings/iter.js.map +1 -0
  49. package/dist/gs/strings/reader.d.ts +34 -0
  50. package/dist/gs/strings/reader.js +418 -0
  51. package/dist/gs/strings/reader.js.map +1 -0
  52. package/dist/gs/strings/replace.d.ts +106 -0
  53. package/dist/gs/strings/replace.js +1136 -0
  54. package/dist/gs/strings/replace.js.map +1 -0
  55. package/dist/gs/strings/search.d.ts +24 -0
  56. package/dist/gs/strings/search.js +169 -0
  57. package/dist/gs/strings/search.js.map +1 -0
  58. package/dist/gs/strings/strings.d.ts +47 -0
  59. package/dist/gs/strings/strings.js +418 -0
  60. package/dist/gs/strings/strings.js.map +1 -0
  61. package/dist/gs/stringslite/index.d.ts +1 -0
  62. package/dist/gs/stringslite/index.js +2 -0
  63. package/dist/gs/stringslite/index.js.map +1 -0
  64. package/dist/gs/stringslite/strings.d.ts +11 -0
  65. package/dist/gs/stringslite/strings.js +67 -0
  66. package/dist/gs/stringslite/strings.js.map +1 -0
  67. package/dist/gs/sync/index.d.ts +1 -0
  68. package/dist/gs/sync/index.js +2 -0
  69. package/dist/gs/sync/index.js.map +1 -0
  70. package/dist/gs/sync/sync.d.ts +79 -0
  71. package/dist/gs/sync/sync.js +392 -0
  72. package/dist/gs/sync/sync.js.map +1 -0
  73. package/dist/gs/unicode/index.d.ts +1 -0
  74. package/dist/gs/unicode/index.js +2 -0
  75. package/dist/gs/unicode/index.js.map +1 -0
  76. package/dist/gs/unicode/unicode.d.ts +105 -0
  77. package/dist/gs/unicode/unicode.js +332 -0
  78. package/dist/gs/unicode/unicode.js.map +1 -0
  79. package/dist/gs/unicode/utf8/index.d.ts +1 -0
  80. package/dist/gs/unicode/utf8/index.js +3 -0
  81. package/dist/gs/unicode/utf8/index.js.map +1 -0
  82. package/dist/gs/unicode/utf8/utf8.d.ts +20 -0
  83. package/dist/gs/unicode/utf8/utf8.js +196 -0
  84. package/dist/gs/unicode/utf8/utf8.js.map +1 -0
  85. package/dist/gs/unsafe/index.d.ts +1 -0
  86. package/dist/gs/unsafe/index.js +2 -0
  87. package/dist/gs/unsafe/index.js.map +1 -0
  88. package/dist/gs/unsafe/unsafe.d.ts +11 -0
  89. package/dist/gs/unsafe/unsafe.js +44 -0
  90. package/dist/gs/unsafe/unsafe.js.map +1 -0
  91. package/go.mod +2 -1
  92. package/go.sum +6 -2
  93. package/gs/README.md +6 -0
  94. package/gs/builtin/builtin.ts +158 -0
  95. package/gs/builtin/channel.ts +683 -0
  96. package/gs/builtin/defer.ts +58 -0
  97. package/gs/builtin/index.ts +1 -0
  98. package/gs/builtin/io.ts +22 -0
  99. package/gs/builtin/map.ts +50 -0
  100. package/gs/builtin/slice.ts +1030 -0
  101. package/gs/builtin/type.ts +1106 -0
  102. package/gs/builtin/varRef.ts +25 -0
  103. package/gs/cmp/godoc.txt +8 -0
  104. package/gs/cmp/index.ts +29 -0
  105. package/gs/context/context.ts +401 -0
  106. package/gs/context/godoc.txt +69 -0
  107. package/gs/context/index.ts +1 -0
  108. package/gs/errors/errors.ts +223 -0
  109. package/gs/errors/godoc.txt +63 -0
  110. package/gs/errors/index.ts +1 -0
  111. package/gs/internal/goarch/godoc.txt +39 -0
  112. package/gs/internal/goarch/index.ts +18 -0
  113. package/gs/io/godoc.txt +61 -0
  114. package/gs/io/index.ts +1 -0
  115. package/gs/io/io.go +75 -0
  116. package/gs/io/io.ts +546 -0
  117. package/gs/iter/godoc.txt +203 -0
  118. package/gs/iter/index.ts +1 -0
  119. package/gs/iter/iter.ts +117 -0
  120. package/gs/math/bits/index.ts +356 -0
  121. package/gs/math/godoc.txt +76 -0
  122. package/gs/runtime/godoc.txt +331 -0
  123. package/gs/runtime/index.ts +1 -0
  124. package/gs/runtime/runtime.ts +178 -0
  125. package/gs/slices/godoc.txt +44 -0
  126. package/gs/slices/index.ts +1 -0
  127. package/gs/slices/slices.ts +22 -0
  128. package/gs/strings/builder.test.ts +121 -0
  129. package/gs/strings/builder.ts +223 -0
  130. package/gs/strings/clone.test.ts +43 -0
  131. package/gs/strings/clone.ts +17 -0
  132. package/gs/strings/compare.test.ts +84 -0
  133. package/gs/strings/compare.ts +13 -0
  134. package/gs/strings/godoc.txt +66 -0
  135. package/gs/strings/index.ts +2 -0
  136. package/gs/strings/iter.test.ts +343 -0
  137. package/gs/strings/iter.ts +171 -0
  138. package/gs/strings/reader.test.ts +243 -0
  139. package/gs/strings/reader.ts +451 -0
  140. package/gs/strings/replace.test.ts +181 -0
  141. package/gs/strings/replace.ts +1310 -0
  142. package/gs/strings/search.test.ts +214 -0
  143. package/gs/strings/search.ts +213 -0
  144. package/gs/strings/strings.test.ts +477 -0
  145. package/gs/strings/strings.ts +510 -0
  146. package/gs/stringslite/godoc.txt +17 -0
  147. package/gs/stringslite/index.ts +1 -0
  148. package/gs/stringslite/strings.ts +82 -0
  149. package/gs/sync/godoc.txt +21 -0
  150. package/gs/sync/index.ts +1 -0
  151. package/gs/sync/sync.go +64 -0
  152. package/gs/sync/sync.ts +449 -0
  153. package/gs/time/godoc.md +116 -0
  154. package/gs/time/godoc.txt +116 -0
  155. package/gs/time/index.ts +1 -0
  156. package/gs/time/time.ts +272 -0
  157. package/gs/unicode/godoc.txt +52 -0
  158. package/gs/unicode/index.ts +1 -0
  159. package/gs/unicode/unicode.go +38 -0
  160. package/gs/unicode/unicode.ts +418 -0
  161. package/gs/unicode/utf8/godoc.txt +22 -0
  162. package/gs/unicode/utf8/index.ts +2 -0
  163. package/gs/unicode/utf8/utf8.ts +227 -0
  164. package/gs/unsafe/godoc.txt +19 -0
  165. package/gs/unsafe/index.ts +1 -0
  166. package/gs/unsafe/unsafe.test.ts +68 -0
  167. package/gs/unsafe/unsafe.ts +77 -0
  168. package/package.json +4 -3
@@ -0,0 +1,106 @@
1
+ import * as $ from '@goscript/builtin/builtin.js';
2
+ import { stringFinder } from './search.js';
3
+ import * as io from '@goscript/io/index.js';
4
+ export declare class Replacer {
5
+ get built(): boolean;
6
+ set built(value: boolean);
7
+ get r(): replacer;
8
+ set r(value: replacer);
9
+ get oldnew(): $.Slice<string>;
10
+ set oldnew(value: $.Slice<string>);
11
+ _fields: {
12
+ built: $.VarRef<boolean>;
13
+ r: $.VarRef<replacer>;
14
+ oldnew: $.VarRef<$.Slice<string>>;
15
+ };
16
+ constructor(init?: Partial<{
17
+ oldnew?: $.Slice<string>;
18
+ built?: boolean;
19
+ r?: replacer;
20
+ }>);
21
+ clone(): Replacer;
22
+ buildOnce(): void;
23
+ build(): replacer;
24
+ Replace(s: string): string;
25
+ WriteString(w: io.Writer, s: string): [number, $.GoError];
26
+ static __typeInfo: $.StructTypeInfo;
27
+ }
28
+ type replacer = null | {
29
+ Replace(s: string): string;
30
+ WriteString(w: io.Writer, s: string): [number, $.GoError];
31
+ };
32
+ export declare function NewReplacer(...oldnew: string[]): Replacer | null;
33
+ declare class trieNode {
34
+ get value(): string;
35
+ set value(value: string);
36
+ get priority(): number;
37
+ set priority(value: number);
38
+ get prefix(): string;
39
+ set prefix(value: string);
40
+ get next(): trieNode | null;
41
+ set next(value: trieNode | null);
42
+ get table(): $.Slice<trieNode | null>;
43
+ set table(value: $.Slice<trieNode | null>);
44
+ _fields: {
45
+ value: $.VarRef<string>;
46
+ priority: $.VarRef<number>;
47
+ prefix: $.VarRef<string>;
48
+ next: $.VarRef<trieNode | null>;
49
+ table: $.VarRef<$.Slice<trieNode | null>>;
50
+ };
51
+ constructor(init?: Partial<{
52
+ next?: trieNode | null;
53
+ prefix?: string;
54
+ priority?: number;
55
+ table?: $.Slice<trieNode | null>;
56
+ value?: string;
57
+ }>);
58
+ clone(): trieNode;
59
+ add(key: string, val: string, priority: number, r: genericReplacer | null): void;
60
+ static __typeInfo: $.StructTypeInfo;
61
+ }
62
+ declare class genericReplacer {
63
+ get root(): trieNode;
64
+ set root(value: trieNode);
65
+ get tableSize(): number;
66
+ set tableSize(value: number);
67
+ get mapping(): number[];
68
+ set mapping(value: number[]);
69
+ _fields: {
70
+ root: $.VarRef<trieNode>;
71
+ tableSize: $.VarRef<number>;
72
+ mapping: $.VarRef<number[]>;
73
+ };
74
+ constructor(init?: Partial<{
75
+ mapping?: number[];
76
+ root?: trieNode;
77
+ tableSize?: number;
78
+ }>);
79
+ clone(): genericReplacer;
80
+ lookup(s: string, ignoreRoot: boolean): [string, number, boolean];
81
+ Replace(s: string): string;
82
+ WriteString(w: io.Writer, s: string): [number, $.GoError];
83
+ static __typeInfo: $.StructTypeInfo;
84
+ }
85
+ export declare function makeGenericReplacer(oldnew: $.Slice<string>): genericReplacer | null;
86
+ export declare function getStringWriter(w: io.Writer): io.StringWriter;
87
+ declare class singleStringReplacer {
88
+ get finder(): stringFinder | null;
89
+ set finder(value: stringFinder | null);
90
+ get value(): string;
91
+ set value(value: string);
92
+ _fields: {
93
+ finder: $.VarRef<stringFinder | null>;
94
+ value: $.VarRef<string>;
95
+ };
96
+ constructor(init?: Partial<{
97
+ finder?: stringFinder | null;
98
+ value?: string;
99
+ }>);
100
+ clone(): singleStringReplacer;
101
+ Replace(s: string): string;
102
+ WriteString(w: io.Writer, s: string): [number, $.GoError];
103
+ static __typeInfo: $.StructTypeInfo;
104
+ }
105
+ export declare function makeSingleStringReplacer(pattern: string, value: string): singleStringReplacer | null;
106
+ export {};