From: simonmar Date: Tue, 15 Oct 2002 13:17:40 +0000 (+0000) Subject: [project @ 2002-10-15 13:17:40 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~1540 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=7e4c6988e433eb561bf0dbbb8d88503adf7c38bd;p=ghc-hetmet.git [project @ 2002-10-15 13:17:40 by simonmar] Move looksLikeModuleName here from InterativeUI, so we can use it elsewhere. --- diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs index 119ae82..9cc5c58 100644 --- a/ghc/compiler/utils/Util.lhs +++ b/ghc/compiler/utils/Util.lhs @@ -44,6 +44,9 @@ module Util ( unzipWith, global, + + -- module names + looksLikeModuleName, ) where #include "../includes/config.h" @@ -64,6 +67,8 @@ import qualified List ( elem, notElem ) import List ( zipWith4 ) #endif +import Char ( isUpper, isAlphaNum ) + infixr 9 `thenCmp` \end{code} @@ -782,3 +787,12 @@ Global variables: global :: a -> IORef a global a = unsafePerformIO (newIORef a) \end{code} + +Module names: + +\begin{code} +looksLikeModuleName [] = False +looksLikeModuleName (c:cs) = isUpper c && all isAlphaNumEx cs + +isAlphaNumEx c = isAlphaNum c || c == '_' || c == '.' +\end{code}