< and > should be included in symbols

Issue #1 closed
Miëtek Bak created an issue

The EDN spec missed this, but the omission has since been corrected:

https://github.com/edn-format/edn/issues/62

https://github.com/edn-format/edn/commit/a51127aecd318096667ae0dafa25353ecb07c9c3

The following change seems to help:

diff --git a/src/Data/EDN/Parser.hs b/src/Data/EDN/Parser.hs
index a307a47..3de4c16 100644
--- a/src/Data/EDN/Parser.hs
+++ b/src/Data/EDN/Parser.hs
@@ -128,27 +128,27 @@ parseCharacter = do
 parseSymbol :: Parser Value
 parseSymbol = do
     skipSoC
-    c <- satisfy (inClass "a-zA-Z.*/!?$%&=+_-")
+    c <- satisfy (inClass "a-zA-Z.*/!?$%&=+_<>-")
     (ns, val) <- withNS c <|> withoutNS c
     return $! Symbol ns val
     where
         withNS c = do
-            ns <- takeWhile (inClass "a-zA-Z0-9#:.*!?$%&=+_-")
+            ns <- takeWhile (inClass "a-zA-Z0-9#:.*!?$%&=+_<>-")
             char '/'
-            vc <- satisfy (inClass "a-zA-Z.*/!?$%&=+_-")
-            val <- takeWhile1 (inClass "a-zA-Z0-9#:.*!?$%&=+_-")
+            vc <- satisfy (inClass "a-zA-Z.*/!?$%&=+_<>-")
+            val <- takeWhile1 (inClass "a-zA-Z0-9#:.*!?$%&=+_<>-")
             return (c `BS.cons` ns, vc `BS.cons` val)

         withoutNS c = do
-            val <- takeWhile (inClass "a-zA-Z0-9#:.*!?$%&=+_-")
+            val <- takeWhile (inClass "a-zA-Z0-9#:.*!?$%&=+_<>-")
             return ("", c `BS.cons` val)

 parseKeyword :: Parser Value
 parseKeyword = do
     skipSoC
     char ':'
-    c <- satisfy   (inClass "a-zA-Z.*/!?$%&=+_-")
-    x <- takeWhile (inClass "a-zA-Z0-9#:.*/!?$%&=+_-")
+    c <- satisfy   (inClass "a-zA-Z.*/!?$%&=+_<>-")
+    x <- takeWhile (inClass "a-zA-Z0-9#:.*/!?$%&=+_<>-")
     return $! Keyword (c `BS.cons` x)

 parseNumber :: Parser Value

Comments (2)

  1. Log in to comment