summaryrefslogtreecommitdiff
path: root/parser.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-02-02 21:00:10 +0100
committertomsmeding <tom.smeding@gmail.com>2017-02-02 21:00:10 +0100
commitdd1a2323e743df5ca3109bae6e213cd7b02dddee (patch)
treea064a9197de268a934a2fb7564df8424d8882541 /parser.hs
parent9e67d68574bf4b78451469d5e149cfd95b0ec9f6 (diff)
Support 1U literals
Diffstat (limited to 'parser.hs')
-rw-r--r--parser.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/parser.hs b/parser.hs
index 3ba5e18..6e8b828 100644
--- a/parser.hs
+++ b/parser.hs
@@ -112,9 +112,14 @@ pParenExpr = do
return e
pLiteral :: Parser Literal
-pLiteral = (LitFloat <$> pFloat) <|> (LitInt <$> pInteger) <|> (LitInt <$> pCharStr)
+pLiteral = (LitFloat <$> pFloat) <|> pLitInt <|> (LitInt <$> pCharStr)
<|> (LitString <$> pString) <|> try pLitCall <|> (LitVar <$> pName)
+pLitInt :: Parser Literal
+pLitInt = do
+ i <- pInteger
+ liftM (maybe (LitInt i) (const $ LitUInt i)) $ optionMaybe (symbol "U")
+
pLitCall :: Parser Literal
pLitCall = do
n <- pName