Fix parsing here docs like << '#foo' (#947)
This commit is contained in:
parent
79d6066450
commit
b064cf3038
|
@ -1610,6 +1610,7 @@ prop_readHereDoc9 = isOk readScript "if true; then cat << foo; fi\nbar\nfoo\n"
|
||||||
prop_readHereDoc10= isOk readScript "if true; then cat << foo << bar; fi\nfoo\nbar\n"
|
prop_readHereDoc10= isOk readScript "if true; then cat << foo << bar; fi\nfoo\nbar\n"
|
||||||
prop_readHereDoc11= isOk readScript "cat << foo $(\nfoo\n)lol\nfoo\n"
|
prop_readHereDoc11= isOk readScript "cat << foo $(\nfoo\n)lol\nfoo\n"
|
||||||
prop_readHereDoc12= isOk readScript "cat << foo|cat\nbar\nfoo"
|
prop_readHereDoc12= isOk readScript "cat << foo|cat\nbar\nfoo"
|
||||||
|
prop_readHereDoc13= isOk readScript "cat <<'#!'\nHello World\n#!\necho Done"
|
||||||
readHereDoc = called "here document" $ do
|
readHereDoc = called "here document" $ do
|
||||||
fid <- getNextId
|
fid <- getNextId
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
|
@ -1644,11 +1645,11 @@ readPendingHereDocs = do
|
||||||
readDoc (T_HereDoc id dashed quoted endToken _) = do
|
readDoc (T_HereDoc id dashed quoted endToken _) = do
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
hereData <- anyChar `reluctantlyTill` do
|
hereData <- anyChar `reluctantlyTill` do
|
||||||
spacing
|
many linewhitespace
|
||||||
string endToken
|
string endToken
|
||||||
disregard (char '\n') <|> eof
|
disregard (char '\n') <|> eof
|
||||||
do
|
do
|
||||||
spaces <- spacing
|
spaces <- many linewhitespace
|
||||||
verifyHereDoc dashed quoted spaces hereData
|
verifyHereDoc dashed quoted spaces hereData
|
||||||
string endToken
|
string endToken
|
||||||
parsedData <- parseHereData quoted pos hereData
|
parsedData <- parseHereData quoted pos hereData
|
||||||
|
|
Loading…
Reference in New Issue