New ScanExt() function allowing the introductory character to be chosen
This commit is contained in:
parent
d297530309
commit
ccdd5c5cdb
@ -10,8 +10,6 @@ import (
|
||||
"git.portale-stac.it/go-pkg/golang"
|
||||
)
|
||||
|
||||
const varIntro = '$'
|
||||
|
||||
type ExpanderFunc func(ctx ExpanderContext, varValue string, args []string) (result string, err error)
|
||||
|
||||
type ExpanderFuncBlock struct {
|
||||
|
@ -17,11 +17,18 @@ const (
|
||||
// Flags symbols in the abova iota order
|
||||
const flagSymbols = "!=*"
|
||||
|
||||
const defaultVarIntro = '$'
|
||||
|
||||
|
||||
type VariableHandler interface {
|
||||
Handle(varSpec string, flags ScannerFlag) (value string, err error)
|
||||
}
|
||||
|
||||
func Scan(handler VariableHandler, source string) (result string, err error) {
|
||||
return ScanExt(defaultVarIntro, handler, source)
|
||||
}
|
||||
|
||||
func ScanExt(varIntro byte, handler VariableHandler, source string) (result string, err error) {
|
||||
var spec, value string
|
||||
var flags ScannerFlag
|
||||
var backSlash bool
|
||||
|
Loading…
Reference in New Issue
Block a user