Skip to content

Commit

Permalink
Merge pull request #239 from xypwn/main
Browse files Browse the repository at this point in the history
Unlimited words and Windows support
  • Loading branch information
refaktor authored Jun 13, 2024
2 parents d2c88d8 + f6f0467 commit 01d3563
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
16 changes: 7 additions & 9 deletions env/idxs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
)

type Idxs struct {
words1 [3000]string
words1 []string
words2 map[string]int
wordsn int
}

var NativeTypes = [...]string{ // Todo change to BuiltinTypes
Expand Down Expand Up @@ -59,10 +58,9 @@ func (e *Idxs) IndexWord(w string) int {
if ok {
return idx
} else {
e.words1[e.wordsn] = w
e.words2[w] = e.wordsn
e.wordsn += 1
return e.wordsn - 1
e.words1 = append(e.words1, w)
e.words2[w] = len(e.words1) - 1
return len(e.words1) - 1
}
}

Expand All @@ -83,20 +81,20 @@ func (e Idxs) GetWord(i int) string {

func (e Idxs) Print() {
fmt.Print("<IDXS: ")
for i := 0; i < e.wordsn; i++ {
for i := range e.words1 {
fmt.Print(strconv.FormatInt(int64(i), 10) + ": " + e.words1[i] + " ")
}
fmt.Println(">")
}

func (e Idxs) GetWordCount() int {
return e.wordsn
return len(e.words1)
}

func NewIdxs() *Idxs {
var e Idxs
e.words1 = []string{""}
e.words2 = make(map[string]int)
e.wordsn = 1

/*
BlockType Type = 1
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/mattn/go-sqlite3 v1.14.22
github.com/mhale/smtpd v0.8.2
github.com/mrz1836/postmark v1.6.4
github.com/pkg/term v1.1.0
github.com/pkg/term v1.2.0-beta.2.0.20211217091447-1a4a3b719465
github.com/refaktor/go-peg v0.0.0-20220116201714-31e3dfa8dc7d
github.com/refaktor/liner v1.2.10
github.com/sashabaranov/go-openai v1.24.1
Expand Down Expand Up @@ -104,7 +104,7 @@ require (
github.com/yhirose/go-peg v0.0.0-20210804202551-de25d6753cf1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ github.com/mrz1836/postmark v1.6.4/go.mod h1:6z5MxAH00Kj44owtQaryv9Pbqp5OKT3wWcR
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk=
github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
github.com/pkg/term v1.2.0-beta.2.0.20211217091447-1a4a3b719465 h1:J1AQza02ffZ4VP77HnZ5kRyzf6ak1LkjYQutOCdvckI=
github.com/pkg/term v1.2.0-beta.2.0.20211217091447-1a4a3b719465/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
Expand Down Expand Up @@ -237,8 +237,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
Expand Down

0 comments on commit 01d3563

Please sign in to comment.