summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-10-16 08:27:43 +0000
committerbjorn <bjorn@bringert.net>2008-10-16 08:27:43 +0000
commitd1633b98d01233ad6ddf16105955ea9ea79be336 (patch)
tree6bd6d268f3bb884a075d0e250c3443ec810d6c4b /src
parent5422eb54d972ebccaa97e58a5fb3d60ca59a9604 (diff)
Honor --erasing flag from command-line also when compiling existing .gfo to PGF.
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile.hs2
-rw-r--r--src/GF/Compile/GrammarToGFCC.hs10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/GF/Compile.hs b/src/GF/Compile.hs
index 7aeab6b08..b652779d7 100644
--- a/src/GF/Compile.hs
+++ b/src/GF/Compile.hs
@@ -74,7 +74,7 @@ optimize opts = cse . suf
buildParser :: Options -> PGF -> PGF
buildParser opts =
- if flag optBuildParser opts then addParsers else id
+ if flag optBuildParser opts then addParsers opts else id
batchCompile :: Options -> [FilePath] -> IOE SourceGrammar
batchCompile opts files = do
diff --git a/src/GF/Compile/GrammarToGFCC.hs b/src/GF/Compile/GrammarToGFCC.hs
index 5b2d14586..51a99e632 100644
--- a/src/GF/Compile/GrammarToGFCC.hs
+++ b/src/GF/Compile/GrammarToGFCC.hs
@@ -50,15 +50,15 @@ mkCanon2gfcc opts cnc gr =
pars = mkParamLincat gr
-- Adds parsers for all concretes
-addParsers :: D.PGF -> D.PGF
-addParsers pgf = pgf { D.concretes = Map.map conv (D.concretes pgf) }
+addParsers :: Options -> D.PGF -> D.PGF
+addParsers opts pgf = pgf { D.concretes = Map.map conv (D.concretes pgf) }
where
conv cnc = cnc { D.parser = Just pinfo }
where
pinfo
- | Map.lookup (mkCId "erasing") (D.cflags cnc) == Just "on" = PMCFG.convertConcrete (D.abstract pgf) cnc
- | otherwise = FCFG.convertConcrete (D.abstract pgf) cnc
-
+ | flag optErasing (erasingFromCnc `addOptions` opts) = PMCFG.convertConcrete (D.abstract pgf) cnc
+ | otherwise = FCFG.convertConcrete (D.abstract pgf) cnc
+ erasingFromCnc = modifyFlags (\o -> o { optErasing = Map.lookup (mkCId "erasing") (D.cflags cnc) == Just "on"})
-- Generate PGF from GFCM.
-- this assumes a grammar translated by canon2canon