1
0
forked from GitHub/gf-core

moved all old source code to src-2.9 ; src will be for GF 3 development

This commit is contained in:
aarne
2008-05-20 11:47:44 +00:00
parent 747965ec22
commit fda0fe408f
494 changed files with 116978 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
----------------------------------------------------------------------
-- |
-- Module : ParseCFG
-- Maintainer : PL
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/04/21 16:22:49 $
-- > CVS $Author: bringert $
-- > CVS $Revision: 1.2 $
--
-- Main parsing module for context-free grammars
-----------------------------------------------------------------------------
module GF.OldParsing.ParseCFG (parse) where
import Data.Char (toLower)
import GF.OldParsing.Utilities
import GF.OldParsing.CFGrammar
import qualified GF.OldParsing.ParseCFG.General as PGen
import qualified GF.OldParsing.ParseCFG.Incremental as PInc
parse :: (Ord n, Ord c, Ord t, Show t) =>
String -> CFParser n c t
parse = decodeParser . map toLower
decodeParser ['g',s] = PGen.parse (decodeStrategy s)
decodeParser ['i',s,f] = PInc.parse (decodeStrategy s, decodeFilter f)
decodeParser _ = decodeParser "ibn"
decodeStrategy 'b' = (True, False)
decodeStrategy 't' = (False, True)
decodeFilter 'a' = (True, True)
decodeFilter 'b' = (True, False)
decodeFilter 't' = (False, True)
decodeFilter 'n' = (False, False)