From 968e34e00273d13675f02a6048787498bd2185b1 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 8 Feb 2014 09:50:20 -0800 Subject: [PATCH] Parse forward ticks (acute accents) just like backticks and warn. --- ShellCheck/Parser.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index f72b1d3..9fed43f 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -763,13 +763,14 @@ readSingleQuotedPart = prop_readBackTicked = isOk readBackTicked "`ls *.mp3`" prop_readBackTicked2 = isOk readBackTicked "`grep \"\\\"\"`" +prop_readBackTicked3 = isWarning readBackTicked "´grep \"\\\"\"´" readBackTicked = called "backtick expansion" $ do id <- getNextId pos <- getPosition - char '`' + backtick subStart <- getPosition - subString <- readGenericLiteral "`" - char '`' + subString <- readGenericLiteral "`´" + backtick -- Result positions may be off due to escapes result <- subParse subStart readCompoundList (unEscape subString) return $ T_Backticked id result @@ -778,6 +779,12 @@ readBackTicked = called "backtick expansion" $ do unEscape ('\\':x:rest) | x `elem` "$`\\" = x : unEscape rest unEscape ('\\':'\n':rest) = unEscape rest unEscape (c:rest) = c : unEscape rest + backtick = + disregard (char '`') <|> do + pos <- getPosition + char '´' + parseNoteAt pos ErrorC 1077 $ + "For command expansion, the tick should slant left (` vs ´)." subParse pos parser input = do lastPosition <- getPosition