diff options
Diffstat (limited to 'DSL.hs')
| -rw-r--r-- | DSL.hs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -82,7 +82,12 @@ wsL :: DSLLexer wsL = buildDSLLexer (mult1 $ satisfy isSpace) (const T_WHITESPACE) intLiteralL :: DSLLexer -intLiteralL = buildDSLLexer (mult1 $ satisfy isDigit) (T_INT_LITERAL . read) +intLiteralL = buildDSLLexer go (T_INT_LITERAL . read) + where + go = do + sign <- optional $ token '-' + digits <- mult1 $ satisfy isDigit + result $ maybe digits (:digits) sign mainLexer :: Parser Char [DSLToken] mainLexer = phrase $ mult1 $ firstOf subLexers |
