auto adjust code

This commit is contained in:
Christopher Homberger
2026-02-22 20:58:46 +01:00
parent 949a40c7a5
commit d187ac2fc1
86 changed files with 617 additions and 617 deletions

View File

@@ -20,7 +20,7 @@ type Node interface {
type ValueNode struct {
Kind TokenKind
Value interface{}
Value any
}
// FunctionNode represents a function call with arguments.

View File

@@ -51,7 +51,7 @@ const (
type Token struct {
Kind TokenKind
Raw string
Value interface{}
Value any
Index int
}
@@ -256,7 +256,7 @@ func (l *Lexer) readNumber() *Token {
}
}
// Try to parse as float64
var val interface{} = raw
var val any = raw
if f, err := strconv.ParseFloat(raw, 64); err == nil {
val = f
}

View File

@@ -12,7 +12,7 @@ func TestLexerMultiple(t *testing.T) {
cases := []struct {
expr string
expected []TokenKind
values []interface{} // optional, nil if not checking values
values []any // optional, nil if not checking values
}{
{
expr: "github.event_name == 'push'",
@@ -67,12 +67,12 @@ func TestLexerMultiple(t *testing.T) {
{
expr: "true",
expected: []TokenKind{TokenKindBoolean},
values: []interface{}{true},
values: []any{true},
},
{
expr: "123",
expected: []TokenKind{TokenKindNumber},
values: []interface{}{123.0},
values: []any{123.0},
},
{
expr: "(a && b)",
@@ -85,7 +85,7 @@ func TestLexerMultiple(t *testing.T) {
{
expr: "'Hello i''s escaped'",
expected: []TokenKind{TokenKindString},
values: []interface{}{"Hello i's escaped"},
values: []any{"Hello i's escaped"},
},
}
@@ -99,7 +99,7 @@ func TestLexerMultiple(t *testing.T) {
}
tokens = append(tokens, tok)
}
assert.Equal(t, len(tc.expected), len(tokens), "expression: %s", tc.expr)
assert.Len(t, tokens, len(tc.expected), "expression: %s", tc.expr)
for i, kind := range tc.expected {
assert.Equal(t, kind, tokens[i].Kind, "expr %s token %d", tc.expr, i)
}

View File

@@ -22,13 +22,13 @@ func TestLexer(t *testing.T) {
for i, tok := range tokens {
t.Logf("Token %d: Kind=%v, Value=%v", i, tok.Kind, tok.Value)
}
assert.Equal(t, tokens[1].Kind, TokenKindDereference)
assert.Equal(t, TokenKindDereference, tokens[1].Kind)
}
func TestLexerNumbers(t *testing.T) {
table := []struct {
in string
out interface{}
out any
}{
{"-Infinity", math.Inf(-1)},
{"Infinity", math.Inf(1)},