diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-02-02 21:00:10 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-02-02 21:00:10 +0100 |
commit | dd1a2323e743df5ca3109bae6e213cd7b02dddee (patch) | |
tree | a064a9197de268a934a2fb7564df8424d8882541 /parser.hs | |
parent | 9e67d68574bf4b78451469d5e149cfd95b0ec9f6 (diff) |
Support 1U literals
Diffstat (limited to 'parser.hs')
-rw-r--r-- | parser.hs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |