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.
- package/README.md +4 -4
- package/cmd/goscript/cmd_compile.go +0 -3
- package/cmd/goscript/deps.go +11 -0
- package/compiler/analysis.go +259 -55
- package/compiler/assignment.go +2 -2
- package/compiler/builtin_test.go +1 -1
- package/compiler/compiler.go +200 -68
- package/compiler/compiler_test.go +17 -24
- package/compiler/composite-lit.go +32 -8
- package/compiler/decl.go +6 -6
- package/compiler/expr-call.go +83 -0
- package/compiler/expr.go +1 -1
- package/compiler/protobuf.go +557 -0
- package/compiler/spec-struct.go +4 -0
- package/compiler/spec-value.go +10 -2
- package/compiler/spec.go +18 -1
- package/compiler/stmt-assign.go +35 -0
- package/compiler/type-assert.go +87 -0
- package/compiler/type.go +4 -1
- package/dist/gs/builtin/builtin.d.ts +19 -1
- package/dist/gs/builtin/builtin.js +84 -4
- package/dist/gs/builtin/builtin.js.map +1 -1
- package/dist/gs/builtin/slice.d.ts +1 -1
- package/dist/gs/builtin/slice.js +21 -2
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/errors/errors.d.ts +5 -6
- package/dist/gs/errors/errors.js.map +1 -1
- package/dist/gs/io/index.d.ts +1 -0
- package/dist/gs/io/index.js +2 -0
- package/dist/gs/io/index.js.map +1 -0
- package/dist/gs/io/io.d.ts +107 -0
- package/dist/gs/io/io.js +385 -0
- package/dist/gs/io/io.js.map +1 -0
- package/dist/gs/strings/builder.d.ts +18 -0
- package/dist/gs/strings/builder.js +205 -0
- package/dist/gs/strings/builder.js.map +1 -0
- package/dist/gs/strings/clone.d.ts +1 -0
- package/dist/gs/strings/clone.js +16 -0
- package/dist/gs/strings/clone.js.map +1 -0
- package/dist/gs/strings/compare.d.ts +1 -0
- package/dist/gs/strings/compare.js +14 -0
- package/dist/gs/strings/compare.js.map +1 -0
- package/dist/gs/strings/index.d.ts +2 -0
- package/dist/gs/strings/index.js +3 -0
- package/dist/gs/strings/index.js.map +1 -0
- package/dist/gs/strings/iter.d.ts +8 -0
- package/dist/gs/strings/iter.js +160 -0
- package/dist/gs/strings/iter.js.map +1 -0
- package/dist/gs/strings/reader.d.ts +34 -0
- package/dist/gs/strings/reader.js +418 -0
- package/dist/gs/strings/reader.js.map +1 -0
- package/dist/gs/strings/replace.d.ts +106 -0
- package/dist/gs/strings/replace.js +1136 -0
- package/dist/gs/strings/replace.js.map +1 -0
- package/dist/gs/strings/search.d.ts +24 -0
- package/dist/gs/strings/search.js +169 -0
- package/dist/gs/strings/search.js.map +1 -0
- package/dist/gs/strings/strings.d.ts +47 -0
- package/dist/gs/strings/strings.js +418 -0
- package/dist/gs/strings/strings.js.map +1 -0
- package/dist/gs/stringslite/index.d.ts +1 -0
- package/dist/gs/stringslite/index.js +2 -0
- package/dist/gs/stringslite/index.js.map +1 -0
- package/dist/gs/stringslite/strings.d.ts +11 -0
- package/dist/gs/stringslite/strings.js +67 -0
- package/dist/gs/stringslite/strings.js.map +1 -0
- package/dist/gs/sync/index.d.ts +1 -0
- package/dist/gs/sync/index.js +2 -0
- package/dist/gs/sync/index.js.map +1 -0
- package/dist/gs/sync/sync.d.ts +79 -0
- package/dist/gs/sync/sync.js +392 -0
- package/dist/gs/sync/sync.js.map +1 -0
- package/dist/gs/unicode/index.d.ts +1 -0
- package/dist/gs/unicode/index.js +2 -0
- package/dist/gs/unicode/index.js.map +1 -0
- package/dist/gs/unicode/unicode.d.ts +105 -0
- package/dist/gs/unicode/unicode.js +332 -0
- package/dist/gs/unicode/unicode.js.map +1 -0
- package/dist/gs/unicode/utf8/index.d.ts +1 -0
- package/dist/gs/unicode/utf8/index.js +3 -0
- package/dist/gs/unicode/utf8/index.js.map +1 -0
- package/dist/gs/unicode/utf8/utf8.d.ts +20 -0
- package/dist/gs/unicode/utf8/utf8.js +196 -0
- package/dist/gs/unicode/utf8/utf8.js.map +1 -0
- package/dist/gs/unsafe/index.d.ts +1 -0
- package/dist/gs/unsafe/index.js +2 -0
- package/dist/gs/unsafe/index.js.map +1 -0
- package/dist/gs/unsafe/unsafe.d.ts +11 -0
- package/dist/gs/unsafe/unsafe.js +44 -0
- package/dist/gs/unsafe/unsafe.js.map +1 -0
- package/go.mod +2 -1
- package/go.sum +6 -2
- package/gs/README.md +6 -0
- package/gs/builtin/builtin.ts +158 -0
- package/gs/builtin/channel.ts +683 -0
- package/gs/builtin/defer.ts +58 -0
- package/gs/builtin/index.ts +1 -0
- package/gs/builtin/io.ts +22 -0
- package/gs/builtin/map.ts +50 -0
- package/gs/builtin/slice.ts +1030 -0
- package/gs/builtin/type.ts +1106 -0
- package/gs/builtin/varRef.ts +25 -0
- package/gs/cmp/godoc.txt +8 -0
- package/gs/cmp/index.ts +29 -0
- package/gs/context/context.ts +401 -0
- package/gs/context/godoc.txt +69 -0
- package/gs/context/index.ts +1 -0
- package/gs/errors/errors.ts +223 -0
- package/gs/errors/godoc.txt +63 -0
- package/gs/errors/index.ts +1 -0
- package/gs/internal/goarch/godoc.txt +39 -0
- package/gs/internal/goarch/index.ts +18 -0
- package/gs/io/godoc.txt +61 -0
- package/gs/io/index.ts +1 -0
- package/gs/io/io.go +75 -0
- package/gs/io/io.ts +546 -0
- package/gs/iter/godoc.txt +203 -0
- package/gs/iter/index.ts +1 -0
- package/gs/iter/iter.ts +117 -0
- package/gs/math/bits/index.ts +356 -0
- package/gs/math/godoc.txt +76 -0
- package/gs/runtime/godoc.txt +331 -0
- package/gs/runtime/index.ts +1 -0
- package/gs/runtime/runtime.ts +178 -0
- package/gs/slices/godoc.txt +44 -0
- package/gs/slices/index.ts +1 -0
- package/gs/slices/slices.ts +22 -0
- package/gs/strings/builder.test.ts +121 -0
- package/gs/strings/builder.ts +223 -0
- package/gs/strings/clone.test.ts +43 -0
- package/gs/strings/clone.ts +17 -0
- package/gs/strings/compare.test.ts +84 -0
- package/gs/strings/compare.ts +13 -0
- package/gs/strings/godoc.txt +66 -0
- package/gs/strings/index.ts +2 -0
- package/gs/strings/iter.test.ts +343 -0
- package/gs/strings/iter.ts +171 -0
- package/gs/strings/reader.test.ts +243 -0
- package/gs/strings/reader.ts +451 -0
- package/gs/strings/replace.test.ts +181 -0
- package/gs/strings/replace.ts +1310 -0
- package/gs/strings/search.test.ts +214 -0
- package/gs/strings/search.ts +213 -0
- package/gs/strings/strings.test.ts +477 -0
- package/gs/strings/strings.ts +510 -0
- package/gs/stringslite/godoc.txt +17 -0
- package/gs/stringslite/index.ts +1 -0
- package/gs/stringslite/strings.ts +82 -0
- package/gs/sync/godoc.txt +21 -0
- package/gs/sync/index.ts +1 -0
- package/gs/sync/sync.go +64 -0
- package/gs/sync/sync.ts +449 -0
- package/gs/time/godoc.md +116 -0
- package/gs/time/godoc.txt +116 -0
- package/gs/time/index.ts +1 -0
- package/gs/time/time.ts +272 -0
- package/gs/unicode/godoc.txt +52 -0
- package/gs/unicode/index.ts +1 -0
- package/gs/unicode/unicode.go +38 -0
- package/gs/unicode/unicode.ts +418 -0
- package/gs/unicode/utf8/godoc.txt +22 -0
- package/gs/unicode/utf8/index.ts +2 -0
- package/gs/unicode/utf8/utf8.ts +227 -0
- package/gs/unsafe/godoc.txt +19 -0
- package/gs/unsafe/index.ts +1 -0
- package/gs/unsafe/unsafe.test.ts +68 -0
- package/gs/unsafe/unsafe.ts +77 -0
- 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 {};
|