Switch to edit mode.
Name(s): _unquote1: "_unquote(string) (auxiliary for :to_value())"
2: "reads string as if it were preceded by a quote, reading up to the closing quote if any, then returns the corresponding unquoted string."
3: " => {0, string unquoted} if there is no closing quote"
4: " => {original string beyond closing quote, string unquoted} otherwise"
5: rest = args[1]
6: result = ""
7: while (m = match(rest, "\\.?%|\""))
8: "Find the next special character"
9: if (rest[pos = m[1]] == "\"")
10: return {rest[pos + 1..length(rest)], result + rest[1..pos - 1]}
11: endif
12: result = result + rest[1..pos - 1] + rest[pos + 1..m[2]]
13: rest = rest[m[2] + 1..length(rest)]
14: endwhile
15: return {0, result + rest}