Merge pull request #245 from octo/cartridge-return
scanner: Improve regular expression in "scanner".scanHeredoc().
This commit is contained in:
commit
c247bd0851
@ -153,6 +153,8 @@ func TestFormatValidOutput(t *testing.T) {
|
||||
cases := []string{
|
||||
"#\x00",
|
||||
"#\ue123t",
|
||||
"Y=<<4\n4/\n\n\n/4/@=4/\n\n\n/4000000004\r\r\n00004\n",
|
||||
"x=<<_\n_\r\r\n_\n",
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
|
@ -1,6 +1,7 @@
|
||||
obj {
|
||||
foo = [<<EOF
|
||||
TEXT!
|
||||
!!EOF
|
||||
EOF
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
obj {
|
||||
foo = [<<EOF
|
||||
TEXT!
|
||||
!!EOF
|
||||
EOF
|
||||
]
|
||||
}
|
||||
|
@ -440,9 +440,9 @@ func (s *Scanner) scanHeredoc() {
|
||||
|
||||
var identRegexp *regexp.Regexp
|
||||
if identBytes[0] == '-' {
|
||||
identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes[1:]))
|
||||
identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes[1:]))
|
||||
} else {
|
||||
identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes))
|
||||
identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes))
|
||||
}
|
||||
|
||||
// Read the actual string value
|
||||
|
Loading…
Reference in New Issue
Block a user