Merge pull request #276 from hellerve/fix-char-macro-str

Escape chars in macro stringification
This commit is contained in:
Erik Svedäng 2018-08-17 14:54:37 +02:00 committed by GitHub
commit f1c4f10f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -684,7 +684,10 @@ commandStr :: CommandCallback
commandStr xs =
return (Right (XObj (Str (join (map f xs))) (Just dummyInfo) (Just StringTy)))
where f (XObj (Str s) _ _) = s
f x = pretty x
f x = escape $ pretty x
escape [] = []
escape ('\\':y) = "\\\\" ++ escape y
escape (x:y) = x : escape y
commandNot :: CommandCallback
commandNot [x] =