From c119d5e34b565361bf4026fb4debe95d311f82d0 Mon Sep 17 00:00:00 2001 From: krangelov Date: Fri, 20 Sep 2019 14:07:07 +0200 Subject: [PATCH] silence encoding error --- src/compiler/GF/Compile/GetGrammar.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs index 0813d15d2..ac2681989 100644 --- a/src/compiler/GF/Compile/GetGrammar.hs +++ b/src/compiler/GF/Compile/GetGrammar.hs @@ -50,18 +50,13 @@ getSourceModule opts file0 = Right (i,mi0) -> do liftIO $ removeTemp tmp let mi =mi0 {mflags=mflags mi0 `addOptions` opts, msrc=file0} - optCoding' = renameEncoding `fmap` flag optEncoding (mflags mi0) - case (optCoding,optCoding') of - (Nothing,Nothing) -> - unless (BS.all isAscii raw) $ - ePutStrLn $ file0++":\n Warning: default encoding has changed from Latin-1 to UTF-8" - (_,Just coding') -> - when (coding/=coding') $ + case renameEncoding `fmap` flag optEncoding (mflags mi0) of + Just coding' -> + when (coding/=coding') $ raise $ "Encoding mismatch: "++coding++" /= "++coding' where coding = maybe defaultEncoding renameEncoding optCoding _ -> return () - --liftIO $ transcodeModule' (i,mi) -- old lexer - return (i,mi) -- new lexer + return (i,mi) getBNFCRules :: Options -> FilePath -> IOE [BNFCRule] getBNFCRules opts fpath = do