on master help sign in
allow for negative IntAtoms in TutorialD parser
commitb8d7e0b6dc2a63e3ffd948e627017e8acd318e16 authorAgentM <agentm@themactionfaction.com> dateTue 30 Jun 2015, 15:53 (11 years ago) parent59ca1a8
2 files changed+4−3
TutorialD/Interpreter/Base.hs+3 TutorialD/Interpreter/RelationalExpr.hs+1−3
TutorialD/Interpreter/Base.hs+3
@@ -44,6 +44,9 @@ semi = Token.semi lexer
4444whiteSpace :: Parser ()
4545whiteSpace = Token.whiteSpace lexer
4646
47+integer :: Parser (Integer)
48+integer = Token.integer lexer
49+
4750atomTypeToTutDType :: AtomType -> Maybe T.Text
4851atomTypeToTutDType atomType = case atomType of
4952 StringAtomType -> Just "char"
TutorialD/Interpreter/RelationalExpr.hs+1−3
@@ -240,9 +240,7 @@ stringAtomP :: Parser Atom
240240stringAtomP = liftA (StringAtom . T.pack) (string "\"" *> many quotedChar <* string "\"")
241241
242242intAtomP :: Parser Atom
243−intAtomP = do
244− intstr <- many1 digit
245− return $ IntAtom (read intstr)
243+intAtomP = (IntAtom . fromIntegral) <$> integer
246244
247245boolAtomP :: Parser Atom
248246boolAtomP = do