refactored data-types to reduce plugin sizes
This commit is contained in:
+2
-2
@@ -12,7 +12,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/util"
|
||||
)
|
||||
|
||||
@@ -518,7 +517,8 @@ func (scanner *Scanner) parseNumber(firstCh byte) (tk *Token) {
|
||||
if sym == SymFloat {
|
||||
value, err = strconv.ParseFloat(txt, 64)
|
||||
} else if sym == SymFraction {
|
||||
value, err = kern.MakeGeneratingFraction(txt)
|
||||
// value, err = kern.MakeGeneratingFraction(txt)
|
||||
value = txt
|
||||
} else {
|
||||
value, err = strconv.ParseInt(txt, numBase, 64)
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
)
|
||||
|
||||
func TestScanner(t *testing.T) {
|
||||
@@ -62,7 +60,6 @@ func TestScanner(t *testing.T) {
|
||||
/* 38 */ {`\`, SymError, errors.New("incomplete escape sequence"), nil},
|
||||
/* 39 */ {`"string"`, SymString, "string", nil},
|
||||
/* 40 */ {`identifier`, SymIdentifier, "identifier", nil},
|
||||
/* 41 */ {`1.2(3)`, SymFraction, kern.NewFraction(37, 30), nil},
|
||||
}
|
||||
|
||||
for i, input := range inputs {
|
||||
|
||||
@@ -199,15 +199,6 @@ func (t *Term) Compute(ctx kern.ExprContext) (v any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// func (term *term) toInt(computedValue any, valueDescription string) (i int, err error) {
|
||||
// if index64, ok := computedValue.(int64); ok {
|
||||
// i = int(index64)
|
||||
// } else {
|
||||
// err = term.Errorf("%s, got %s (%v)", valueDescription, TypeName(computedValue), computedValue)
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
func (t *Term) ErrIncompatibleTypes(leftValue, rightValue any) error {
|
||||
leftType := kern.TypeName(leftValue)
|
||||
leftText := kern.GetFormatted(leftValue, kern.Truncate)
|
||||
|
||||
Reference in New Issue
Block a user