From 78f88812b8cfda005455ebf08d626b6dd6f84ca6 Mon Sep 17 00:00:00 2001 From: peb Date: Wed, 2 Jun 2004 11:05:39 +0000 Subject: [PATCH] *** empty log message *** --- src/GF/Compile/ShellState.hs | 43 ++++++++++++++++++++++-------------- src/Makefile | 14 ++++++++---- 2 files changed, 37 insertions(+), 20 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)] diff --git a/src/Makefile b/src/Makefile index c6837d538..844e188b8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,8 +5,7 @@ GHCFLAGS=-package lang -package util -fglasgow-exts GHCOPTFLAGS=-O -package lang -package util -fglasgow-exts GHCFUDFLAG=-package Fudgets -HUGSTRACE = trace -HUGSINCLUDE =.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:parsing:conversions:$(HUGSTRACE): +HUGSINCLUDE =.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:parsing:conversions:trace: BASICINCLUDE =-iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -iparsing -iparsers -iconversions -inotrace GHCINCLUDE =-ifor-ghc $(BASICINCLUDE) GHCINCLUDENOFUD=-ifor-ghc-nofud $(BASICINCLUDE) @@ -38,8 +37,6 @@ justwindows: $(GHMAKE) $(GHCOPTFLAGS) $(WINDOWSINCLUDE) --make GF.hs -o gf2.exe ; strip gf2.exe ; mv gf2.exe ../bin/ nofud-links: cd for-ghc-nofud ; rm -f *.hs ; ln -s ../for-ghc/Arch.hs ; ln -s ../for-hugs/ArchEdit.hs ; cd .. -tracing: - make today ; $(GHMAKE) $(GHCFLAGS) -itrace $(GHCINCLUDENOFUD) --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/ batch: $(GHMAKE) $(GHCFLAGS) $(GHCINCLUDE) --make GF2.hs -o gf2 ; strip gf2 @@ -59,3 +56,12 @@ javac: cd java ; javac *.java ; cd .. help: cd util ; runhugs MkHelpFile ; mv HelpFile.hs .. ; cd .. + +# added by peb: +tracing: + $(GHMAKE) $(GHCFLAGS) -itrace $(GHCINCLUDENOFUD) --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/ +newparser: + $(GHMAKE) $(GHCFLAGS) -itrace -ifor-ghc-nofud -iapi -icompile -igrammar -iinfra -ishell -isource -icanonical -iuseGrammar -icf -inewparsing -iparsers --make GF.hs -o gf2 ; strip gf2 ; mv gf2 ../bin/ +newhugs: + hugs -h10M -P.:for-hugs:api:source:canonical:cf:grammar:infra:shell:useGrammar:compile:newparsing:trace: +