Skip to content

Commit

Permalink
Merge pull request #289 from refaktor/modwords
Browse files Browse the repository at this point in the history
fixed the do\inside do\in naming to do\in do\par
  • Loading branch information
refaktor authored Aug 1, 2024
2 parents c0e3948 + 1344c88 commit 72a555b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions evaldo/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@ var builtins = map[string]*env.Builtin{
},
},

"do\\inside": { // **
"do\\in": { // **
Argsn: 2,
Doc: "Takes a Context and a Block. It Does a block inside a given Context.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
Expand All @@ -2395,7 +2395,7 @@ var builtins = map[string]*env.Builtin{
},
},

"do\\inside\\try": { // **
"do\\in\\try": { // **
Argsn: 2,
Doc: "Takes a Context and a Block. It Does a block inside a given Context.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
Expand Down Expand Up @@ -2428,7 +2428,7 @@ var builtins = map[string]*env.Builtin{
},
},

"do\\in": { // **
"do\\par": { // **
Argsn: 2,
Doc: "Takes a Context and a Block. It Does a block in current context but with parent a given Context.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
Expand Down Expand Up @@ -2839,7 +2839,11 @@ var builtins = map[string]*env.Builtin{
Argsn: 0,
Doc: "Lists words in current context",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
fmt.Println(ps.Ctx.Parent.Preview(*ps.Idx, ""))
if ps.Ctx.Parent != nil {
fmt.Println(ps.Ctx.Parent.Preview(*ps.Idx, ""))
} else {
fmt.Println("No parent")
}
return env.Void{}
},
},
Expand All @@ -2866,7 +2870,11 @@ var builtins = map[string]*env.Builtin{
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch s1 := arg0.(type) {
case env.String:
fmt.Println(ps.Ctx.Parent.Preview(*ps.Idx, s1.Value))
if ps.Ctx.Parent != nil {
fmt.Println(ps.Ctx.Parent.Preview(*ps.Idx, s1.Value))
} else {
fmt.Println("No parent")
}
return env.Void{}
default:
return MakeArgError(ps, 1, []env.Type{env.StringType}, "ls\\")
Expand Down

0 comments on commit 72a555b

Please sign in to comment.