1
Fork 0

tidy up the number parser

This commit is contained in:
Jake Wheat 2013-12-14 11:47:13 +02:00
parent 8ef799740c
commit cd7a15c193

View file

@ -707,15 +707,13 @@ make this choice.
> where > where
> int = many1 digit > int = many1 digit
> fract p = dot p >>= fracts > fract p = dot p >>= fracts
> -- todo: use some helper functions to improve the > dot p = (p++) <$> string "."
> -- unclear pointfree code here
> dot p = ((p++) . (:[])) <$> char '.'
> fracts p = (p++) <$> int > fracts p = (p++) <$> int
> expon p = do > expon p = concat <$> sequence
> void $ char 'e' > [return p
> s <- option "" ((:[]) <$> (char '+' <|> char '-')) > ,string "e"
> i <- int > ,option "" (string "+" <|> string "-")
> return (p ++ "e" ++ s ++ i) > ,int]
lexer for integer literals which appear in some places in sql lexer for integer literals which appear in some places in sql