all repos

scratch @ 2b64f4e6f2d35ae68bf39cec616a782153335bc0

⭐ me doing recreational ~~drugs~~ programming
4 files changed, 9 insertions(+), 9 deletions(-)
blo: add readme; make gopls analyzer happy
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-04-21 00:12:55 +0300
Authored at: 2026-04-19 12:32:15 +0300
Change ID: vkrxnklltvzzslnktvkzvslokmrtxxxo
Parent: 78737e5
M blo/blo.go
···
        313
        313
         }

      
        314
        314
         

      
        315
        315
         var (

      
        316
        
        -	ErrParserUnexpectedToken = errors.New("Parser: Unexpected Token")

      
        317
        
        -	ErrParserUnclosedFuncall = errors.New("Parser: Unclosed Funcall")

      
        
        316
        +	ErrParserUnexpectedToken = errors.New("parser: Unexpected Token")

      
        
        317
        +	ErrParserUnclosedFuncall = errors.New("parser: Unclosed Funcall")

      
        318
        318
         )

      
        319
        319
         

      
        320
        320
         func ParseExpr(l *Lexer) (Expr, error) {

      ···
        417
        417
         }

      
        418
        418
         

      
        419
        419
         type (

      
        420
        
        -	Func = func(context *EvalContext, args []Expr) (Expr, error)

      
        
        420
        +	Func func(context *EvalContext, args []Expr) (Expr, error)

      
        421
        421
         

      
        422
        422
         	EvalContext struct{ Scopes []EvalScope }

      
        423
        423
         	EvalScope   struct {

      
M blo/blox.go
···
        23
        23
         			}

      
        24
        24
         

      
        25
        25
         			if args[0].Type != ExprVar {

      
        26
        
        -				return Expr{}, errors.New("First argument of let() has to be variable name")

      
        
        26
        +				return Expr{}, errors.New("first argument of let() has to be variable name")

      
        27
        27
         			}

      
        28
        28
         

      
        29
        29
         			name := args[0].AsVar

      ···
        35
        35
         			ctx.TopScope().Vars[name] = value

      
        36
        36
         			return Expr{}, nil

      
        37
        37
         		},

      
        38
        
        -

      
        39
        38
         		"define": func(ctx *EvalContext, args []Expr) (Expr, error) {

      
        40
        39
         			if len(args) < 2 {

      
        41
        40
         				return Expr{}, errors.New("define() expects at least 2 arguments")

      ···
        64
        63
         				}

      
        65
        64
         

      
        66
        65
         				if len(callArgs) != len(funArgs) {

      
        67
        
        -					return Expr{}, errors.New(fmt.Sprintf("%s(): expected %d arguments but provided %d", funName, len(funArgs), len(args)))

      
        
        66
        +					return Expr{}, fmt.Errorf("%s(): expected %d arguments but provided %d", funName, len(funArgs), len(args))

      
        68
        67
         				}

      
        69
        68
         

      
        70
        69
         				for index := range callArgs {

      ···
        85
        84
         

      
        86
        85
         			return Expr{}, nil

      
        87
        86
         		},

      
        88
        
        -

      
        89
        87
         		"say": func(context *EvalContext, args []Expr) (Expr, error) {

      
        90
        88
         			for _, arg := range args {

      
        91
        89
         				val, err := context.EvalExpr(arg)

      ···
        106
        104
         			fmt.Printf("\n")

      
        107
        105
         			return Expr{}, nil

      
        108
        106
         		},

      
        109
        
        -

      
        110
        107
         		"http": func(context *EvalContext, args []Expr) (Expr, error) {

      
        111
        108
         			var url strings.Builder

      
        112
        109
         			for _, arg := range args {

      ···
        156
        153
         	}

      
        157
        154
         

      
        158
        155
         	lexer := NewLexer([]rune(string(content)), fpath)

      
        159
        
        -

      
        160
        156
         	exprs, err := ParseExprs(&lexer)

      
        161
        157
         	if err != nil {

      
        162
        158
         		fmt.Fprintln(os.Stderr, err)

      
A blo/readme
···
        
        1
        +blo

      
        
        2
        +---

      
        
        3
        +

      
        
        4
        +Small usless scripting language.