From da0d596946cf21e2f275dd03b40c0a6c0824f66b Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 11 Oct 2024 18:45:34 -0600 Subject: Change 'Expression' to use numbers with units. This helps to catch bugs in the compiler, specifically ones related to mixing up bits and bytes. --- src/Language/Fiddle/Parser.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Language/Fiddle/Parser.hs') diff --git a/src/Language/Fiddle/Parser.hs b/src/Language/Fiddle/Parser.hs index 8d2eab2..8070c1c 100644 --- a/src/Language/Fiddle/Parser.hs +++ b/src/Language/Fiddle/Parser.hs @@ -190,7 +190,7 @@ objTypeP = do AnonymousObjType Witness <$> defer body (objTypeBodyP t) ) -exprInParenP :: Pa Expression +exprInParenP :: Pa (Expression u) exprInParenP = tok TokLParen *> expressionP <* tok TokRParen objTypeBodyP :: BodyType F (Commented SourceSpan) -> Pa ObjTypeBody @@ -311,12 +311,12 @@ enumConstantDeclP = (tok KWReserved >> EnumConstantReserved <$> (tok TokEq >> expressionP)) <|> (EnumConstantDecl <$> ident <*> (tok TokEq >> expressionP)) -expressionP :: Pa Expression +expressionP :: Pa (Expression u) expressionP = withMeta $ token ( \case - (TokLitNum num) -> Just (LitNum num) + (TokLitNum num) -> Just (LitNum $ LeftV num) _ -> Nothing ) <|> (Var <$> name) -- cgit