Skip to content

Commit b2de172

Browse files
author
Victor kariuki
committed
Merge remote-tracking branch 'origin/main'
2 parents b243bd2 + 7732a4b commit b2de172

File tree

13 files changed

+110
-26
lines changed

13 files changed

+110
-26
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.21
20+
id: go
21+
22+
- name: Test
23+
run: go mod tidy && make test
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v5
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v3
1616
with:
17-
go-version: 1.18
17+
go-version: 1.21
1818

1919
- name: Test
2020
run: go mod tidy && make test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ nuru
5252
Notes.md
5353
tutorials/en/*
5454
config.json
55+
*local*
5556

5657
# For Nuru executables
5758
/nuru
5859
/Nuru
60+
61+
dist/

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
project_name: nuru
2+
before:
3+
hooks:
4+
- go mod tidy
5+
- go generate ./...
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
- darwin
14+
- android
15+
ldflags:
16+
- '-s -w'
17+
ignore:
18+
- goos: android
19+
goarch: 386
20+
21+
archives:
22+
- format: tar.gz
23+
name_template: >-
24+
nuru_
25+
{{- title .Os }}_
26+
{{- if eq .Arch "amd64" }}x86_64
27+
{{- else if eq .Arch "386" }}i386
28+
{{- else }}{{ .Arch }}{{ end }}
29+
{{- if .Arm }}v{{ .Arm }}{{ end }}
30+
format_overrides:
31+
- goos: windows
32+
format: zip
33+
34+
changelog:
35+
sort: asc
36+
filters:
37+
exclude:
38+
- "^docs:"
39+
- "^test:"
40+
41+
nfpms:
42+
- maintainer: "AvicennaJr"
43+
homepage: "https://nuruprogramming.org"
44+
description: "Nuru is a programming language built from the ground up"
45+
formats:
46+
- deb
47+
file_name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"

evaluator/builtins.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var builtins = map[string]*object.Builtin{
7474
"aina": {
7575
Fn: func(args ...object.Object) object.Object {
7676
if len(args) != 1 {
77-
return newError("Samahani, tunahitaji Hoja 1, wewe umeweka %d", len(args))
77+
return newError("Samahani, tunahitaji hoja 1, wewe umeweka %d", len(args))
7878
}
7979

8080
return &object.String{Value: string(args[0].Type())}

evaluator/evaluator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func Eval(node ast.Node, env *object.Environment) object.Object {
180180
}
181181
array.Elements[idx.Value] = value
182182
} else {
183-
return newError("Hauwezi kufanya opereshen hii na %#v", index)
183+
return newError("Hauwezi kufanya operesheni hii na %#v", index)
184184
}
185185
} else if hash, ok := obj.(*object.Dict); ok {
186186
key := Eval(ie.Index, env)
@@ -191,13 +191,13 @@ func Eval(node ast.Node, env *object.Environment) object.Object {
191191
hashed := hashKey.HashKey()
192192
hash.Pairs[hashed] = object.DictPair{Key: key, Value: value}
193193
} else {
194-
return newError("Hauwezi kufanya opereshen hii na %T", key)
194+
return newError("Hauwezi kufanya operesheni hii na %T", key)
195195
}
196196
} else {
197-
return newError("%T haifanyi operation hii", obj)
197+
return newError("%T haifanyi operesheni hii", obj)
198198
}
199199
} else {
200-
return newError("Tumia neno kama variable, sio %T", left)
200+
return newError("Tumia neno kama kibadala, sio %T", left)
201201
}
202202

203203
}

evaluator/evaluator_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,19 @@ func TestErrorHandling(t *testing.T) {
214214
},
215215
{
216216
"-kweli",
217-
"Mstari 1: Operesheni Haielweki: -BOOLEAN",
217+
"Mstari 1: Operesheni Haieleweki: -BOOLEAN",
218218
},
219219
{
220220
"kweli + sikweli",
221-
"Mstari 1: Operesheni Haielweki: BOOLEAN + BOOLEAN",
221+
"Mstari 1: Operesheni Haieleweki: BOOLEAN + BOOLEAN",
222222
},
223223
{
224224
"5; kweli + sikweli; 5",
225-
"Mstari 1: Operesheni Haielweki: BOOLEAN + BOOLEAN",
225+
"Mstari 1: Operesheni Haieleweki: BOOLEAN + BOOLEAN",
226226
},
227227
{
228228
"kama (10 > 1) { kweli + sikweli;}",
229-
"Mstari 1: Operesheni Haielweki: BOOLEAN + BOOLEAN",
229+
"Mstari 1: Operesheni Haieleweki: BOOLEAN + BOOLEAN",
230230
},
231231
{
232232
`
@@ -238,19 +238,19 @@ kama (10 > 1) {
238238
rudisha 1;
239239
}
240240
`,
241-
"Mstari 4: Operesheni Haielweki: BOOLEAN + BOOLEAN",
241+
"Mstari 4: Operesheni Haieleweki: BOOLEAN + BOOLEAN",
242242
},
243243
{
244244
"bangi",
245245
"Mstari 1: Neno Halifahamiki: bangi",
246246
},
247247
{
248248
`"Habari" - "Habari"`,
249-
"Mstari 1: Operesheni Haielweki: NENO - NENO",
249+
"Mstari 1: Operesheni Haieleweki: NENO - NENO",
250250
},
251251
{
252252
`{"jina": "Avi"}[unda(x) {x}];`,
253-
"Mstari 1: Samahani, UNDO (FUNCTION) haitumiki kama key",
253+
"Mstari 1: Samahani, UNDO (FUNCTION) haitumiki kama ufunguo",
254254
},
255255
}
256256

evaluator/import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func evalImportFile(name string, ident *ast.Identifier, env *object.Environment)
3131
addSearchPath("")
3232
filename := findFile(name)
3333
if filename == "" {
34-
return newError("Module %s haipo", name)
34+
return newError("Moduli %s haipo", name)
3535
}
3636
var scope *object.Environment
3737
scope, err := evaluateFile(filename, env)
@@ -70,7 +70,7 @@ func evaluateFile(file string, env *object.Environment) (*object.Environment, ob
7070
p := parser.New(l)
7171
program := p.ParseProgram()
7272
if len(p.Errors()) != 0 {
73-
return nil, &object.Error{Message: fmt.Sprintf("Pakeji %s ina errors zifuatozo:\n%s", file, strings.Join(p.Errors(), "\n"))}
73+
return nil, &object.Error{Message: fmt.Sprintf("Pakeji %s ina makosa yafuatayo:\n%s", file, strings.Join(p.Errors(), "\n"))}
7474
}
7575

7676
scope := object.NewEnvironment()

evaluator/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func evalDictIndexExpression(dict, index object.Object, line int) object.Object
3232

3333
key, ok := index.(object.Hashable)
3434
if !ok {
35-
return newError("Mstari %d: Samahani, %s haitumiki kama key", line, index.Type())
35+
return newError("Mstari %d: Samahani, %s haitumiki kama ufunguo", line, index.Type())
3636
}
3737

3838
pair, ok := dictObject.Pairs[key.HashKey()]

evaluator/infix.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func evalInfixExpression(operator string, left, right object.Object, line int) o
9090
line, left.Type(), operator, right.Type())
9191

9292
default:
93-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s",
93+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s",
9494
line, left.Type(), operator, right.Type())
9595
}
9696
}
@@ -132,7 +132,7 @@ func evalFloatIntegerInfixExpression(operator string, left, right object.Object,
132132
case "!=":
133133
return nativeBoolToBooleanObject(leftVal != rightVal)
134134
default:
135-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s",
135+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s",
136136
line, left.Type(), operator, right.Type())
137137
}
138138

@@ -156,7 +156,7 @@ func evalStringInfixExpression(operator string, left, right object.Object, line
156156
case "!=":
157157
return nativeBoolToBooleanObject(leftVal != rightVal)
158158
default:
159-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s", line, left.Type(), operator, right.Type())
159+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s", line, left.Type(), operator, right.Type())
160160
}
161161
}
162162

@@ -170,7 +170,7 @@ func evalBooleanInfixExpression(operator string, left, right object.Object, line
170170
case "||":
171171
return nativeBoolToBooleanObject(leftVal || rightVal)
172172
default:
173-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s", line, left.Type(), operator, right.Type())
173+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s", line, left.Type(), operator, right.Type())
174174
}
175175
}
176176

@@ -202,7 +202,7 @@ func evalFloatInfixExpression(operator string, left, right object.Object, line i
202202
case "!=":
203203
return nativeBoolToBooleanObject(leftVal != rightVal)
204204
default:
205-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s",
205+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s",
206206
line, left.Type(), operator, right.Type())
207207
}
208208
}
@@ -242,7 +242,7 @@ func evalIntegerInfixExpression(operator string, left, right object.Object, line
242242
case "!=":
243243
return nativeBoolToBooleanObject(leftVal != rightVal)
244244
default:
245-
return newError("Mstari %d: Operesheni Haielweki: %s %s %s",
245+
return newError("Mstari %d: Operesheni Haieleweki: %s %s %s",
246246
line, left.Type(), operator, right.Type())
247247
}
248248
}

0 commit comments

Comments
 (0)