summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Index.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-12-10 10:43:13 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-12-10 10:43:13 +0000
commit87fffffbdf41eaf0f269bd65d8380b80d899bec8 (patch)
tree4f7978256da871aff44790bd6cd6309d5fe138f2 /src/compiler/GF/Index.hs
parent2dda42e4d9ccba0223d4f3c78ab64af2213810b9 (diff)
option --split-pgf replaces option --mk-index. This splits the PGF into one file for the abstract and one more for each concrete syntax. This is a preparation for being able to load only specific languages from the whole grammar.
Diffstat (limited to 'src/compiler/GF/Index.hs')
-rw-r--r--src/compiler/GF/Index.hs36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/compiler/GF/Index.hs b/src/compiler/GF/Index.hs
deleted file mode 100644
index eeb8697b3..000000000
--- a/src/compiler/GF/Index.hs
+++ /dev/null
@@ -1,36 +0,0 @@
-{--
-This module provide a function for indexing a pgf.
-
-It reads the pgf and add a global flag, called "index", containing a string
-with concrete names and size in bytes separated by a column.
-ex : "DisambPhrasebookEng:18778 PhrasebookBul:49971 PhrasebookCat:32738..."
---}
-module GF.Index (addIndex) where
-
-import PGF
-import PGF.Data
---import PGF.Binary
-import Data.Binary
-import Data.ByteString.Lazy (length) -- readFile
-import qualified Data.Map as Map
-import Data.Map (toAscList)
-import Data.List (intercalate)
---import qualified Data.ByteString.Lazy as BS
-
-addIndex :: PGF -> PGF
-addIndex pgf = pgf {gflags = flags}
- where flags = Map.insert (mkCId "index") (LStr $ showIndex index) (gflags pgf)
- index = getIndex pgf
-
-
-showIndex :: [(String,Int)] -> String
-showIndex = intercalate " " . map f
- where f (name,size) = name ++ ":" ++ show size
-
-getsize :: Binary a => a -> Int
-getsize x = let bs = encode x in fromIntegral $ Data.ByteString.Lazy.length bs
-
-getIndex :: PGF -> [(String,Int)]
-getIndex pgf = cncindex
- where cncindex = map f $ Data.Map.toAscList $ concretes pgf
- f (cncname,cnc) = (show cncname, getsize cnc)