Skip to content

Commit

Permalink
Merge branch 'main' of github.com:refaktor/rye into contextplay
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Mar 5, 2024
2 parents daa8afa + 92ef553 commit 1f9eada
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder

RUN apk add --no-cache git sqlite-dev bash gcc libc-dev

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [Modules](#modules)
- [Base](#base)
- [Contrib](#contrib)
- [Rye-front project](#rye-front-project)
- [Follow development](#follow-development)
- [Rye blog](#rye-blog)
- [Ryelang reddit](#ryelang-reddit)
Expand Down Expand Up @@ -138,7 +139,6 @@ The author of Factor once said that at the end *it's not about the language, but
* Sqlite - database ⭐⭐
* Sxml - sax XML like streaming dialect
* Validation - validation dialect ⭐⭐ 🧪~50%
* Webview - Webview GUI

### Contrib
* Amazon AWS
Expand All @@ -147,10 +147,19 @@ The author of Factor once said that at the end *it's not about the language, but
* OpenAI - OpenAI API
* Postmark - email sending service
* Telegram bot - telegram bots
* Ebitengine - 2d game engine
* Fyne - desktop and mobile GUI

legend: ⭐ priority , 🧪 tests

## Rye-front project

If you are interested in "fontend" / desktop technologies check out separate project that works on extending Rye lanuage with GUI, Game engine and a Webview. It
integrates these cool Go libraries:

* Fyne - Cross platform Material design inspired GUI framework ⭐
* Ebitengine - 2d game engine
* Webview - Webview GUI

**[Visit Rye-front repo](https://github.com/refaktor/rye-front)**

## Follow development

Expand Down
11 changes: 10 additions & 1 deletion env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@ func (i RyeCtx) Equal(o Object) bool {

func (i RyeCtx) Dump(e Idxs) string {
var bu strings.Builder
bu.WriteString("context {\n")
bu.WriteString(fmt.Sprintf("doc \"%s\"\n", i.Doc))
bu.WriteString(i.DumpBare(e))
bu.WriteString("}")
return bu.String()
}

// DumpBare returns the string representation of the context without wraping it in context { ... }
func (i RyeCtx) DumpBare(e Idxs) string {
var bu strings.Builder
for j := 0; j < e.GetWordCount(); j++ {
if val, ok := i.state[j]; ok {
if val.Type() != BuiltinType {
Expand Down Expand Up @@ -299,7 +308,7 @@ func NewProgramStateNEW() *ProgramState {
}

func (ps *ProgramState) Dump() string {
return ps.Ctx.Dump(*ps.Idx)
return ps.Ctx.DumpBare(*ps.Idx)
}

func AddToProgramState(ps *ProgramState, ser TSeries, idx *Idxs) *ProgramState {
Expand Down
18 changes: 17 additions & 1 deletion evaldo/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -4561,8 +4561,24 @@ var builtins = map[string]*env.Builtin{
reversed += string(s[i])
}
return *env.NewString(reversed)
case env.List:
// Create slice of env.Object
dataSlice := make([]env.Object, 0)
for _, v := range block.Data {
dataSlice = append(dataSlice, env.ToRyeValue(v))
}
// Reverse slice data
for left, right := 0, len(dataSlice)-1; left < right; left, right = left+1, right-1 {
dataSlice[left], dataSlice[right] = dataSlice[right], dataSlice[left]
}
// Create list frol slice data
reverseList := make([]any, 0, len(dataSlice))
for _, value := range dataSlice {
reverseList = append(reverseList, value)
}
return *env.NewList(reverseList)
default:
return MakeArgError(ps, 1, []env.Type{env.BlockType, env.StringType}, "reverse")
return MakeArgError(ps, 1, []env.Type{env.BlockType, env.StringType, env.ListType}, "reverse!")
}
},
},
Expand Down
40 changes: 20 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ go 1.21
retract v0.0.11 // Published accidentally with a bug

require (
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.6
github.com/aws/aws-sdk-go-v2/service/ses v1.19.6
github.com/aws/aws-sdk-go-v2 v1.25.2
github.com/aws/aws-sdk-go-v2/config v1.27.4
github.com/aws/aws-sdk-go-v2/service/ses v1.22.1
github.com/blevesearch/bleve/v2 v2.3.10
github.com/blevesearch/bleve_index_api v1.1.6
github.com/drewlanenga/govector v0.0.0-20220726163947-b958ac08bc93
Expand All @@ -24,33 +24,33 @@ require (
github.com/mattn/go-runewidth v0.0.15
github.com/mattn/go-sqlite3 v1.14.22
github.com/mhale/smtpd v0.8.2
github.com/mrz1836/postmark v1.6.3
github.com/mrz1836/postmark v1.6.4
github.com/pkg/term v1.1.0
github.com/refaktor/go-peg v0.0.0-20220116201714-31e3dfa8dc7d
github.com/refaktor/liner v1.2.6
github.com/sashabaranov/go-openai v1.19.2
github.com/sashabaranov/go-openai v1.20.2
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/thomasberger/parsemail v1.2.6
go.mongodb.org/mongo-driver v1.13.1
golang.org/x/crypto v0.18.0
golang.org/x/net v0.20.0
go.mongodb.org/mongo-driver v1.14.0
golang.org/x/crypto v0.20.0
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
golang.org/x/text v0.14.0
)

require (
github.com/RoaringBitmap/roaring v1.2.3 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.16.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect
github.com/aws/smithy-go v1.19.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/blevesearch/geo v0.1.18 // indirect
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
Expand Down Expand Up @@ -92,7 +92,7 @@ require (
github.com/yhirose/go-peg v0.0.0-20210804202551-de25d6753cf1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.17.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
Loading

0 comments on commit 1f9eada

Please sign in to comment.