lexer: add re-quote helper
This commit is contained in:
parent
639da11ab3
commit
f0f0ff7904
@ -2,12 +2,17 @@ package lexer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func isWhitespace(r byte) bool {
|
||||
return (r == ' ' || r == '\t' || r == '\r' || r == '\n')
|
||||
}
|
||||
|
||||
func Quote(input string) string {
|
||||
return `"` + strings.ReplaceAll(strings.ReplaceAll(input, `\`, `\\`), `"`, `\"`) + `"`
|
||||
}
|
||||
|
||||
// Fields splits a string into separate tokens using something kind of vaguely
|
||||
// like how SQL would do it.
|
||||
// The result still includes the quote and backslash characters.
|
||||
|
Loading…
Reference in New Issue
Block a user