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:
+4
-3
@@ -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/dict"
|
||||
"git.portale-stac.it/go-pkg/expr/util"
|
||||
)
|
||||
@@ -36,7 +37,7 @@ func evalDot(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
|
||||
switch unboxedValue := leftValue.(type) {
|
||||
case kern.ExtIterator:
|
||||
if indexTerm.Symbol() == scan.SymVariable /*|| indexTerm.Tk.Sym == scan.SymString */ {
|
||||
if indexTerm.Symbol() == sym.SymVariable /*|| indexTerm.Tk.Sym == sym.SymString */ {
|
||||
opName := indexTerm.Source()
|
||||
if unboxedValue.HasOperation(opName) {
|
||||
v, err = unboxedValue.CallOperation(opName, map[string]any{})
|
||||
@@ -61,7 +62,7 @@ func dotGetDictItemValue(ctx kern.ExprContext, d *dict.DictType, rightTerm *scan
|
||||
var ok bool
|
||||
var rightValue any
|
||||
s := rightTerm.Symbol()
|
||||
if s == scan.SymVariable || s == scan.SymString {
|
||||
if s == sym.SymVariable || s == sym.SymString {
|
||||
// src := rightTerm.Source()
|
||||
// if len(src) > 1 && src[0] == '"' && src[len(src)-1] == '"' {
|
||||
// src = src[1 : len(src)-1]
|
||||
@@ -87,5 +88,5 @@ func errDictKeyNotFound(term *scan.Term, key any) error {
|
||||
|
||||
// init
|
||||
func init() {
|
||||
scan.RegisterTermConstructor(scan.SymDot, newDotTerm)
|
||||
scan.RegisterTermConstructor(sym.SymDot, newDotTerm)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user