1
0
forked from GitHub/gf-core

drop the dependency to GF.Infra.PrintClass from the Library

This commit is contained in:
krasimir
2008-05-29 15:15:00 +00:00
parent 12538e8f2a
commit f116071ce5
11 changed files with 0 additions and 68 deletions

View File

@@ -50,8 +50,6 @@ library
GF.Data.SortedList GF.Data.SortedList
GF.Data.Assoc GF.Data.Assoc
GF.Data.ErrM GF.Data.ErrM
GF.Infra.CompactPrint
GF.Infra.PrintClass
GF.Text.UTF8 GF.Text.UTF8

View File

@@ -15,8 +15,6 @@
module GF.Compile.GenerateFCFG module GF.Compile.GenerateFCFG
(convertConcrete) where (convertConcrete) where
import GF.Infra.PrintClass
import Control.Monad import Control.Monad
import GF.GFCC.Parsing.FCFG.Utilities import GF.GFCC.Parsing.FCFG.Utilities

View File

@@ -9,7 +9,6 @@
module GF.GFCC.BuildParser where module GF.GFCC.BuildParser where
import GF.Infra.PrintClass
import GF.GFCC.Parsing.FCFG.Utilities import GF.GFCC.Parsing.FCFG.Utilities
import GF.Data.SortedList import GF.Data.SortedList
import GF.Data.Assoc import GF.Data.Assoc
@@ -63,22 +62,3 @@ buildParserInfo (grammar,startup) = -- trace (unlines [prt (x,Set.toList set) |
leftcorntoks = accumAssoc id [ (tok, ruleid) | (ruleid, rule) <- assocs allrules, tok <- getLeftCornerTok rule ] leftcorntoks = accumAssoc id [ (tok, ruleid) | (ruleid, rule) <- assocs allrules, tok <- getLeftCornerTok rule ]
grammarcats = aElems topdownrules grammarcats = aElems topdownrules
grammartoks = nubsort [t | (FRule _ _ _ _ lins) <- grammar, lin <- elems lins, FSymTok t <- elems lin] grammartoks = nubsort [t | (FRule _ _ _ _ lins) <- grammar, lin <- elems lins, FSymTok t <- elems lin]
----------------------------------------------------------------------
-- pretty-printing of statistics
instance Print ParserInfo where
prt pI = "[ allRules=" ++ sl (elems . allRules) ++
"; tdRules=" ++ sla topdownRules ++
-- "; emptyRules=" ++ sl emptyRules ++
"; epsilonRules=" ++ sl epsilonRules ++
"; lcCats=" ++ sla leftcornerCats ++
"; lcTokens=" ++ sla leftcornerTokens ++
"; categories=" ++ sl grammarCats ++
" ]"
where sl f = show $ length $ f pI
sla f = let (as, bs) = unzip $ aAssocs $ f pI
in show (length as) ++ "/" ++ show (length (concat bs))

View File

@@ -1,6 +1,5 @@
module GF.GFCC.CId (CId(..), wildCId, mkCId, prCId) where module GF.GFCC.CId (CId(..), wildCId, mkCId, prCId) where
import GF.Infra.PrintClass
import Data.ByteString.Char8 as BS import Data.ByteString.Char8 as BS
newtype CId = CId BS.ByteString deriving (Eq,Ord,Show) newtype CId = CId BS.ByteString deriving (Eq,Ord,Show)

View File

@@ -1,8 +1,6 @@
module GF.GFCC.DataGFCC where module GF.GFCC.DataGFCC where
import GF.GFCC.CId import GF.GFCC.CId
import GF.Infra.PrintClass(prt)
import GF.Infra.CompactPrint
import GF.Text.UTF8 import GF.Text.UTF8
import GF.Data.Assoc import GF.Data.Assoc

View File

@@ -3,7 +3,6 @@ module GF.GFCC.Linearize where
import GF.GFCC.Macros import GF.GFCC.Macros
import GF.GFCC.DataGFCC import GF.GFCC.DataGFCC
import GF.GFCC.CId import GF.GFCC.CId
import GF.Infra.PrintClass
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.List import Data.List

View File

@@ -2,7 +2,6 @@ module GF.GFCC.Macros where
import GF.GFCC.CId import GF.GFCC.CId
import GF.GFCC.DataGFCC import GF.GFCC.DataGFCC
import GF.Infra.PrintClass
import Control.Monad import Control.Monad
import qualified Data.Map as Map import qualified Data.Map as Map
import qualified Data.Array as Array import qualified Data.Array as Array

View File

@@ -13,8 +13,6 @@ module GF.GFCC.Parsing.FCFG
import GF.Data.SortedList import GF.Data.SortedList
import GF.Data.Assoc import GF.Data.Assoc
import GF.Infra.PrintClass
import GF.GFCC.Parsing.FCFG.Utilities import GF.GFCC.Parsing.FCFG.Utilities
import GF.GFCC.Parsing.FCFG.Active import GF.GFCC.Parsing.FCFG.Active
@@ -59,7 +57,6 @@ parseFCF strategy pinfo startCat inString =
tree2term :: SyntaxTree CId -> Exp tree2term :: SyntaxTree CId -> Exp
tree2term (TNode f ts) = tree (AC f) (map tree2term ts) tree2term (TNode f ts) = tree (AC f) (map tree2term ts)
tree2term (TString s) = tree (AS s) [] tree2term (TString s) = tree (AS s) []
tree2term (TInt n) = tree (AI n) [] tree2term (TInt n) = tree (AI n) []
tree2term (TFloat f) = tree (AF f) [] tree2term (TFloat f) = tree (AF f) []

View File

@@ -18,8 +18,6 @@ import GF.GFCC.CId
import GF.GFCC.DataGFCC import GF.GFCC.DataGFCC
import GF.GFCC.Parsing.FCFG.Utilities import GF.GFCC.Parsing.FCFG.Utilities
import GF.Infra.PrintClass
import Control.Monad (guard) import Control.Monad (guard)
import qualified Data.List as List import qualified Data.List as List

View File

@@ -22,8 +22,6 @@ import GF.Data.SortedList
import GF.Data.Assoc import GF.Data.Assoc
import GF.Data.Utilities (sameLength, foldMerge, splitBy) import GF.Data.Utilities (sameLength, foldMerge, splitBy)
import GF.Infra.PrintClass
------------------------------------------------------------ ------------------------------------------------------------
-- ranges as single pairs -- ranges as single pairs
@@ -271,33 +269,3 @@ forest2trees (FString s) = [TString s]
forest2trees (FInt n) = [TInt n] forest2trees (FInt n) = [TInt n]
forest2trees (FFloat f) = [TFloat f] forest2trees (FFloat f) = [TFloat f]
forest2trees (FMeta) = [TMeta] forest2trees (FMeta) = [TMeta]
------------------------------------------------------------
-- pretty-printing
instance Print Range where
prt (Range i j) = "(" ++ show i ++ "-" ++ show j ++ ")"
prt (EmptyRange) = "(?)"
instance (Print s) => Print (SyntaxTree s) where
prt (TNode s trees)
| null trees = prt s
| otherwise = "(" ++ prt s ++ prtBefore " " trees ++ ")"
prt (TString s) = show s
prt (TInt n) = show n
prt (TFloat f) = show f
prt (TMeta) = "?"
prtList = prtAfter "\n"
instance (Print s) => Print (SyntaxForest s) where
prt (FNode s []) = "(" ++ prt s ++ " - ERROR: null forests)"
prt (FNode s [[]]) = prt s
prt (FNode s [forests]) = "(" ++ prt s ++ prtBefore " " forests ++ ")"
prt (FNode s children) = "{" ++ prtSep " | " [ prt s ++ prtBefore " " forests |
forests <- children ] ++ "}"
prt (FString s) = show s
prt (FInt n) = show n
prt (FFloat f) = show f
prt (FMeta) = "?"
prtList = prtAfter "\n"

View File

@@ -6,8 +6,6 @@ import GF.GFCC.Raw.AbsGFCCRaw
import GF.GFCC.BuildParser (buildParserInfo) import GF.GFCC.BuildParser (buildParserInfo)
import GF.GFCC.Parsing.FCFG.Utilities import GF.GFCC.Parsing.FCFG.Utilities
import GF.Infra.PrintClass
import qualified Data.Array as Array import qualified Data.Array as Array
import qualified Data.Map as Map import qualified Data.Map as Map