From 98f5c48d473ef3ad1c9e97197e1376b4e071582b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 5 Nov 2012 00:25:58 -0800 Subject: [PATCH] Made lonely dollar not match $'..' --- Shpell/Parser.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shpell/Parser.hs b/Shpell/Parser.hs index 5373751..0e8a77f 100644 --- a/Shpell/Parser.hs +++ b/Shpell/Parser.hs @@ -512,8 +512,9 @@ readVariableName = do readDollarLonely = do id <- getNextId - parseNote StyleC "$ is not used specially and should therefore be escaped" char '$' + n <- lookAhead (anyChar <|> (eof >> return '_')) + when (n /= '\'') $ parseNote StyleC "$ is not used specially and should therefore be escaped" return $ T_Literal id "$" prop_readHereDoc = isOk readHereDoc "<< foo\nlol\ncow\nfoo" @@ -781,11 +782,12 @@ readDoGroup = do prop_readForClause = isOk readForClause "for f in *; do rm \"$f\"; done" prop_readForClause2 = isOk readForClause "for f in *; do ..." +prop_readForClause3 = isOk readForClause "for f; do foo; done" readForClause = do (T_For id) <- g_For spacing name <- readVariableName - allspacing + spacing values <- readInClause <|> (readSequentialSep >> return []) group <- readDoGroup <|> (allspacing >> eof >> return []) -- stunted support return $ T_ForIn id name values group