1
0
forked from GitHub/gf-core

GFI: adapt to character encoding changes

GF.Compile.Coding is not used any more.
This commit is contained in:
hallgren
2013-11-28 13:55:08 +00:00
parent 4ef30ca450
commit dcf07aaad6
2 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
module GF.Compile.Coding where
{-
import GF.Grammar.Grammar
import GF.Grammar.Macros
import GF.Text.Coding
@@ -61,3 +61,4 @@ codeStringLiterals co ('"':cs) = '"' : inStringLiteral cs
inStringLiteral ('\\':d:ds) = '\\' : co [d] ++ inStringLiteral ds
inStringLiteral (d:ds) = co [d] ++ inStringLiteral ds
codeStringLiterals co (c:cs) = c : codeStringLiterals co cs
-}

View File

@@ -24,9 +24,9 @@ import GF.Infra.UseIO(ioErrorText)
import GF.Infra.SIO
import GF.Infra.Option
import qualified System.Console.Haskeline as Haskeline
import GF.Text.Coding(decodeUnicode,encodeUnicode)
--import GF.Text.Coding(decodeUnicode,encodeUnicode)
import GF.Compile.Coding(codeTerm)
--import GF.Compile.Coding(codeTerm)
import PGF
import PGF.Data
@@ -35,9 +35,10 @@ import PGF.Macros
import Data.Char
import Data.List(nub,isPrefixOf,isInfixOf,partition)
import qualified Data.Map as Map
import qualified Data.ByteString.Char8 as BS
--import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.UTF8 as UTF8(fromString)
import qualified Text.ParserCombinators.ReadP as RP
import System.IO(utf8)
--import System.IO(utf8)
--import System.CPUTime(getCPUTime)
import System.Directory({-getCurrentDirectory,-}getAppUserDataDirectory)
import Control.Exception(SomeException,fromException,evaluate,try)
@@ -183,18 +184,18 @@ execute1 opts gfenv0 s0 =
"-old":ws' -> (False,ws')
_ -> (flag optNewComp opts,ws)
case runP pExp (encodeUnicode utf8 s) of
case runP pExp (UTF8.fromString s) of
Left (_,msg) -> putStrLn msg
Right t -> putStrLn . err id (showTerm sgr style q)
. checkComputeTerm' new sgr
$ codeTerm (decodeUnicode utf8 . BS.pack) t
$ {-codeTerm (decodeUnicode utf8 . BS.pack)-} t
continue gfenv
show_deps ws = do
let (os,xs) = partition (isPrefixOf "-") ws
ops <- case xs of
_:_ -> do
let ts = [t | Right t <- map (runP pExp . encodeUnicode utf8) xs]
let ts = [t | Right t <- map (runP pExp . UTF8.fromString) xs]
err error (return . nub . concat) $ mapM (constantDepsTerm sgr) ts
_ -> error "expected one or more qualified constants as argument"
let prTerm = showTerm sgr TermPrintDefault Qualified
@@ -217,7 +218,7 @@ execute1 opts gfenv0 s0 =
let isRaw = elem "-raw" os
ops <- case ts of
_:_ -> do
let Right t = runP pExp (encodeUnicode utf8 (unwords ts))
let Right t = runP pExp (UTF8.fromString (unwords ts))
ty <- err error return $ checkComputeTerm sgr t
return $ allOpersTo sgr ty
_ -> return $ allOpers sgr