Skip to content

Commit 1925962

Browse files
committed
fix another bug
1 parent 52a0a73 commit 1925962

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

persistent/Database/Persist/Quasi/Internal/ModelParser.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ data Attribute
274274
data DirectiveArgument
275275
= -- This is too unstructured. We should rework directive parsing and make this smarter.
276276
DText Text
277+
| DParenthetical Text
277278
| -- | Quoted directive arguments are deprecated since 2.17.1.0.
278279
DQuotation Text
279280
deriving (Eq, Ord, Show)
@@ -860,13 +861,16 @@ directiveArgument = do
860861
where
861862
isQuotedArgumentError (FancyError _ s) = s == Set.singleton (ErrorFail quotedArgumentErrorMessage)
862863
isQuotedArgumentError _ = False
864+
parentheticalInner = do
865+
str <- parenthetical'
866+
pure . init . drop 1 $ str
863867
directiveArgument' = do
864868
q <- lookAhead (optional $ char '"')
865869
case q of
866870
Just _ -> fail quotedArgumentErrorMessage
867871
Nothing ->
868872
choice
869-
[ DText . Text.pack <$> parenthetical'
873+
[ DParenthetical . Text.pack . init . drop 1 <$> L.lexeme spaceConsumer parenthetical'
870874
, DText . Text.pack <$> some directiveArgumentChar
871875
]
872876
-- This big random-looking character class is a sign that the parser is too lax.
@@ -904,6 +908,7 @@ directiveArgument = do
904908
directiveArgumentContent :: DirectiveArgument -> Text
905909
directiveArgumentContent = \case
906910
DText t -> t
911+
DParenthetical t -> t
907912
DQuotation t -> t
908913

909914
directive :: Parser Member

0 commit comments

Comments
 (0)