From a86cfcf95b19de667c88594f71324ee3370b9776 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 10 Aug 2023 21:07:15 -0400 Subject: Allow underscores in namespaces --- Biz/Namespace.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Biz/Namespace.hs') diff --git a/Biz/Namespace.hs b/Biz/Namespace.hs index f0e3b32..8cc6b5c 100644 --- a/Biz/Namespace.hs +++ b/Biz/Namespace.hs @@ -86,6 +86,7 @@ fromHaskellContent c = case Regex.findFirstInfix haskellModule c of Regex.many (name <|> dot)) <*> pure Hs +toModule :: Namespace -> String toModule (Namespace parts Hs) = joinWith "." parts toModule (Namespace parts Py) = joinWith "." parts toModule (Namespace parts Scm) = "(" ++ joinWith " " parts ++ ")" @@ -106,7 +107,7 @@ dot = Regex.some <| Regex.sym '.' name :: Regex.RE Char String name = Regex.many (Regex.psym Char.isUpper) - <> Regex.many (Regex.psym Char.isAlphaNum) + <> Regex.many (Regex.psym (\c -> Char.isAlphaNum c || (c == '_'))) rePath :: Regex.RE Char [String] rePath = Regex.many (name <* Regex.string "/" <|> name) @@ -130,4 +131,4 @@ reExt = -- inputs. isCab :: FilePath -> Bool isCab ('_' : _) = True -isCab fp = "_" `List.isInfixOf` fp +isCab fp = "/_/" `List.isInfixOf` fp -- cgit v1.2.3