on master help sign in
fix #279
commit115b139774a88e35b1aa480e1a100e388be9c06f authorEvan Czaplicki <info@elm-lang.org> dateMon 14 Oct 2013, 16:59 (13 years ago) parent0f9f8c0
1 file changed+4−1
compiler/Parse/Literal.hs+4−1
compiler/Parse/Literal.hs+4−1
@@ -14,10 +14,13 @@ num :: IParser Literal
1414num = fmap toLit (preNum <?> "number")
1515 where toLit n | '.' `elem` n = FloatNum (read n)
1616 | otherwise = IntNum (read n)
17− preNum = (++) <$> many1 digit <*> option "" postNum
17+ preNum = concat <$> sequence [ option "" minus, many1 digit, option "" postNum ]
1818 postNum = do try $ lookAhead (string "." >> digit)
1919 string "."
2020 ('.':) <$> many1 digit
21+ minus = try $ do string "-"
22+ lookAhead digit
23+ return "-"
2124
2225chr :: IParser Literal
2326chr = Chr <$> betwixt '\'' '\'' (backslashed <|> satisfy (/='\''))