diff options
| author | peb <unknown> | 2005-05-11 09:28:16 +0000 |
|---|---|---|
| committer | peb <unknown> | 2005-05-11 09:28:16 +0000 |
| commit | 54a1e0f879be657863cdcaed37fa609241369e8f (patch) | |
| tree | f3d8e85111f792011393d83fa7c4bc5bc12f8852 /src/GF/UseGrammar | |
| parent | faa3144390363256e30df634b91b86d9f7522e1a (diff) | |
"Committed_by_peb"
Diffstat (limited to 'src/GF/UseGrammar')
| -rw-r--r-- | src/GF/UseGrammar/Custom.hs | 18 | ||||
| -rw-r--r-- | src/GF/UseGrammar/Parsing.hs | 42 |
2 files changed, 32 insertions, 28 deletions
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs index d6d310d36..2384ff736 100644 --- a/src/GF/UseGrammar/Custom.hs +++ b/src/GF/UseGrammar/Custom.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/05/09 09:28:46 $ +-- > CVS $Date: 2005/05/11 10:28:16 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.59 $ +-- > CVS $Revision: 1.60 $ -- -- A database for customizable GF shell commands. -- @@ -349,13 +349,13 @@ customStringCommand = customParser = customData "Parsers, selected by option -parser=x" $ [ - (strCI "chart", PCFOld.parse "ibn" . stateCF) -- DEPRECATED - ,(strCI "general", PCF.parse "gb" . stateCF) - ,(strCI "general-bottomup", PCF.parse "gt" . stateCF) - ,(strCI "general-topdown", PCF.parse "gt" . stateCF) - ,(strCI "incremental", PCF.parse "ib" . stateCF) - ,(strCI "incremental-bottomup", PCF.parse "ib" . stateCF) - ,(strCI "incremental-topdown", PCF.parse "it" . stateCF) + (strCI "bottomup", PCF.parse "gb" . stateCF) + ,(strCI "topdown", PCF.parse "gt" . stateCF) +-- commented for now, since there's a bug in the incremental algorithm: +-- ,(strCI "incremental", PCF.parse "ib" . stateCF) +-- ,(strCI "incremental-bottomup", PCF.parse "ib" . stateCF) +-- ,(strCI "incremental-topdown", PCF.parse "it" . stateCF) + ,(strCI "chart", PCFOld.parse "ibn" . stateCF) -- DEPRECATED ,(strCI "old", chartParser . stateCF) -- DEPRECATED ,(strCI "myparser", myParser) -- add your own parsers here diff --git a/src/GF/UseGrammar/Parsing.hs b/src/GF/UseGrammar/Parsing.hs index 82e9297a6..bdf179987 100644 --- a/src/GF/UseGrammar/Parsing.hs +++ b/src/GF/UseGrammar/Parsing.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/05/10 14:16:59 $ --- > CVS $Author: aarne $ --- > CVS $Revision: 1.22 $ +-- > CVS $Date: 2005/05/11 10:28:16 $ +-- > CVS $Author: peb $ +-- > CVS $Revision: 1.23 $ -- -- (Description of the module) ----------------------------------------------------------------------------- @@ -35,7 +35,7 @@ import GF.UseGrammar.Custom import GF.Compile.ShellState import GF.CF.PPrCF (prCFTree) -import qualified GF.OldParsing.ParseGFC as NewOld -- OBSOLETE +-- import qualified GF.OldParsing.ParseGFC as NewOld -- OBSOLETE import qualified GF.Parsing.GFC as New import GF.Data.Operations @@ -54,26 +54,30 @@ parseStringMsg os sg cat s = do return (ts,unlines ss) parseStringC :: Options -> StateGrammar -> CFCat -> String -> Check [Tree] -parseStringC opts0 sg cat s ---- to test peb's new parser 6/10/2003 ----- (to be obsoleted by "newer" below) - | oElem newParser opts0 = do - let pm = maybe "" id $ getOptVal opts0 useParser -- -parser=pm - ct = cfCat2Cat cat - ts <- checkErr $ NewOld.newParser pm sg ct s - mapM (checkErr . annotate (stateGrammarST sg) . refreshMetas []) ts - ----- to test peb's newer parser 7/4-05 - | oElem newerParser opts0 = do - let opts = unionOptions opts0 $ stateOptions sg - pm = maybe "" id $ getOptVal opts0 useParser -- -parser=pm - tok = customOrDefault opts useTokenizer customTokenizer sg - ts <- checkErr $ New.parse pm (pInfo sg) (absId sg) cat (tok s) +---- (obsoleted by "newer" below) +-- parseStringC opts0 sg cat s +-- | oElem newParser opts0 = do +-- let pm = maybe "" id $ getOptVal opts0 useParser -- -parser=pm +-- ct = cfCat2Cat cat +-- ts <- checkErr $ NewOld.newParser pm sg ct s +-- mapM (checkErr . annotate (stateGrammarST sg) . refreshMetas []) ts + +-- to use peb's newer parser 7/4-05 +parseStringC opts0 sg cat s + | oElem newCParser opts0 || oElem newMParser opts0 || oElem newParser opts0 || oElem newerParser opts0 = do + let opts = unionOptions opts0 $ stateOptions sg + algorithm | oElem newCParser opts0 = "c" + | oElem newMParser opts0 = "m" + | otherwise = "c" -- default algorithm + strategy = maybe "bottomup" id $ getOptVal opts useParser -- -parser=bottomup/topdown + tokenizer = customOrDefault opts useTokenizer customTokenizer sg + ts <- checkErr $ New.parse algorithm strategy (pInfo sg) (absId sg) cat (tokenizer s) ts' <- mapM (checkErr . annotate (stateGrammarST sg) . refreshMetas []) ts return $ optIntOrAll opts flagNumber ts' - | otherwise = do +parseStringC opts0 sg cat s = do let opts = unionOptions opts0 $ stateOptions sg cf = stateCF sg gr = stateGrammarST sg |
