Make dependency on HSX *optional*. Use ./configure --enable-hsx to use it
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
{-# OPTIONS -fglasgow-exts #-}
|
||||
{-# OPTIONS -cpp -fglasgow-exts #-}
|
||||
--
|
||||
-- Copyright (C) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons
|
||||
--
|
||||
@ -24,11 +24,19 @@ module System.Plugins.Parser (
|
||||
replaceModName
|
||||
) where
|
||||
|
||||
#include "../../../config.h"
|
||||
|
||||
import Data.List
|
||||
import Data.Char
|
||||
import Data.Either
|
||||
|
||||
#if defined(WITH_HSX)
|
||||
import Language.Haskell.Hsx
|
||||
#else
|
||||
import Language.Haskell.Parser
|
||||
import Language.Haskell.Syntax
|
||||
import Language.Haskell.Pretty
|
||||
#endif
|
||||
|
||||
--
|
||||
-- | parse a file (as a string) as Haskell src
|
||||
@ -38,7 +46,11 @@ parse :: FilePath -- ^ module name
|
||||
-> Either String HsModule -- ^ abstract syntax
|
||||
|
||||
parse f fsrc =
|
||||
#if defined(WITH_HSX)
|
||||
case parseFileContentsWithMode (ParseMode f) fsrc of
|
||||
#else
|
||||
case parseModuleWithMode (ParseMode f) fsrc of
|
||||
#endif
|
||||
ParseOk src -> Right src
|
||||
ParseFailed loc _ -> Left $ srcmsg loc
|
||||
where
|
||||
|
@ -69,7 +69,6 @@ import Data.List
|
||||
import System.IO
|
||||
import System.Environment ( getEnv )
|
||||
import System.Directory
|
||||
import qualified Control.Exception as Control.Exception (handle)
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- some misc types we use
|
||||
|
@ -32,6 +32,6 @@ exposed-modules:
|
||||
c-sources:
|
||||
Language/Hi/hschooks.c
|
||||
includes: Linker.h
|
||||
Build-Depends: base, haskell98, Cabal, haskell-src-exts>=0.2
|
||||
Build-Depends: base, haskell98, Cabal, @HASKELL_SRC@
|
||||
ghc-options: -Wall -O -fvia-C -funbox-strict-fields -fno-warn-missing-signatures -threaded
|
||||
|
Reference in New Issue
Block a user