diff options
author | Ben Sima <ben@bsima.me> | 2023-08-10 21:07:15 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-10 21:07:15 -0400 |
commit | a86cfcf95b19de667c88594f71324ee3370b9776 (patch) | |
tree | dbcfb27b6c326806dc26b503dcaeee3ea06ea88d /Biz/Namespace.hs | |
parent | 44b1f8d5bc2ffcb00f56b0096476501e7e0cd458 (diff) |
Allow underscores in namespaces
Diffstat (limited to 'Biz/Namespace.hs')
-rw-r--r-- | Biz/Namespace.hs | 5 |
1 files changed, 3 insertions, 2 deletions
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.string "\nmodule " *> 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 |