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{
|
cases := []string{
|
||||||
"#\x00",
|
"#\x00",
|
||||||
"#\ue123t",
|
"#\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 {
|
for _, c := range cases {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
obj {
|
obj {
|
||||||
foo = [<<EOF
|
foo = [<<EOF
|
||||||
TEXT!
|
TEXT!
|
||||||
|
!!EOF
|
||||||
EOF
|
EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
obj {
|
obj {
|
||||||
foo = [<<EOF
|
foo = [<<EOF
|
||||||
TEXT!
|
TEXT!
|
||||||
|
!!EOF
|
||||||
EOF
|
EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -440,9 +440,9 @@ func (s *Scanner) scanHeredoc() {
|
|||||||
|
|
||||||
var identRegexp *regexp.Regexp
|
var identRegexp *regexp.Regexp
|
||||||
if identBytes[0] == '-' {
|
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 {
|
} 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
|
// Read the actual string value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user