[parsing] Support mentions of unicode usernames

This commit is contained in:
Laura Hausmann 2024-05-27 11:33:23 +02:00
parent 35153a9080
commit cc161f1b32
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -110,6 +110,7 @@ module private MfmParser =
let isNotWhitespace c = Char.IsWhiteSpace c = false let isNotWhitespace c = Char.IsWhiteSpace c = false
let isAsciiLetterOrNumber c = Char.IsAsciiLetter c || Char.IsDigit c let isAsciiLetterOrNumber c = Char.IsAsciiLetter c || Char.IsDigit c
let isLetterOrNumber c = Char.IsLetterOrDigit c
let (|CharNode|MfmNode|) (x: MfmNode) = let (|CharNode|MfmNode|) (x: MfmNode) =
if x :? MfmCharNode then if x :? MfmCharNode then
@ -231,9 +232,9 @@ module private MfmParser =
previousCharSatisfiesNot isNotWhitespace previousCharSatisfiesNot isNotWhitespace
>>. skipString "@" >>. skipString "@"
>>. many1Chars ( >>. many1Chars (
satisfy isAsciiLetterOrNumber satisfy isLetterOrNumber
<|> pchar '_' <|> pchar '_'
<|> attempt (anyOf ".-" .>> nextCharSatisfies isAsciiLetterOrNumber) <|> attempt (anyOf ".-" .>> nextCharSatisfies isLetterOrNumber)
) )
.>>. opt (skipChar '@' >>. domain) .>>. opt (skipChar '@' >>. domain)
.>> (lookAhead .>> (lookAhead