From 057f6fba1037ddd2a1b4ed5b56715b6348c3b84c Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 20 Dec 2015 08:24:14 +0300 Subject: [PATCH] Use fewer pattern matches --- src/GHCMod/Options/ShellEscape.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GHCMod/Options/ShellEscape.hs b/src/GHCMod/Options/ShellEscape.hs index 01aee7e..1e45d9c 100644 --- a/src/GHCMod/Options/ShellEscape.hs +++ b/src/GHCMod/Options/ShellEscape.hs @@ -36,15 +36,15 @@ go (esc:c:cl) curarg accargs quote = if isEscapable c then go cl (c:curarg) accargs quote else go (c:cl) (esc:curarg) accargs quote --- quote character -- opens quotes -go (c:cl) curarg accargs Nothing - | isQuote c = go cl curarg accargs (Just c) --- close quotes -go (c:cl) curarg accargs (Just q) - | c == q = go cl curarg accargs Nothing go (c:cl) curarg accargs quotes + -- quote character -- opens quotes + | isQuote c, isNothing quotes + = go cl curarg accargs (Just c) + -- close quotes + | quotes == Just c + = go cl curarg accargs Nothing -- space separates argumetns outside quotes - | isSpace c && isNothing quotes + | isSpace c, isNothing quotes = if null curarg then go cl curarg accargs quotes else go cl [] (reverse curarg : accargs) quotes