From b064cf303824a2a9e3e256cd04aaf5269a0bb753 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Fri, 7 Jul 2017 22:24:17 -0700 Subject: [PATCH] Fix parsing here docs like << '#foo' (#947) --- ShellCheck/Parser.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 7adc22f..d28cd56 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -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_readHereDoc11= isOk readScript "cat << foo $(\nfoo\n)lol\nfoo\n" prop_readHereDoc12= isOk readScript "cat << foo|cat\nbar\nfoo" +prop_readHereDoc13= isOk readScript "cat <<'#!'\nHello World\n#!\necho Done" readHereDoc = called "here document" $ do fid <- getNextId pos <- getPosition @@ -1644,11 +1645,11 @@ readPendingHereDocs = do readDoc (T_HereDoc id dashed quoted endToken _) = do pos <- getPosition hereData <- anyChar `reluctantlyTill` do - spacing + many linewhitespace string endToken disregard (char '\n') <|> eof do - spaces <- spacing + spaces <- many linewhitespace verifyHereDoc dashed quoted spaces hereData string endToken parsedData <- parseHereData quoted pos hereData