[parsing] Code cleanup

This commit is contained in:
Laura Hausmann 2024-09-07 02:12:35 +02:00
parent 37707a0712
commit 5889f3cd26
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -302,9 +302,13 @@ module private MfmParser =
let quoteNode = let quoteNode =
previousCharSatisfiesNot isNotNewline previousCharSatisfiesNot isNotNewline
>>. many1 (pchar '>' >>. (opt (pchar ' ')) >>. (many1Till inlineNode (skipNewline <|> eof))) >>. many1 (
.>> opt (attempt (skipNewline >>. (notFollowedBy <| pchar '>'))) pchar '>'
.>>. ((opt (attempt (skipNewline >>. (followedBy <| pchar '>')))) .>>. opt eof) >>. (opt <| pchar ' ')
>>. (many1Till inlineNode (skipNewline <|> eof))
)
.>> (opt <| attempt (skipNewline >>. (notFollowedBy <| pchar '>')))
.>>. (opt <| attempt (skipNewline >>. (followedBy <| pchar '>')) .>>. opt eof)
|>> fun (q, (followedByQuote, followedByEof)) -> |>> fun (q, (followedByQuote, followedByEof)) ->
MfmQuoteNode( MfmQuoteNode(
List.collect (fun e -> e @ [ (MfmCharNode('\n') :> MfmInlineNode) ]) q List.collect (fun e -> e @ [ (MfmCharNode('\n') :> MfmInlineNode) ]) q