summaryrefslogtreecommitdiff
path: root/src/GF/Compile
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Compile')
-rw-r--r--src/GF/Compile/ShellState.hs43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs
index 3a7151ad8..c6a6a0a20 100644
--- a/src/GF/Compile/ShellState.hs
+++ b/src/GF/Compile/ShellState.hs
@@ -21,7 +21,8 @@ import Ident
import Arch (ModTime)
-- peb 25/5-04
-import CFtoCFG
+-- import CFtoCFG
+import qualified ConvertGrammar as Cnv
import List (nub,nubBy)
@@ -36,7 +37,8 @@ data ShellState = ShSt {
srcModules :: G.SourceGrammar , -- saved resource modules
cfs :: [(Ident,CF)] , -- context-free grammars
-- peb 25/5-04:
- cfParserInfos :: [(Ident, CFParserInfo)], -- parser information
+-- cfParserInfos :: [(Ident, CFParserInfo)], -- parser information
+ cfParserInfos :: Cnv.CFParserInfo, -- peb 27/5-04
morphos :: [(Ident,Morpho)], -- morphologies
gloptions :: Options, -- global options
readFiles :: [(FilePath,ModTime)],-- files read
@@ -59,7 +61,8 @@ emptyShellState = ShSt {
canModules = M.emptyMGrammar,
srcModules = M.emptyMGrammar,
cfs = [],
- cfParserInfos = [], -- peb 25/5-04
+-- cfParserInfos = [], -- peb 25/5-04
+ cfParserInfos = Cnv.emptyParserInfo, -- peb 27/5-04
morphos = [],
gloptions = noOptions,
readFiles = [],
@@ -78,7 +81,8 @@ data StateGrammar = StGr {
cncId :: Ident,
grammar :: CanonGrammar,
cf :: CF,
- cfParserInfo :: CFParserInfo, -- peb 25/5-04
+-- cfParserInfo :: CFParserInfo, -- peb 25/5-04
+ cfParserInfo :: Cnv.CFParserInfo, -- peb 27/5-04
morpho :: Morpho,
loptions :: Options
}
@@ -88,7 +92,8 @@ emptyStateGrammar = StGr {
cncId = identC "#EMPTY", ---
grammar = M.emptyMGrammar,
cf = emptyCF,
- cfParserInfo = emptyParserInfo, -- peb 25/5-04
+-- cfParserInfo = emptyParserInfo, -- peb 25/5-04
+ cfParserInfo = Cnv.emptyParserInfo, -- peb 27/5-04
morpho = emptyMorpho,
loptions = noOptions
}
@@ -96,6 +101,7 @@ emptyStateGrammar = StGr {
-- analysing shell grammar into parts
stateGrammarST = grammar
stateCF = cf
+--stateParserInfo= cfParserInfo
stateParserInfo= cfParserInfo
stateMorpho = morpho
stateOptions = loptions
@@ -127,7 +133,8 @@ updateShellState opts sh (gr,(sgr,rts)) = do
concr0 = ifNull Nothing (return . last) concrs
notInrts f = notElem f $ map fst rts
cfs <- mapM (canon2cf opts cgr) concrs --- would not need to update all...
- let parserInfos = map cf2parserInfo cfs -- peb 25/5-04
+-- let parserInfos = map cf2parserInfo cfs -- peb 25/5-04
+ let parserInfos = Cnv.convertCanonToCFParserInfo gr -- peb 27/5-04
let funs = funRulesOf cgr
let cats = allCatsOf cgr
@@ -146,7 +153,8 @@ updateShellState opts sh (gr,(sgr,rts)) = do
canModules = cgr,
srcModules = src,
cfs = zip concrs cfs,
- cfParserInfos = zip concrs parserInfos, -- peb 25/5-04
+-- cfParserInfos = zip concrs parserInfos, -- peb 25/5-04
+ cfParserInfos = parserInfos, -- peb 27/5-04
morphos = zip concrs (map (mkMorpho cgr) concrs),
gloptions = opts,
readFiles = [ft | ft@(f,_) <- readFiles sh, notInrts f] ++ rts,
@@ -191,7 +199,8 @@ purgeShellState sh = ShSt {
canModules = M.MGrammar $ purge $ M.modules $ canModules sh,
srcModules = M.emptyMGrammar,
cfs = cfs sh,
- cfParserInfos = cfParserInfos sh, -- peb 25/5-04
+-- cfParserInfos = cfParserInfos sh, -- peb 25/5-04
+ cfParserInfos = cfParserInfos sh, -- peb 27/5-04
morphos = morphos sh,
gloptions = gloptions sh,
readFiles = [],
@@ -248,7 +257,8 @@ stateGrammarOfLang st l = StGr {
cncId = l,
grammar = can,
cf = maybe emptyCF id (lookup l (cfs st)),
- cfParserInfo = maybe emptyParserInfo id (lookup l (cfParserInfos st)), -- peb 25/5-04
+-- cfParserInfo = maybe emptyParserInfo id (lookup l (cfParserInfos st)), -- peb 25/5-04
+ cfParserInfo = cfParserInfos st, -- peb 27/5-04
morpho = maybe emptyMorpho id (lookup l (morphos st)),
loptions = errVal noOptions $ lookupOptionsCan can
}
@@ -278,7 +288,8 @@ stateAbstractGrammar st = StGr {
cncId = identC "#Cnc", ---
grammar = canModules st, ---- only abstarct ones
cf = emptyCF,
- cfParserInfo = emptyParserInfo,
+-- cfParserInfo = emptyParserInfo, -- peb 25/5-04
+ cfParserInfo = Cnv.emptyParserInfo, -- peb 27/5-04
morpho = emptyMorpho,
loptions = gloptions st ----
}
@@ -401,8 +412,8 @@ languageOn = languageOnOff True
languageOff = languageOnOff False
languageOnOff :: Bool -> Language -> ShellStateOper
-languageOnOff b lang (ShSt a c cs cg sg cfs pinfs ms os fs cats sts) =
- ShSt a c cs' cg sg cfs pinfs ms os fs cats sts where
+languageOnOff b lang (ShSt a c cs cg sg cfs pinfos ms os fs cats sts) =
+ ShSt a c cs' cg sg cfs pinfos ms os fs cats sts where
cs' = [if lang==l then ((l,c),b) else i | i@((l,c),_) <- cs]
{-
@@ -419,12 +430,12 @@ removeLanguage :: Language -> ShellStateOper
removeLanguage lang (ShSt (ab,gs,os)) = ShSt (ab,removeAssoc lang gs, os)
-}
changeOptions :: (Options -> Options) -> ShellStateOper
-changeOptions f (ShSt a c cs can src cfs pinfs ms os ff ts ss) =
- ShSt a c cs can src cfs pinfs ms (f os) ff ts ss
+changeOptions f (ShSt a c cs can src cfs pinfos ms os ff ts ss) =
+ ShSt a c cs can src cfs pinfos ms (f os) ff ts ss
changeModTimes :: [(FilePath,ModTime)] -> ShellStateOper
-changeModTimes mfs (ShSt a c cs can src cfs pinfs ms os ff ts ss) =
- ShSt a c cs can src cfs pinfs ms os ff' ts ss
+changeModTimes mfs (ShSt a c cs can src cfs pinfos ms os ff ts ss) =
+ ShSt a c cs can src cfs pinfos ms os ff' ts ss
where
ff' = mfs ++ [mf | mf@(f,_) <- ff, notElem f (map fst mfs)]