From: simonmar Date: Thu, 9 Jan 2003 10:49:22 +0000 (+0000) Subject: [project @ 2003-01-09 10:49:21 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~1285 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=78dddbd277d766ec77d22a49867b580a0e19463b;p=ghc-hetmet.git [project @ 2003-01-09 10:49:21 by simonmar] Further refine the criteria for deciding whether command line arguments should be passed to the compilation manager or the linker. See comments in the file. MERGE TO STABLE --- diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index 224a9cc..abe7c01 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,7 +1,7 @@ {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.117 2002/12/19 09:37:32 simonmar Exp $ +-- $Id: Main.hs,v 1.118 2003/01/09 10:49:21 simonmar Exp $ -- -- GHC Driver program -- @@ -334,7 +334,23 @@ beginMake fileish_args = do when (failed ok_flag) (exitWith (ExitFailure 1)) return () where - looks_like_an_input m = haskellish_src_file m || '.' `notElem` m + {- + The following things should be considered compilation manager inputs: + + - haskell source files (strings ending in .hs, .lhs or other + haskellish extension), + + - module names (not forgetting hierarchical module names), + + - and finally we consider everything not containing a '.' to be + a comp manager input, as shorthand for a .hs or .lhs filename. + + Everything else is considered to be a linker object, and passed + straight through to the linker. + -} + looks_like_an_input m = haskellish_src_file m + || looksLikeModuleName m + || '.' `notElem` m beginInteractive :: [String] -> IO () diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs index 4949515..23c6f4e 100644 --- a/ghc/compiler/utils/Util.lhs +++ b/ghc/compiler/utils/Util.lhs @@ -792,7 +792,8 @@ Module names: \begin{code} looksLikeModuleName [] = False -looksLikeModuleName (c:cs) = isUpper c && all isAlphaNumEx cs - -isAlphaNumEx c = isAlphaNum c || c == '_' || c == '.' +looksLikeModuleName (c:cs) = isUpper c && go cs + where go [] = True + go ('.':cs) = looksLikeModuleName cs + go (c:cs) = (isAlphaNum c || c == '_') && go cs \end{code}