summaryrefslogtreecommitdiff
path: root/src/GF/Parsing/CFG.hs
diff options
context:
space:
mode:
authorpeb <unknown>2005-04-20 11:49:44 +0000
committerpeb <unknown>2005-04-20 11:49:44 +0000
commit78108f7817fbf3269bb75f278eb9a8540737873e (patch)
tree6fc47a586e0d4eb223fc5b1bc3a25b1ef77762c8 /src/GF/Parsing/CFG.hs
parent5621344c73f75f6d5a89ec77c6a4b432f391b16d (diff)
"Committed_by_peb"
Diffstat (limited to 'src/GF/Parsing/CFG.hs')
-rw-r--r--src/GF/Parsing/CFG.hs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/GF/Parsing/CFG.hs b/src/GF/Parsing/CFG.hs
index 3133e8758..051e8bab0 100644
--- a/src/GF/Parsing/CFG.hs
+++ b/src/GF/Parsing/CFG.hs
@@ -4,9 +4,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/04/14 18:38:36 $
+-- > CVS $Date: 2005/04/20 12:49:44 $
-- > CVS $Author: peb $
--- > CVS $Revision: 1.2 $
+-- > CVS $Revision: 1.3 $
--
-- CFG parsing
-----------------------------------------------------------------------------
@@ -14,6 +14,8 @@
module GF.NewParsing.CFG
(parseCF, module GF.NewParsing.CFG.PInfo) where
+import Operations (Err(..))
+
import GF.Formalism.Utilities
import GF.Formalism.CFG
import GF.NewParsing.CFG.PInfo
@@ -24,17 +26,19 @@ import qualified GF.NewParsing.CFG.General as Gen
----------------------------------------------------------------------
-- parsing
-parseCF :: (Ord n, Ord c, Ord t) => String -> CFParser c n t
-parseCF "gb" = Gen.parse bottomup
-parseCF "gt" = Gen.parse topdown
-parseCF "ib" = Inc.parse (bottomup, noFilter)
-parseCF "it" = Inc.parse (topdown, noFilter)
-parseCF "ibFT" = Inc.parse (bottomup, topdown)
-parseCF "ibFB" = Inc.parse (bottomup, bottomup)
-parseCF "ibFTB" = Inc.parse (bottomup, bothFilters)
-parseCF "itF" = Inc.parse (topdown, bottomup)
+parseCF :: (Ord n, Ord c, Ord t) => String -> Err (CFParser c n t)
+parseCF "gb" = Ok $ Gen.parse bottomup
+parseCF "gt" = Ok $ Gen.parse topdown
+parseCF "ib" = Ok $ Inc.parse (bottomup, noFilter)
+parseCF "it" = Ok $ Inc.parse (topdown, noFilter)
+parseCF "ibFT" = Ok $ Inc.parse (bottomup, topdown)
+parseCF "ibFB" = Ok $ Inc.parse (bottomup, bottomup)
+parseCF "ibFTB" = Ok $ Inc.parse (bottomup, bothFilters)
+parseCF "itF" = Ok $ Inc.parse (topdown, bottomup)
-- default parser:
-parseCF _ = parseCF "gb"
+parseCF "" = parseCF "gb"
+-- error parser:
+parseCF prs = Bad $ "Parser not defined: " ++ prs
bottomup = (True, False)
topdown = (False, True)