@shd101wyy/yo 0.1.5 → 0.1.6
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 +7 -6
- package/out/cjs/index.cjs +508 -503
- package/out/cjs/yo-cli.cjs +619 -612
- package/out/esm/index.mjs +397 -392
- package/out/types/src/codegen/codegen-c.d.ts +2 -0
- package/out/types/src/codegen/functions/context.d.ts +1 -0
- package/out/types/src/codegen/functions/generation.d.ts +10 -0
- package/out/types/src/codegen/utils/index.d.ts +1 -0
- package/out/types/src/env.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +1 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +2 -0
- package/out/types/src/target.d.ts +1 -0
- package/out/types/src/value.d.ts +2 -1
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/build.yo +2 -1
- package/std/collections/array_list.yo +133 -1
- package/std/encoding/html.yo +283 -0
- package/std/encoding/html_char_utils.yo +36 -0
- package/std/encoding/html_entities.yo +2262 -0
- package/std/encoding/punycode.yo +366 -0
- package/std/fmt/to_string.yo +5 -4
- package/std/glob/index.yo +2 -2
- package/std/libc/wctype.yo +55 -0
- package/std/path.yo +6 -6
- package/std/prelude.yo +8 -0
- package/std/regex/parser.yo +69 -4
- package/std/regex/vm.yo +18 -31
- package/std/string/string.yo +1388 -1337
- package/std/string/unicode.yo +242 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Expr } from "../expr";
|
|
1
2
|
import type { ModuleValue } from "../value";
|
|
2
3
|
export declare class CodeGeneratorC {
|
|
3
4
|
private emitter;
|
|
@@ -11,6 +12,7 @@ export declare class CodeGeneratorC {
|
|
|
11
12
|
debugAsyncAwait?: boolean;
|
|
12
13
|
allocator?: "mimalloc" | "libc";
|
|
13
14
|
isLibrary?: boolean;
|
|
15
|
+
allModuleLevelInitExprs?: Expr[];
|
|
14
16
|
}): void;
|
|
15
17
|
print(): string;
|
|
16
18
|
getExportedFunctionNames(): Set<string>;
|
|
@@ -107,6 +107,7 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
107
107
|
};
|
|
108
108
|
smWhileBodyDrops?: Expr[];
|
|
109
109
|
shortCircuitHandledDropVarNames?: Set<string>;
|
|
110
|
+
declaredTempVars?: Set<string>;
|
|
110
111
|
effectHandlerParamDrops?: string[];
|
|
111
112
|
effectSmConsumedArgCNames?: Set<string>;
|
|
112
113
|
loopBodyDropsBaselineCount?: number;
|
|
@@ -4,6 +4,16 @@ import type { FunctionType } from "../../types/definitions";
|
|
|
4
4
|
import { type CodeGenContext } from "../utils";
|
|
5
5
|
import type { FunctionGenerationContext } from "./context";
|
|
6
6
|
export declare function generateAllFunctions(context: FunctionGenerationContext): void;
|
|
7
|
+
export declare function emitModuleLevelVariableDeclarations(context: FunctionGenerationContext): Array<{
|
|
8
|
+
cVarName: string;
|
|
9
|
+
cTypeStr: string;
|
|
10
|
+
rhs: Expr;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function generateLibraryInitFunction(context: FunctionGenerationContext, moduleLevelVars: Array<{
|
|
13
|
+
cVarName: string;
|
|
14
|
+
cTypeStr: string;
|
|
15
|
+
rhs: Expr;
|
|
16
|
+
}>): void;
|
|
7
17
|
export declare function generateMainWrapper(context: FunctionGenerationContext): void;
|
|
8
18
|
export declare function preRegisterEffectfulFunctions(context: FunctionGenerationContext): void;
|
|
9
19
|
export declare function generateFunction(functionValue: FunctionValue, cFunctionName: string, context: FunctionGenerationContext): void;
|
package/out/types/src/env.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export declare class BuildRegistry {
|
|
|
109
109
|
findTest(name: string): BuildTestSuite | undefined;
|
|
110
110
|
findRunStep(name: string): BuildRunStep | undefined;
|
|
111
111
|
findStep(name: string): BuildStep | undefined;
|
|
112
|
+
private checkDuplicateArtifactName;
|
|
112
113
|
findDependency(name: string): BuildGitDependency | undefined;
|
|
113
114
|
findPathDependency(name: string): BuildPathDependency | undefined;
|
|
114
115
|
findSystemLibrary(name: string): BuildSystemLibrary | undefined;
|
|
@@ -36,6 +36,7 @@ export interface EvaluatorContext {
|
|
|
36
36
|
env: Environment;
|
|
37
37
|
};
|
|
38
38
|
isEvaluatingFunctionBodyOrAsyncBlock?: FunctionEvaluationContext | AsyncBlockEvaluationContext | TestBlockEvaluationContext;
|
|
39
|
+
isInsideImplBlock?: boolean;
|
|
39
40
|
capturedVariables?: Map<string, CapturedVariableInfo>;
|
|
40
41
|
isEvaluatingLoopBody?: {
|
|
41
42
|
kind: "while" | "for";
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -195,6 +195,7 @@ export declare const BuiltinFunctions: {
|
|
|
195
195
|
__yo_ptr_set: string[];
|
|
196
196
|
__yo_slice_len: string[];
|
|
197
197
|
__yo_slice_new: string[];
|
|
198
|
+
__yo_slice_ptr: string[];
|
|
198
199
|
__yo_as: string[];
|
|
199
200
|
__yo_expr_is_atom: string[];
|
|
200
201
|
__yo_expr_is_fn_call: string[];
|
|
@@ -565,6 +566,7 @@ export interface ExprToStringConfig {
|
|
|
565
566
|
indentLevel?: number;
|
|
566
567
|
}
|
|
567
568
|
export declare function exprToString(expr: Expr, config?: ExprToStringConfig): string;
|
|
569
|
+
export declare function consumeCaseBodyTempVar(evaluatedBody: Expr, env: Environment): Environment;
|
|
568
570
|
export declare function attachTempVariableToExpr(expr: Expr, isOwningTheRcValue: boolean, isOwningTheSameRcValueAs?: Variable): void;
|
|
569
571
|
export declare function mergeAndCheckEnvs(env: Environment, bodies: Expr[]): Environment;
|
|
570
572
|
export declare function replaceFuncCallExprWithFuncCallExpr(funcExpr: FnCallExpr, newFuncExpr: FnCallExpr): void;
|
|
@@ -28,4 +28,5 @@ export declare function isTargetMSVC(target: TargetInfo): boolean;
|
|
|
28
28
|
export declare function isTargetWasm(target: TargetInfo): boolean;
|
|
29
29
|
export declare function isTargetEmscripten(target: TargetInfo): boolean;
|
|
30
30
|
export declare function isTargetStandaloneWasi(target: TargetInfo): boolean;
|
|
31
|
+
export declare function isTargetMusl(target: TargetInfo): boolean;
|
|
31
32
|
export declare function isTargetPosix(target: TargetInfo): boolean;
|
package/out/types/src/value.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export type ModuleValue = {
|
|
|
41
41
|
tag: ValueTag.Module;
|
|
42
42
|
type: ModuleType;
|
|
43
43
|
fields: (Value | undefined)[];
|
|
44
|
+
moduleLevelInitExprs?: Expr[];
|
|
44
45
|
};
|
|
45
46
|
export type TraitValue = {
|
|
46
47
|
tag: ValueTag.Trait;
|
|
@@ -123,7 +124,7 @@ export declare function createUnknownValue(type: Type, { variableName, recursive
|
|
|
123
124
|
context: EvaluatorContext;
|
|
124
125
|
}): UnknownValue | TypeValue;
|
|
125
126
|
export declare function createStructValue(type: StructType, fields: Value[]): StructValue;
|
|
126
|
-
export declare function createModuleValue(type: ModuleType, fields: (Value | undefined)[]): ModuleValue;
|
|
127
|
+
export declare function createModuleValue(type: ModuleType, fields: (Value | undefined)[], moduleLevelInitExprs?: Expr[]): ModuleValue;
|
|
127
128
|
export declare function createTraitValue(type: TraitType, fields: (Value | undefined)[]): TraitValue;
|
|
128
129
|
export declare function createTupleValue(type: TupleType, fields: Value[]): TupleValue;
|
|
129
130
|
export declare function createEnumValue(type: EnumType, variantName: string, fields: Value[]): EnumValue;
|