gdritter repos s-cargot / 763f1a0
Finish R7RS token parser Getty Ritter 8 years ago
1 changed file(s) with 21 addition(s) and 2 deletion(s). Collapse all Expand all
8282 subsequent = initial <|> digit <|> specSubsequent
8383 specSubsequent = expSign <|> oneOf ".@"
8484 expSign = oneOf "+-"
85 symbolElement = undefined
86 peculiar = undefined
85 symbolElement = noneOf "\\|"
86 <|> hexEscape
87 <|> mnemEscape
88 <|> ('|' <$ string "\\|")
89 hexEscape = chr . fromIntegral <$> (string "\\x" *> hexNumber <* char ';')
90 mnemEscape = '\a' <$ string "\\a"
91 <|> '\b' <$ string "\\b"
92 <|> '\t' <$ string "\\t"
93 <|> '\n' <$ string "\\n"
94 <|> '\r' <$ string "\\r"
95 peculiar = (:[]) <$> expSign
96 <|> cons2 <$> expSign <*> signSub <*> many subsequent
97 <|> cons3 <$> expSign
98 <*> char '.'
99 <*> dotSub
100 <*> many subsequent
101 <|> cons2 <$> char '.' <*> dotSub <*> many subsequent
102 dotSub = signSub <|> char '.'
103 signSub = initial <|> expSign <|> char '@'
104 cons2 a b cs = a : b : cs
105 cons3 a b c ds = a : b : c : ds
87106
88107 -- | A helper function for defining parsers for arbitrary-base integers.
89108 -- The first argument will be the base, and the second will be the