mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-19 21:03:51 -07:00
Added recursive parsing support for ..
This commit is contained in:
parent
25ee7e20f4
commit
f820298b6e
3 changed files with 55 additions and 12 deletions
|
@ -656,16 +656,27 @@ readSingleQuotedPart =
|
|||
readSingleEscaped
|
||||
<|> anyChar `reluctantlyTill1` (singleQuote <|> backslash)
|
||||
|
||||
prop_readBackTicked = isWarning readBackTicked "`ls *.mp3`"
|
||||
prop_readBackTicked = isOk readBackTicked "`ls *.mp3`"
|
||||
readBackTicked = called "backtick expansion" $ do
|
||||
id <- getNextId
|
||||
parseNote WarningC "Use $(..) instead of deprecated `..` backtick expansion."
|
||||
pos <- getPosition
|
||||
char '`'
|
||||
f <- readGenericLiteral (char '`')
|
||||
subStart <- getPosition
|
||||
subString <- readGenericLiteral (char '`')
|
||||
char '`'
|
||||
return $ T_Backticked id f
|
||||
|
||||
result <- subParse subStart readCompoundList subString
|
||||
return $ T_Backticked id result
|
||||
where
|
||||
-- Position may be off due to escapes
|
||||
subParse pos parser input = do
|
||||
lastPosition <- getPosition
|
||||
lastInput <- getInput
|
||||
setPosition pos
|
||||
setInput input
|
||||
result <- parser
|
||||
setInput lastInput
|
||||
setPosition lastPosition
|
||||
return result
|
||||
|
||||
prop_readDoubleQuoted = isOk readDoubleQuoted "\"Hello $FOO\""
|
||||
readDoubleQuoted = called "double quoted string" $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue