From 4ef30ca450a3b9ff8661c2528476e02514335d84 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 28 Nov 2013 13:27:45 +0000 Subject: [PATCH] SimpleEditor.Convert: adapt to recent character encoding changes Things got simpler! --- src/compiler/SimpleEditor/Convert.hs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/compiler/SimpleEditor/Convert.hs b/src/compiler/SimpleEditor/Convert.hs index 86580834a..686bdba3b 100644 --- a/src/compiler/SimpleEditor/Convert.hs +++ b/src/compiler/SimpleEditor/Convert.hs @@ -8,16 +8,10 @@ import qualified Data.Map as Map import Text.JSON(makeObj) --encode import Text.PrettyPrint(render,text,(<+>)) --- 4 extra imports just to deal with the ByteString mess... -import qualified Data.ByteString.Char8 as BS(pack) -import Codec.Binary.UTF8.String(encodeString) -import GF.Compile.Coding(decodeStringsInModule) -import System.IO(utf8) +import qualified Data.ByteString.UTF8 as UTF8(fromString) ---import GF.Compile.GetGrammar (getSourceModule) import GF.Infra.Option(optionsGFO) import GF.Infra.Ident(showIdent) ---import GF.Infra.UseIO(appIOE) import GF.Grammar.Grammar import GF.Grammar.Printer(ppParams,ppTerm,getAbs,TermPrintQual(..)) import GF.Grammar.Parser(runP,pModDef) @@ -31,10 +25,10 @@ import SimpleEditor.JSON parseModule (path,source) = (path.=) $ - case runP pModDef (BS.pack (encodeString source)) of + case runP pModDef (UTF8.fromString source) of Left (Pn l c,msg) -> makeObj ["error".=msg, "location".= show l++":"++show c] - Right mod -> case convModule (decodeStringsInModule utf8 mod) of + Right mod -> case convModule mod of Ok g -> makeObj ["converted".=g] Bad msg -> makeObj ["parsed".=msg]