Parse empty and comment-only backtick expansions.

This commit is contained in:
Vidar Holen 2014-07-26 12:07:59 -07:00
parent 39423ddf81
commit b000b05507
1 changed files with 9 additions and 1 deletions

View File

@ -811,6 +811,8 @@ prop_readBackTicked3 = isWarning readBackTicked "´grep \"\\\"\"´"
prop_readBackTicked4 = isOk readBackTicked "`echo foo\necho bar`"
prop_readBackTicked5 = isOk readSimpleCommand "echo `foo`bar"
prop_readBackTicked6 = isWarning readSimpleCommand "echo `foo\necho `bar"
prop_readBackTicked7 = isOk readSimpleCommand "`#inline comment`"
prop_readBackTicked8 = isOk readSimpleCommand "echo `#comment` \\\nbar baz"
readBackTicked = called "backtick expansion" $ do
id <- getNextId
startPos <- getPosition
@ -826,7 +828,7 @@ readBackTicked = called "backtick expansion" $ do
suggestForgotClosingQuote startPos endPos "backtick expansion"
-- Result positions may be off due to escapes
result <- subParse subStart readCompoundList (unEscape subString)
result <- subParse subStart readTermOrNone (unEscape subString)
return $ T_Backticked id result
where
unEscape [] = []
@ -1390,6 +1392,12 @@ readAndOr = do
then andOr
else T_Annotation aid annotations andOr
readTermOrNone = do
allspacing
readTerm <|> do
eof
return []
readTerm = do
allspacing
m <- readAndOr