Rename Unquotable to QuoteFree

This commit is contained in:
Vidar Holen 2014-03-22 10:27:59 -07:00
parent 60aafae21d
commit 50db49e2fb
1 changed files with 32 additions and 32 deletions

View File

@ -692,7 +692,7 @@ checkUnquotedExpansions params t =
check _ = return () check _ = return ()
tree = parentMap params tree = parentMap params
examine t = examine t =
unless (inUnquotableContext tree t || usedAsCommandName tree t) $ unless (isQuoteFree tree t || usedAsCommandName tree t) $
warn (getId t) 2046 "Quote this to prevent word splitting." warn (getId t) 2046 "Quote this to prevent word splitting."
@ -1094,19 +1094,19 @@ getTokenMap t =
f t = modify (Map.insert (getId t) t) f t = modify (Map.insert (getId t) t)
-- Should this entity be quoted? -- Is this node self quoting?
inUnquotableContext tree t = isQuoteFree tree t =
(isUnquotable t == Just True) || (isQuoteFreeElement t == Just True) ||
(head $ (mapMaybe isUnquotableContext $ drop 1 $ getPath tree t) ++ [False]) (head $ (mapMaybe isQuoteFreeContext $ drop 1 $ getPath tree t) ++ [False])
where
-- A usage that in itself doesn't require quotes -- Is this node self-quoting in itself?
isUnquotable t = isQuoteFreeElement t =
case t of case t of
T_Assignment {} -> return True T_Assignment {} -> return True
_ -> Nothing _ -> Nothing
-- A usage in which any subnode doesn't require quotes -- Are any subnodes inherently self-quoting?
isUnquotableContext t = isQuoteFreeContext t =
case t of case t of
TC_Noary _ DoubleBracket _ -> return True TC_Noary _ DoubleBracket _ -> return True
TC_Unary _ DoubleBracket _ _ -> return True TC_Unary _ DoubleBracket _ _ -> return True
@ -1883,7 +1883,7 @@ checkSpacefulness params t =
if spaced if spaced
&& (not $ "@" `isPrefixOf` name) -- There's another warning for this && (not $ "@" `isPrefixOf` name) -- There's another warning for this
&& (not $ isCounting token) && (not $ isCounting token)
&& (not $ inUnquotableContext parents token) && (not $ isQuoteFree parents token)
&& (not $ usedAsCommandName parents token) && (not $ usedAsCommandName parents token)
then return [(Note (getId token) InfoC 2086 warning)] then return [(Note (getId token) InfoC 2086 warning)]
else return [] else return []
@ -1972,7 +1972,7 @@ checkQuotesInLiterals params t =
assignment <- getQuotes name assignment <- getQuotes name
if isJust assignment if isJust assignment
&& not (isParamTo parents "eval" expr) && not (isParamTo parents "eval" expr)
&& not (inUnquotableContext parents expr) && not (isQuoteFree parents expr)
then return [ then return [
Note (fromJust assignment)WarningC 2089 $ Note (fromJust assignment)WarningC 2089 $
"Quotes/backslashes will be treated literally. Use an array.", "Quotes/backslashes will be treated literally. Use an array.",