allow double backslash escape without quotes

Related #142
This commit is contained in:
Gokcehan committed 2019-08-05 22:28:55 +03:00
1 parent 488bf9f6b6
commit 6982ffe4cf
2 files changed
+7 -1

No files matched your search

+6
View File
@@ -101,6 +101,12 @@ var gEvalTests = []struct {
[]expr{&callExpr{"echo", []string{"hello\nworld"}, 1}}, []expr{&callExpr{"echo", []string{"hello\nworld"}, 1}},
}, },
{
`echo hello\\world`,
[]string{"echo", `hello\world`, "\n"},
[]expr{&callExpr{"echo", []string{`hello\world`}, 1}},
},
{ {
`echo hello\zworld`, `echo hello\zworld`,
[]string{"echo", "helloworld", "\n"}, []string{"echo", "helloworld", "\n"},
+1 -1
View File
@@ -293,7 +293,7 @@ scan:
for !s.eof && !isSpace(s.chr) && s.chr != ';' && s.chr != '#' { for !s.eof && !isSpace(s.chr) && s.chr != ';' && s.chr != '#' {
if s.chr == '\\' { if s.chr == '\\' {
s.next() s.next()
if isSpace(s.chr) { if isSpace(s.chr) || s.chr == '\\' {
buf = append(buf, s.chr) buf = append(buf, s.chr)
s.next() s.next()
} else { } else {