Bump version of .gfo and .pgf files, improve error messages on version mismatch

Becacuse of the new special tokens added to the Symbol type, .gfo and .pgf
files produced with the current version of GF can not always be used with
older versions of GF and the PGF run-time system.

The PGF version number was increased from (2,0) to (2,1). GF can still
read version (2,0) and (1,0), so old PGF files continue to work.

The GFO version was increased from "GF03" to "GF04".
This commit is contained in:
hallgren
2015-06-23 12:58:14 +00:00
parent 984c09923c
commit 22ba8d34ff
4 changed files with 35 additions and 37 deletions

View File

@@ -20,7 +20,7 @@
module GF.Compile.ReadFiles
( getAllFiles,ModName,ModEnv,importsOfModule,
findFile,gfImports,gfoImports,
findFile,gfImports,gfoImports,VersionTagged(..),
parseSource,getOptionsFromFile,getPragmas) where
import Prelude hiding (catch)
@@ -32,7 +32,7 @@ import GF.Data.Operations
import GF.Grammar.Lexer
import GF.Grammar.Parser
import GF.Grammar.Grammar
import GF.Grammar.Binary(decodeModuleHeader)
import GF.Grammar.Binary(VersionTagged(..),decodeModuleHeader)
import System.IO(mkTextEncoding)
import GF.Text.Coding(decodeUnicodeIO)
@@ -107,10 +107,10 @@ getAllFiles opts ps env file = do
case st of
CSEnv -> return (st, (name, maybe [] snd mb_envmod))
CSRead -> do let gfo = if isGFO file then file else gf2gfo opts file
mb_imps <- gfoImports gfo
case mb_imps of
Just imps -> return (st,imps)
Nothing
t_imps <- gfoImports gfo
case t_imps of
Tagged imps -> return (st,imps)
WrongVersion
| isGFO file -> raise (file ++ " is compiled with different GF version and I can't find the source file")
| otherwise -> do imps <- gfImports opts file
return (CSComp,imps)
@@ -143,7 +143,7 @@ findFile gfoDir ps name =
gfImports opts file = importsOfModule `fmap` parseModHeader opts file
gfoImports gfo = fmap importsOfModule `fmap` liftIO (decodeModuleHeader gfo)
gfoImports gfo = fmap importsOfModule `fmap` decodeModuleHeader gfo
--------------------------------------------------------------------------------