mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-21 10:50:42 +08:00
End here doc tokens on < and >.
This commit is contained in:
@@ -1307,6 +1307,7 @@ prop_readHereDoc4 = isOk readHereDoc "<< foo\n`\nfoo"
|
|||||||
prop_readHereDoc5 = isOk readHereDoc "<<- !foo\nbar\n!foo"
|
prop_readHereDoc5 = isOk readHereDoc "<<- !foo\nbar\n!foo"
|
||||||
prop_readHereDoc6 = isOk readHereDoc "<< foo\\ bar\ncow\nfoo bar"
|
prop_readHereDoc6 = isOk readHereDoc "<< foo\\ bar\ncow\nfoo bar"
|
||||||
prop_readHereDoc7 = isOk readHereDoc "<< foo\n\\$(f ())\nfoo"
|
prop_readHereDoc7 = isOk readHereDoc "<< foo\n\\$(f ())\nfoo"
|
||||||
|
prop_readHereDoc8 = isOk readHereDoc "<<foo>>bar\netc\nfoo"
|
||||||
readHereDoc = called "here document" $ do
|
readHereDoc = called "here document" $ do
|
||||||
fid <- getNextId
|
fid <- getNextId
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
@@ -1349,7 +1350,7 @@ readHereDoc = called "here document" $ do
|
|||||||
liftM concat $ many1 (escaped <|> quoted <|> normal)
|
liftM concat $ many1 (escaped <|> quoted <|> normal)
|
||||||
where
|
where
|
||||||
quoted = liftM stripLiteral readDoubleQuotedLiteral <|> readSingleQuotedLiteral
|
quoted = liftM stripLiteral readDoubleQuotedLiteral <|> readSingleQuotedLiteral
|
||||||
normal = anyChar `reluctantlyTill1` (whitespace <|> oneOf ";&)'\"\\")
|
normal = anyChar `reluctantlyTill1` (whitespace <|> oneOf "<>;&)'\"\\")
|
||||||
escaped = do -- surely the user must be doing something wrong at this point
|
escaped = do -- surely the user must be doing something wrong at this point
|
||||||
char '\\'
|
char '\\'
|
||||||
c <- anyChar
|
c <- anyChar
|
||||||
|
Reference in New Issue
Block a user