Skip to content

Commit

Permalink
added many docstrings to builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Jan 12, 2024
1 parent d55747f commit 6f58fe1
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
- name: Build
# Enable all features for CI builds.
# TODO: add currently problematic tags: b_cayley,b_nng,b_qframe,b_ebitengine
# TODO: add currently problematic tags: b_cayley,b_nng,b_qframe,b_ebitengine,b_webview
run: |
go build -v -tags "b_sqlite,b_http,b_sql,b_postgres,b_bson,b_crypto,b_smtpd,b_mail,b_bcrypt,b_telegram,b_html,b_contrib,b_openai,b_email,b_mail,b_mysql,b_psql,b_psutil,b_sxml,b_echo,b_webview" -o bin/rye
go build -v -tags "b_sqlite,b_http,b_sql,b_postgres,b_bson,b_crypto,b_smtpd,b_mail,b_bcrypt,b_telegram,b_html,b_contrib,b_openai,b_email,b_mail,b_mysql,b_psql,b_psutil,b_sxml,b_echo" -o bin/rye
ls -l bin/rye
file bin/rye
go version -m bin/rye
Expand Down
4 changes: 2 additions & 2 deletions evaldo/builtins_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ var Builtins_conversion = map[string]*env.Builtin{

"convert": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Converts value from one kind to another.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
return BuiConvert(ps, arg0, arg1)
},
},

"converter": {
Argsn: 3,
Doc: "TODODOC.",
Doc: "Sets a converter between two kinds of objects.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
// obj := BuiValidate(ps, arg0, arg1)
switch obj1 := arg0.(type) {
Expand Down
14 changes: 7 additions & 7 deletions evaldo/builtins_crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"Ed25519-pub-key//to-string": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Turns public key to string.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch addr := arg0.(type) {
case env.Native:
Expand All @@ -98,7 +98,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"Ed25519-priv-key//to-string": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Turns private key to string.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch addr := arg0.(type) {
case env.Native:
Expand All @@ -112,7 +112,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"ed25519-generate-keys": {
Argsn: 0,
Doc: "TODODOC.",
Doc: "Generates private and public key, returns them in a block. Public first.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
keys := make([]env.Object, 2)
puk, pvk, err := ed25519.GenerateKey(nil)
Expand All @@ -129,7 +129,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"ed25519-private-key": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Creates private key from string or bytes.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
var pkey []byte
var err error
Expand All @@ -153,7 +153,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"ed25519-public-key": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Creates public key from string or bytes.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
var pkey []byte
var err error
Expand All @@ -180,7 +180,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"Ed25519-priv-key//sign": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Signs string with private key. Returns signature in bytes.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch pvk := arg0.(type) {
case env.Native:
Expand All @@ -201,7 +201,7 @@ var Builtins_crypto = map[string]*env.Builtin{

"sha512": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Calculates SHA512 on string.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch s := arg0.(type) {
case env.String:
Expand Down
4 changes: 2 additions & 2 deletions evaldo/builtins_eyr.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var Builtins_eyr = map[string]*env.Builtin{

"eyr": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Evaluates Rye block as Eyr (postfix) stack based code.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch bloc := arg0.(type) {
case env.Block:
Expand All @@ -208,7 +208,7 @@ var Builtins_eyr = map[string]*env.Builtin{

"eyr-loop": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Evaluates Rye block in loop as Eyr code (postfix stack based) N times.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch cond := arg0.(type) {
case env.Integer:
Expand Down
6 changes: 3 additions & 3 deletions evaldo/builtins_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ var Builtins_html = map[string]*env.Builtin{

"rye-reader//parse-html": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Parses HTML string with a HTML dialect.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
rm, err := load_html_Dict(ps, arg1.(env.Block))
trace8("*** _--- GOT RM ++**")
Expand All @@ -417,7 +417,7 @@ var Builtins_html = map[string]*env.Builtin{

"rye-html-start//attr?": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Gets an attribute on node start.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch tok1 := arg0.(type) {
case env.Native:
Expand Down Expand Up @@ -451,7 +451,7 @@ var Builtins_html = map[string]*env.Builtin{

"rye-html-start//name?": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Gets the name of the node.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch tok1 := arg0.(type) {
case env.Native:
Expand Down
20 changes: 10 additions & 10 deletions evaldo/builtins_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server//handle-ws": {
Argsn: 3,
Doc: "TODODOC.",
Doc: "Define handler for websockets",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch path := arg1.(type) {
case env.String:
Expand Down Expand Up @@ -345,7 +345,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//query?": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Get query parameter from HTTP request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
//fmt.Println("YOYOYOYOYOYO ------------- - - - --")
//return env.String{"QUERY - VAL"}
Expand Down Expand Up @@ -375,7 +375,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//url?": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Get URL from HTTP request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -390,7 +390,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-url//path?": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Get path from server url.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -405,7 +405,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//cookie-val?": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Get cookie value from server request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -430,7 +430,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//form?": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Get form field from server request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -457,7 +457,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//full-form?": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Get full form data as Dict from server request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -477,7 +477,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//parse-multipart-form!": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Parse multipart form from server request.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand All @@ -497,7 +497,7 @@ var Builtins_http = map[string]*env.Builtin{

"Go-server-request//form-file?": {
Argsn: 2,
Doc: "TODODOC.",
Doc: "Get form file from server request as block with reader and multipart header.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand Down Expand Up @@ -526,7 +526,7 @@ var Builtins_http = map[string]*env.Builtin{

"rye-multipart-header//filename?": {
Argsn: 1,
Doc: "TODODOC.",
Doc: "Get filename from multipart header.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch req := arg0.(type) {
case env.Native:
Expand Down
Loading

0 comments on commit 6f58fe1

Please sign in to comment.