several changes:
1. moved scan/symbol.go to new package sym and adapted all files that reference Symbol type and its values. 2. new type interval defined by begin, end and step values. 3. replaced operator-range.go with operator-interval.go. 4. replaced range operator begin:end with begin..end..step. 5. new implementation of sub-collection extraction based on new interval literal.
This commit is contained in:
+5
-4
@@ -7,6 +7,7 @@ package expr
|
||||
import (
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/scan"
|
||||
"git.portale-stac.it/go-pkg/expr/sym"
|
||||
"git.portale-stac.it/go-pkg/expr/types"
|
||||
"git.portale-stac.it/go-pkg/expr/types/float"
|
||||
)
|
||||
@@ -41,14 +42,14 @@ func evalSign(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
}
|
||||
|
||||
if float.IsFloat(rightValue) {
|
||||
if opTerm.Tk.Sym == scan.SymChangeSign {
|
||||
if opTerm.Tk.Sym == sym.SymChangeSign {
|
||||
f, _ := rightValue.(float64)
|
||||
v = -f
|
||||
} else {
|
||||
v = rightValue
|
||||
}
|
||||
} else if types.IsInteger(rightValue) {
|
||||
if opTerm.Tk.Sym == scan.SymChangeSign {
|
||||
if opTerm.Tk.Sym == sym.SymChangeSign {
|
||||
i, _ := rightValue.(int64)
|
||||
v = -i
|
||||
} else {
|
||||
@@ -62,6 +63,6 @@ func evalSign(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
|
||||
// init
|
||||
func init() {
|
||||
scan.RegisterTermConstructor(scan.SymUnchangeSign, newPlusSignTerm)
|
||||
scan.RegisterTermConstructor(scan.SymChangeSign, newMinusSignTerm)
|
||||
scan.RegisterTermConstructor(sym.SymUnchangeSign, newPlusSignTerm)
|
||||
scan.RegisterTermConstructor(sym.SymChangeSign, newMinusSignTerm)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user