summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Compile/Coding.hs64
-rw-r--r--src/compiler/GF/CompilerAPI.hs2
-rw-r--r--src/compiler/GF/Data/Operations.hs36
-rw-r--r--src/compiler/GF/Interactive.hs5
-rw-r--r--src/compiler/GF/Interactive2.hs3
5 files changed, 1 insertions, 109 deletions
diff --git a/src/compiler/GF/Compile/Coding.hs b/src/compiler/GF/Compile/Coding.hs
deleted file mode 100644
index 65d385022..000000000
--- a/src/compiler/GF/Compile/Coding.hs
+++ /dev/null
@@ -1,64 +0,0 @@
-module GF.Compile.Coding where
-{-
-import GF.Grammar.Grammar
-import GF.Grammar.Macros
-import GF.Text.Coding
---import GF.Infra.Option
-import GF.Data.Operations
-
---import Data.Char
-import System.IO
-import qualified Data.ByteString.Char8 as BS
-
-encodeStringsInModule :: TextEncoding -> SourceModule -> SourceModule
-encodeStringsInModule enc = codeSourceModule (BS.unpack . encodeUnicode enc)
-
-decodeStringsInModule :: TextEncoding -> SourceModule -> SourceModule
-decodeStringsInModule enc mo = codeSourceModule (decodeUnicode enc . BS.pack) mo
-
-codeSourceModule :: (String -> String) -> SourceModule -> SourceModule
-codeSourceModule co (id,mo) = (id,mo{jments = mapTree codj (jments mo)})
- where
- codj (c,info) = case info of
- ResOper pty pt -> ResOper (codeLTerms co pty) (codeLTerms co pt)
- ResOverload es tyts -> ResOverload es [(codeLTerm co ty,codeLTerm co t) | (ty,t) <- tyts]
- CncCat mcat mdef mref mpr mpmcfg -> CncCat mcat (codeLTerms co mdef) (codeLTerms co mref) (codeLTerms co mpr) mpmcfg
- CncFun mty mt mpr mpmcfg -> CncFun mty (codeLTerms co mt) (codeLTerms co mpr) mpmcfg
- _ -> info
-
-codeLTerms co = fmap (codeLTerm co)
-
-codeLTerm :: (String -> String) -> L Term -> L Term
-codeLTerm = fmap . codeTerm
-
-codeTerm :: (String -> String) -> Term -> Term
-codeTerm co = codt
- where
- codt t = case t of
- K s -> K (co s)
- T ty cs -> T ty [(codp p,codt v) | (p,v) <- cs]
- EPatt p -> EPatt (codp p)
- _ -> composSafeOp codt t
-
- codp p = case p of --- really: composOpPatt
- PR rs -> PR [(l,codp p) | (l,p) <- rs]
- PString s -> PString (co s)
- PChars s -> PChars (co s)
- PT x p -> PT x (codp p)
- PAs x p -> PAs x (codp p)
- PNeg p -> PNeg (codp p)
- PRep p -> PRep (codp p)
- PSeq p q -> PSeq (codp p) (codp q)
- PAlt p q -> PAlt (codp p) (codp q)
- _ -> p
-
--- | Run an encoding function on all string literals within the given string.
-codeStringLiterals :: (String -> String) -> String -> String
-codeStringLiterals _ [] = []
-codeStringLiterals co ('"':cs) = '"' : inStringLiteral cs
- where inStringLiteral [] = error "codeStringLiterals: unterminated string literal"
- inStringLiteral ('"':ds) = '"' : codeStringLiterals co ds
- inStringLiteral ('\\':d:ds) = '\\' : co [d] ++ inStringLiteral ds
- inStringLiteral (d:ds) = co [d] ++ inStringLiteral ds
-codeStringLiterals co (c:cs) = c : codeStringLiterals co cs
--} \ No newline at end of file
diff --git a/src/compiler/GF/CompilerAPI.hs b/src/compiler/GF/CompilerAPI.hs
index c65b566c3..8415b4045 100644
--- a/src/compiler/GF/CompilerAPI.hs
+++ b/src/compiler/GF/CompilerAPI.hs
@@ -16,8 +16,6 @@ import GF.Compile.ReadFiles
import GF.Compile.Update
import GF.Compile.Refresh
-import GF.Compile.Coding
-
import GF.Grammar.Grammar
import GF.Grammar.Lookup
import GF.Grammar.Printer
diff --git a/src/compiler/GF/Data/Operations.hs b/src/compiler/GF/Data/Operations.hs
index 7e16b6d17..cb9b3f9ac 100644
--- a/src/compiler/GF/Data/Operations.hs
+++ b/src/compiler/GF/Data/Operations.hs
@@ -247,42 +247,6 @@ chunks sep ws = case span (/= sep) ws of
readIntArg :: String -> Int
readIntArg n = if (not (null n) && all isDigit n) then read n else 0
-{-
--- state monad with error; from Agda 6/11/2001
-
-newtype STM s a = STM (s -> Err (a,s))
-
-appSTM :: STM s a -> s -> Err (a,s)
-appSTM (STM f) s = f s
-
-stm :: (s -> Err (a,s)) -> STM s a
-stm = STM
-
-stmr :: (s -> (a,s)) -> STM s a
-stmr f = stm (\s -> return (f s))
-
-instance Functor (STM s) where fmap = liftM
-
-instance Applicative (STM s) where
- pure = return
- (<*>) = ap
-
-instance Monad (STM s) where
- return a = STM (\s -> return (a,s))
- STM c >>= f = STM (\s -> do
- (x,s') <- c s
- let STM f' = f x
- f' s')
-
-readSTM :: STM s s
-readSTM = stmr (\s -> (s,s))
-
-updateSTM :: (s -> s) -> STM s ()
-updateSTM f = stmr (\s -> ((),f s))
-
-writeSTM :: s -> STM s ()
-writeSTM s = stmr (const ((),s))
--}
-- | @return ()@
done :: Monad m => m ()
done = return ()
diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs
index 184ff7c96..7eb873fbc 100644
--- a/src/compiler/GF/Interactive.hs
+++ b/src/compiler/GF/Interactive.hs
@@ -1,10 +1,10 @@
{-# LANGUAGE CPP, ScopedTypeVariables, FlexibleInstances #-}
-- | GF interactive mode
module GF.Interactive (mainGFI,mainRunGFI,mainServerGFI) where
+
import Prelude hiding (putStrLn,print)
import qualified Prelude as P(putStrLn)
import GF.Command.Interpreter(CommandEnv(..),mkCommandEnv,interpretCommandLine)
---import GF.Command.Importing(importSource,importGrammar)
import GF.Command.Commands(PGFEnv,HasPGFEnv(..),pgf,pgfEnv,pgfCommands)
import GF.Command.CommonCommands(commonCommands,extend)
import GF.Command.SourceCommands
@@ -19,9 +19,6 @@ import GF.Infra.UseIO(ioErrorText,putStrLnE)
import GF.Infra.SIO
import GF.Infra.Option
import qualified System.Console.Haskeline as Haskeline
---import GF.Text.Coding(decodeUnicode,encodeUnicode)
-
---import GF.Compile.Coding(codeTerm)
import PGF
import PGF.Internal(abstract,funs,lookStartCat,emptyPGF)
diff --git a/src/compiler/GF/Interactive2.hs b/src/compiler/GF/Interactive2.hs
index ac8887bec..eaf149c3d 100644
--- a/src/compiler/GF/Interactive2.hs
+++ b/src/compiler/GF/Interactive2.hs
@@ -17,9 +17,6 @@ import GF.Infra.UseIO(ioErrorText,putStrLnE)
import GF.Infra.SIO
import GF.Infra.Option
import qualified System.Console.Haskeline as Haskeline
---import GF.Text.Coding(decodeUnicode,encodeUnicode)
-
---import GF.Compile.Coding(codeTerm)
import qualified PGF2 as C
import qualified PGF as H