eval: add write, eval arguments before applying function

This commit is contained in:
2018-05-15 22:13:43 +02:00
parent 45822a2ecd
commit 6413bd7e81
4 changed files with 53 additions and 16 deletions

View File

@@ -76,17 +76,20 @@ func parseValue(input []string) (*ast.AST, error, []string) {
}
if input[0][0] == '"' {
agg := []string{input[0]}
start := input[0]
agg := []string{start}
input = input[1:]
for {
if len(input) == 0 {
return nil, errors.New("Unmatched \""), input
}
token := input[0]
input = input[1:]
agg = append(agg, token)
if token[len(token)-1] == '"' {
break
if start[len(start)-1] != '"' {
for {
if len(input) == 0 {
return nil, errors.New("Unmatched \""), input
}
token := input[0]
input = input[1:]
agg = append(agg, token)
if token[len(token)-1] == '"' {
break
}
}
}
joined := strings.Join(agg, " ")