Use fewer pattern matches
This commit is contained in:
parent
a31b71c2d8
commit
057f6fba10
@ -36,15 +36,15 @@ go (esc:c:cl) curarg accargs quote
|
|||||||
= if isEscapable c
|
= if isEscapable c
|
||||||
then go cl (c:curarg) accargs quote
|
then go cl (c:curarg) accargs quote
|
||||||
else go (c:cl) (esc: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
|
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
|
-- space separates argumetns outside quotes
|
||||||
| isSpace c && isNothing quotes
|
| isSpace c, isNothing quotes
|
||||||
= if null curarg
|
= if null curarg
|
||||||
then go cl curarg accargs quotes
|
then go cl curarg accargs quotes
|
||||||
else go cl [] (reverse curarg : accargs) quotes
|
else go cl [] (reverse curarg : accargs) quotes
|
||||||
|
Loading…
Reference in New Issue
Block a user