From 09ac16a42d0d31daa8966301fa073ceeb0f88172 Mon Sep 17 00:00:00 2001 From: neemek Date: Mon, 17 Aug 2026 17:15:34 +0200 Subject: [PATCH] fix missing string-conversions --- core/lexer.go | 2 ++ core/nodes.go | 6 +++++- core/values.go | 4 ++-- core/vm.go | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/lexer.go b/core/lexer.go index da8aa70..1701479 100644 --- a/core/lexer.go +++ b/core/lexer.go @@ -185,6 +185,8 @@ func (t TokenKind) String() string { return "for" case TokenIn: return "in" + case TokenPercent: + return "percent" } panic("UNDEFINED TOKENTYPE STRING CONVERSION") diff --git a/core/nodes.go b/core/nodes.go index 54ddcdc..0a04c44 100644 --- a/core/nodes.go +++ b/core/nodes.go @@ -96,6 +96,10 @@ func (n NodeType) String() string { return "Index" case RecordNodeType: return "Record" + case ForNodeType: + return "For" + case IncludeNodeType: + return "Include" } return "Invalid Node Type" } @@ -534,7 +538,7 @@ func (n ConditionalNode) String() string { return fmt.Sprintf("if %s then %s", n.condition.String(), n.do.String()) } - return fmt.Sprintf("if %s then %s otheriwise %s", n.condition.String(), n.do.String(), n.otherwise.String()) + return fmt.Sprintf("if %s then %s otherwise %s", n.condition.String(), n.do.String(), n.otherwise.String()) } func (n ConditionalNode) Bounds() (Pos, Pos) { diff --git a/core/values.go b/core/values.go index 4312d44..8f95a1c 100644 --- a/core/values.go +++ b/core/values.go @@ -383,7 +383,7 @@ var StringPrototype = map[string]*BuiltinFunctionValue{ } if prev != len(str) { - out = append(out, &StringValue{str[prev:len(str)]}) + out = append(out, &StringValue{str[prev:]}) } return &ListValue{out}, nil @@ -661,7 +661,7 @@ func (v *TupleValue) Equals(other Value) bool { } var TuplePrototype = map[string]*BuiltinFunctionValue{ - "at": &BuiltinFunctionValue{ + "at": { "at", &FunctionSignature{ []TypeSignature{&IntegerSignature{}}, diff --git a/core/vm.go b/core/vm.go index 7a41a33..22a568e 100644 --- a/core/vm.go +++ b/core/vm.go @@ -268,6 +268,14 @@ func (b Bytecode) String() string { return "INDEX_TUPLE" case InstructionDestructureTuple: return "DESTRUCTURE_TUPLE" + case InstructionModInt: + return "MOD_INT" + case InstructionNewRecord: + return "NEW_RECORD" + case InstructionSetRecordItem: + return "SET_PROPERTY" + case InstructionIndexString: + return "INDEX_STRING" } return "UNDEFINED" }