summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/Fiddle/Parser.hs')
-rw-r--r--src/Language/Fiddle/Parser.hs28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/Language/Fiddle/Parser.hs b/src/Language/Fiddle/Parser.hs
index 00cce27..a2368ed 100644
--- a/src/Language/Fiddle/Parser.hs
+++ b/src/Language/Fiddle/Parser.hs
@@ -137,15 +137,15 @@ fiddleDeclP = do
case t of
KWOption -> OptionDecl <$> nextTextP <*> nextTextP
KWPackage ->
- PackageDecl ()
+ PackageDecl (pure ())
<$> name
<*> defer body packageBodyP
KWUsing -> UsingDecl (Witness ()) <$> name
- KWLocation -> LocationDecl () <$> ident <*> (tok TokEq >> expressionP)
- KWBits -> BitsDecl () <$> ident <*> (tok TokColon >> bitTypeP)
+ KWLocation -> LocationDecl (pure ()) <$> ident <*> (tok TokEq >> expressionP)
+ KWBits -> BitsDecl (pure ()) <$> ident <*> (tok TokColon >> bitTypeP)
KWImport -> ImportDecl <$> importStatementP
KWType ->
- ObjTypeDecl ()
+ ObjTypeDecl (pure ())
<$> ident
<*> ( do
tok_ TokColon
@@ -153,7 +153,7 @@ fiddleDeclP = do
defer body (objTypeBodyP bt)
)
KWInstance ->
- ObjectDecl ()
+ ObjectDecl (pure ())
<$> ident
<*> (tok KWAt *> expressionP)
<*> (tok TokColon *> objTypeP)
@@ -179,7 +179,7 @@ objTypeP = do
baseObjP :: P (A -> ObjType Parsed F A)
baseObjP =
- (ReferencedObjType () <$> name)
+ (ReferencedObjType (pure ()) <$> name)
<|> ( do
t <- bodyTypeP
AnonymousObjType (Witness ()) <$> defer body (objTypeBodyP t)
@@ -279,7 +279,7 @@ registerBitsTypeRefP = do
withMeta $
(RegisterBitsJustBits <$> exprInParenP)
<|> (RegisterBitsAnonymousType (Witness ()) <$> anonymousBitsTypeP)
- <|> (RegisterBitsReference () <$> name)
+ <|> (RegisterBitsReference (pure ()) <$> name)
anonymousBitsTypeP :: Pa AnonymousBitsType
anonymousBitsTypeP = withMeta $ do
@@ -307,12 +307,14 @@ enumConstantDeclP =
<|> (EnumConstantDecl <$> ident <*> (tok TokEq >> expressionP))
expressionP :: Pa Expression
-expressionP = withMeta $
- token $ \case
- (TokLitNum num) -> Just (LitNum num)
- (TokIdent i) -> Just $
- \(Commented cs s) -> Var (Identifier i (Commented [] s)) (Commented cs s)
- _ -> Nothing
+expressionP =
+ withMeta $
+ token
+ ( \case
+ (TokLitNum num) -> Just (LitNum num)
+ _ -> Nothing
+ )
+ <|> (Var <$> name)
body :: P [Token SourceSpan]
body = do