diff options
| author | aarne <unknown> | 2005-11-14 15:03:40 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2005-11-14 15:03:40 +0000 |
| commit | f339b8839bcb25a57cb22baa3342032892f9be63 (patch) | |
| tree | 59b15d37579d5b5630d9ae5ac7a9d701cf3e09a4 /src/GF/Compile/NoParse.hs | |
| parent | 505eb2ec5794e741d343e52be4f75da7b4980a62 (diff) | |
arbitrary lincat records; noparse pragmas
Diffstat (limited to 'src/GF/Compile/NoParse.hs')
| -rw-r--r-- | src/GF/Compile/NoParse.hs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/GF/Compile/NoParse.hs b/src/GF/Compile/NoParse.hs new file mode 100644 index 000000000..0e37c9f95 --- /dev/null +++ b/src/GF/Compile/NoParse.hs @@ -0,0 +1,47 @@ +---------------------------------------------------------------------- +-- | +-- Module : NoParse +-- Maintainer : AR +-- Stability : (stable) +-- Portability : (portable) +-- +-- > CVS $Date: 2005/11/14 16:03:41 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.1 $ +-- +-- Probabilistic abstract syntax. AR 30\/10\/2005 +-- +-- (c) Aarne Ranta 2005 under GNU GPL +-- +-- Contents: decide what lin rules no parser is generated. +-- Usually a list of noparse idents from 'i -boparse=file'. + +----------------------------------------------------------------------------- + +module GF.Compile.NoParse ( + NoParse -- = Ident -> Bool + ,getNoparseFromFile -- :: Opts -> IO NoParse + ,doParseAll -- :: NoParse + ) where + +import GF.Infra.Ident +import GF.Data.Operations +import GF.Infra.Option + + +type NoParse = (Ident -> Bool) + +doParseAll :: NoParse +doParseAll = const False + +getNoparseFromFile :: Options -> FilePath -> IO NoParse +getNoparseFromFile opts file = do + let f = maybe file id $ getOptVal opts noparseFile + s <- readFile f + return $ igns s + where + igns s i = isInBinTree i $ buildTree $ flip zip (repeat ()) $ concat $ map getIgnores $ lines s +-- where +getIgnores s = case dropWhile (/="--#") (words s) of + _:"noparse":fs -> map identC fs + _ -> [] |
