diff options
Diffstat (limited to 'src/Language/Fiddle/Parser.hs')
-rw-r--r-- | src/Language/Fiddle/Parser.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Language/Fiddle/Parser.hs b/src/Language/Fiddle/Parser.hs index f3cbfee..ebc3d8d 100644 --- a/src/Language/Fiddle/Parser.hs +++ b/src/Language/Fiddle/Parser.hs @@ -30,6 +30,9 @@ type Pa (a :: Stage -> (Type -> Type) -> Type -> Type) = P (a 'Parsed F (Comment type PaS (a :: (Type -> Type) -> Type -> Type) = P (a F (Commented SourceSpan)) +noQMd :: F (QMd Parsed t) +noQMd = pure Vacant + commentP :: P Comment commentP = token $ \case @@ -139,15 +142,15 @@ fiddleDeclP = do case t of KWOption -> OptionDecl <$> nextTextP <*> nextTextP KWPackage -> - PackageDecl (pure ()) + PackageDecl noQMd <$> name <*> defer body packageBodyP KWUsing -> UsingDecl Witness <$> name - KWLocation -> LocationDecl (pure ()) <$> ident <*> (tok TokEq >> expressionP) - KWBits -> BitsDecl (pure ()) <$> ident <*> (tok TokColon >> bitTypeP) + KWLocation -> LocationDecl noQMd <$> ident <*> (tok TokEq >> expressionP) + KWBits -> BitsDecl noQMd <$> ident <*> (tok TokColon >> bitTypeP) KWImport -> ImportDecl <$> importStatementP KWType -> - ObjTypeDecl (pure ()) + ObjTypeDecl noQMd <$> ident <*> ( do tok_ TokColon @@ -155,7 +158,7 @@ fiddleDeclP = do defer body (objTypeBodyP bt) ) KWInstance -> - ObjectDecl (pure ()) + ObjectDecl noQMd <$> ident <*> (tok KWAt *> expressionP) <*> (tok TokColon *> objTypeP) @@ -181,7 +184,7 @@ objTypeP = do baseObjP :: P (A -> ObjType Parsed F A) baseObjP = - (ReferencedObjType (pure ()) <$> name) + (ReferencedObjType noQMd <$> name) <|> ( do t <- bodyTypeP AnonymousObjType Witness <$> defer body (objTypeBodyP t) @@ -281,7 +284,7 @@ registerBitsTypeRefP = do withMeta $ (RegisterBitsJustBits <$> exprInParenP) <|> (RegisterBitsAnonymousType Witness <$> anonymousBitsTypeP) - <|> (RegisterBitsReference (pure ()) <$> name) + <|> (RegisterBitsReference noQMd <$> name) anonymousBitsTypeP :: Pa AnonymousBitsType anonymousBitsTypeP = withMeta $ do |