add quoting for single quote

This commit is contained in:
Gokcehan committed 2016-11-22 21:31:20 +03:00
1 parent 91ad00a294
commit 87434d3fe6
2 files changed
+27

No files matched your search

+18
View File
@@ -23,6 +23,24 @@ var gTests = []struct {
nil,
},
{
"echo hello",
[]string{"echo", "hello", "\n"},
[]Expr{&CallExpr{"echo", []string{"hello"}}},
},
{
"echo hello world",
[]string{"echo", "hello", "world", "\n"},
[]Expr{&CallExpr{"echo", []string{"hello", "world"}}},
},
{
"echo 'hello world'",
[]string{"echo", "hello world", "\n"},
[]Expr{&CallExpr{"echo", []string{"hello world"}}},
},
{
"set hidden # trailing comments are allowed",
[]string{"set", "hidden", "\n"},
+9
View File
@@ -203,6 +203,15 @@ scan:
s.next()
}
goto scan
case s.chr == '\'':
s.next()
beg := s.off
for !s.eof && s.chr != '\'' {
s.next()
}
s.typ = TokenIdent
s.tok = string(s.buf[beg:s.off])
s.next()
case s.chr == ':':
s.typ = TokenColon
s.tok = ":"