mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 17:52:51 -06:00
"Committed_by_peb"
This commit is contained in:
43
src/GF/OldParsing/ParseCFG.hs
Normal file
43
src/GF/OldParsing/ParseCFG.hs
Normal file
@@ -0,0 +1,43 @@
|
||||
----------------------------------------------------------------------
|
||||
-- |
|
||||
-- Module : ParseCFG
|
||||
-- Maintainer : PL
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/04/11 13:52:54 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.1 $
|
||||
--
|
||||
-- Main parsing module for context-free grammars
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
module GF.OldParsing.ParseCFG (parse) where
|
||||
|
||||
import 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)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user