summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/PMCFGTestHooks.hs
blob: 8815f2911fa2458ce1de63f6731a2c07a2f1a001 (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
module GF.Compile.PMCFGTestHooks
  ( TestSchema(..)
  , TestProduction(..)
  , PMCFGResults(..)
  , getFIdsPre
  , getFIdsOptimized
  , 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

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
    }