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.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Language/Fiddle/Parser.hs b/src/Language/Fiddle/Parser.hs
index 7ef5ac4..ad96724 100644
--- a/src/Language/Fiddle/Parser.hs
+++ b/src/Language/Fiddle/Parser.hs
@@ -135,6 +135,9 @@ importStatementP =
<*> optionMaybe importListP
<*> pure Vacant
+nameToIdent :: PaS Identifier -> PaS Name
+nameToIdent ifn = withMeta $ Name . pure <$> ident
+
fiddleDeclP :: Pa FiddleDecl
fiddleDeclP = do
withMeta $ do
@@ -147,11 +150,11 @@ fiddleDeclP = do
<*> defer body packageBodyP
KWUsing -> UsingDecl Witness <$> name
KWLocation -> LocationDecl noQMd <$> ident <*> (tok TokEq >> constExpressionP)
- KWBits -> BitsDecl noQMd <$> ident <*> (tok TokColon >> bitTypeP)
+ KWBits -> BitsDecl noQMd <$> nameToIdent ident <*> (tok TokColon >> bitTypeP)
KWImport -> ImportDecl <$> importStatementP
KWType ->
ObjTypeDecl noQMd
- <$> ident
+ <$> nameToIdent ident
<*> ( do
tok_ TokColon
bt <- bodyTypeP
@@ -190,7 +193,7 @@ objTypeP = do
AnonymousObjType Witness <$> defer body (objTypeBodyP t)
)
-asConstP :: Pa (Expression u) -> Pa (ConstExpression u)
+asConstP :: Pa (Expression u) -> Pa (ConstExpression u)
asConstP fn = withMeta $ ConstExpression . RightV <$> fn
exprInParenP :: Pa (Expression u)