summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/PMCFGTestHooks.hs
blob: e8014107e885eb37c534ad9c70b9bdeabeea3448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module GF.Compile.PMCFGTestHooks
  ( TestSchema(..)
  , TestProduction(..)
  , PMCFGResults(..)
  , getFIdsPre
  , getFIdsOptimized
  , getFIdsOptimizedCached
  , getSingleFIdPre
  , getSingleFIdOptimized
  , pmcfgResults
  ) where

import GF.Compile.PMCFGTestTypes
import GF.Grammar (FId, PMCFG)
import qualified GF.Compile.GeneratePMCFG as Optimized
import qualified GF.Compile.GeneratePmcfgPre as Pre

data PMCFGResults = PMCFGResults
  { pmcfgPre       :: PMCFG
  , pmcfgOptimized :: PMCFG
  } deriving (Eq, Show)

getFIdsPre :: TestSchema -> [FId]
getFIdsPre = Pre.pmcfgTestGetFIds

getFIdsOptimized :: TestSchema -> [FId]
getFIdsOptimized = Optimized.pmcfgTestGetFIds

getFIdsOptimizedCached :: TestSchema -> ([FId], [FId])
getFIdsOptimizedCached = Optimized.pmcfgTestGetFIdsCached

getSingleFIdPre :: TestSchema -> FId
getSingleFIdPre = Pre.pmcfgTestGetSingleFId

getSingleFIdOptimized :: TestSchema -> FId
getSingleFIdOptimized = Optimized.pmcfgTestGetSingleFId

pmcfgResults :: [TestProduction] -> PMCFGResults
pmcfgResults prods =
  PMCFGResults
    { pmcfgPre       = Pre.pmcfgTestBuildPMCFG prods
    , pmcfgOptimized = Optimized.pmcfgTestBuildPMCFG prods
    }