diff options
Diffstat (limited to 'src/GF/UseGrammar')
| -rw-r--r-- | src/GF/UseGrammar/Custom.hs | 22 | ||||
| -rw-r--r-- | src/GF/UseGrammar/Parsing.hs | 4 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs index d7cf99fa0..e5e59fc05 100644 --- a/src/GF/UseGrammar/Custom.hs +++ b/src/GF/UseGrammar/Custom.hs @@ -37,11 +37,12 @@ import GrammarToHaskell -- the cf parsing algorithms import ChartParser -- or some other CF Parser +import NewChartParser +import NewerChartParser -- grammar conversions -- peb 19/4-04 -- see also customGrammarPrinter -import qualified ConvertGrammar as CG -import TestConversions (prRaw) +import qualified ConvertGrammar as Cnv import MoreCustom -- either small/ or big/. The one in Small is empty. @@ -170,15 +171,11 @@ customGrammarPrinter = -} -- add your own grammar printers here -- grammar conversions, (peb) -{- ,(strCI "gfc_show", show . grammar2canon . stateGrammarST) - ,(strCI "gfc_raw", prRaw . stateGrammarST) - ,(strCI "tnf", prCanon . CG.convertCanonToTNF . stateGrammarST) - ,(strCI "mcfg", CG.prMCFG . CG.convertCanonToMCFG . stateGrammarST) - ,(strCI "mcfg_cf", prCF . CG.convertCanonToCFG . stateGrammarST) - ,(strCI "mcfg_canon", prCanon . CG.convertCanonToMCFG . stateGrammarST) - ,(strCI "mcfg_raw", prRaw . CG.convertCanonToMCFG . stateGrammarST) --} + ,(strCI "tnf", prCanon . Cnv.convertCanonToTNF . stateGrammarST) + ,(strCI "mcfg", Cnv.prMCFG . Cnv.convertCanonToMCFG . stateGrammarST) + ,(strCI "mcfg_cf", Cnv.prCFG . Cnv.convertCanonToCFG . stateGrammarST) + ,(strCI "mcfg_show", show . Cnv.convertCanonToMCFG . stateGrammarST) --- also include printing via grammar2syntax! ] ++ moreCustomGrammarPrinter @@ -262,6 +259,11 @@ customParser = (strCI "chart", chartParser . stateCF) -- add your own parsers here ] + -- 21/5-04, peb: + ++ [ (strCI ("new"++name), newChartParser descr . stateCF) | + (descr, names) <- newChartParserAlternatives, name <- names ] + ++ [ (strCI ("newer"++name), newerChartParser descr . stateParserInfo) | + (descr, names) <- newerChartParserAlternatives, name <- names ] ++ moreCustomParser customTokenizer = diff --git a/src/GF/UseGrammar/Parsing.hs b/src/GF/UseGrammar/Parsing.hs index 5d601bc58..91e811f22 100644 --- a/src/GF/UseGrammar/Parsing.hs +++ b/src/GF/UseGrammar/Parsing.hs @@ -60,7 +60,9 @@ parseStringC opts0 sg cat s tokens2trms :: Options ->StateGrammar ->Ident -> CFParser -> [CFTok] -> Check [Tree] tokens2trms opts sg cn parser as = do let res@(trees,info) = parser as - ts0 <- return $ nub (cfParseResults res) + ts0 <- return $ cfParseResults res -- removed nub, peb 25/5-04 + -- ts0 <- return $ nub (cfParseResults res) -- nub gives quadratic behaviour! + -- SortedList.nubsort is O(n log n) ts <- case () of _ | null ts0 -> checkWarn "No success in cf parsing" >> return [] _ | raw -> do |
