Skip to content

Commit ab275ae

Browse files
committed
Import full Goal suite
1 parent 0940b8a commit ab275ae

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

goal.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
"strings"
99

1010
"codeberg.org/anaseto/goal"
11+
"codeberg.org/anaseto/goal/archive/zip"
12+
"codeberg.org/anaseto/goal/encoding/base64"
13+
"codeberg.org/anaseto/goal/math"
1114
gos "codeberg.org/anaseto/goal/os"
1215
"github.com/semperos/ari/vendored/help"
1316
)
@@ -31,6 +34,7 @@ const (
3134
func goalLoadExtendedPreamble(ctx *goal.Context) error {
3235
additionalPackages := map[string]string{
3336
"dict": goalSourceDict,
37+
"flag": goalSourceFlag,
3438
"fmt": goalSourceFmt,
3539
"fs": goalSourceFs,
3640
"html": goalSourceHTML,
@@ -41,6 +45,7 @@ func goalLoadExtendedPreamble(ctx *goal.Context) error {
4145
"path": goalSourcePath,
4246
"table": goalSourceTable,
4347
}
48+
4449
for pkg, source := range additionalPackages {
4550
_, err := ctx.EvalPackage(source, "<builtin>", pkg)
4651
if err != nil {
@@ -57,6 +62,9 @@ func goalLoadExtendedPreamble(ctx *goal.Context) error {
5762
//go:embed vendor-goal/dict.goal
5863
var goalSourceDict string
5964

65+
//go:embed vendor-goal/flag.goal
66+
var goalSourceFlag string
67+
6068
//go:embed vendor-goal/fmt.goal
6169
var goalSourceFmt string
6270

@@ -184,8 +192,10 @@ func goalNewDictEmpty() *goal.D {
184192
// Integration with other parts of Ari
185193

186194
func goalRegisterUniversalVariadics(ariContext *Context, goalContext *goal.Context, help Help) {
187-
// From Goal itself, os lib imported without prefix. Includes 'say' verb, which works even in WASM.
188-
gos.Import(goalContext, "")
195+
gos.Import(goalContext, "") // because Goal imports this without prefix
196+
math.Import(goalContext, "math") // because this file isn't prefixed
197+
zip.Import(goalContext, "") // already zip-prefixed
198+
base64.Import(goalContext, "") // already base64-prefixed
189199
goalContext.RegisterExtension("ari", AriVersion)
190200
goalContext.AssignGlobal("ari.c", goal.NewI(0))
191201
// Monads

0 commit comments

Comments
 (0)