diff --git a/lexer/lexer.go b/lexer/lexer.go index 2c310a7..c7c978e 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -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.