diff options
| author | hallgren <hallgren@chalmers.se> | 2015-08-28 13:59:43 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-08-28 13:59:43 +0000 |
| commit | 5bfaf10de597af504e6d2784309e533b09a6451c (patch) | |
| tree | c0aacba9c492304cb3b0f905aa05bbefa1599d2c /src/compiler/GF/Grammar | |
| parent | f2952768d578309a8f75c7da417e3602c4d5e9e9 (diff) | |
Comment out some dead code found with -fwarn-unused-binds
Also fixed some warnings and tightened some imports
Diffstat (limited to 'src/compiler/GF/Grammar')
| -rw-r--r-- | src/compiler/GF/Grammar/Analyse.hs | 8 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/CFG.hs | 8 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/EBNF.hs | 14 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/Grammar.hs | 6 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/PatternMatch.hs | 3 |
5 files changed, 20 insertions, 19 deletions
diff --git a/src/compiler/GF/Grammar/Analyse.hs b/src/compiler/GF/Grammar/Analyse.hs index 5883ad4ff..4c8f2020f 100644 --- a/src/compiler/GF/Grammar/Analyse.hs +++ b/src/compiler/GF/Grammar/Analyse.hs @@ -119,22 +119,22 @@ sizeInfo i = case i of msize mt = case mt of Just (L _ t) -> sizeTerm t _ -> 0 - +{- -- the size of a module sizeModule :: SourceModule -> Int sizeModule = fst . sizesModule - +-} sizesModule :: SourceModule -> (Int, [(Ident,Int)]) sizesModule (_,m) = let js = Map.toList (jments m) tb = [(i,k) | (i,j) <- js, let k = sizeInfo j, k >= 0] in (length tb + sum (map snd tb),tb) - +{- -- the size of a grammar sizeGrammar :: Grammar -> Int sizeGrammar = fst . sizesGrammar - +-} sizesGrammar :: Grammar -> (Int,[(ModuleName,(Int,[(Ident,Int)]))]) sizesGrammar g = let diff --git a/src/compiler/GF/Grammar/CFG.hs b/src/compiler/GF/Grammar/CFG.hs index 93bce2aad..9f4dd49a9 100644 --- a/src/compiler/GF/Grammar/CFG.hs +++ b/src/compiler/GF/Grammar/CFG.hs @@ -153,13 +153,13 @@ removeLeftRecursion gr -- note: the rest don't occur in the original grammar cats = allCats gr - rules = allRules gr +-- rules = allRules gr directLeftCorner = mkRel [(NonTerminal c,t) | CFRule c (t:_) _ <- allRules gr] - leftCorner = reflexiveClosure_ (map NonTerminal cats) $ transitiveClosure directLeftCorner +-- leftCorner = reflexiveClosure_ (map NonTerminal cats) $ transitiveClosure directLeftCorner properLeftCorner = transitiveClosure directLeftCorner properLeftCornersOf = Set.toList . allRelated properLeftCorner . NonTerminal - isProperLeftCornerOf = flip (isRelatedTo properLeftCorner) +-- isProperLeftCornerOf = flip (isRelatedTo properLeftCorner) leftRecursive = reflexiveElements properLeftCorner isLeftRecursive = (`Set.member` leftRecursive) @@ -167,7 +167,7 @@ removeLeftRecursion gr retained = cfgStartCat gr `Set.insert` Set.fromList [a | r <- allRules (filterCFGCats (not . isLeftRecursive . NonTerminal) gr), NonTerminal a <- ruleRhs r] - isRetained = (`Set.member` retained) +-- isRetained = (`Set.member` retained) retainedLeftRecursive = filter (isLeftRecursive . NonTerminal) $ Set.toList retained diff --git a/src/compiler/GF/Grammar/EBNF.hs b/src/compiler/GF/Grammar/EBNF.hs index 50a5ff90a..8d0addfd7 100644 --- a/src/compiler/GF/Grammar/EBNF.hs +++ b/src/compiler/GF/Grammar/EBNF.hs @@ -49,9 +49,9 @@ normEBNF erules = let erules1 = [normERule ([i],r) | (i,r) <- zip [0..] erules] erules2 = erules1 ---refreshECats erules1 --- this seems to be just bad ! erules3 = concat (map pickERules erules2) - erules4 = nubERules erules3 +--erules4 = nubERules erules3 in [(mkCFCatE cat, map eitem2cfitem its) | (cat,itss) <- erules3, its <- itss] - +{- refreshECats :: [NormERule] -> [NormERule] refreshECats rules = [recas [i] rule | (i,rule) <- zip [0..] rules] where recas ii (cat,its) = (updECat ii cat, [recss ii 0 s | s <- its]) @@ -63,7 +63,7 @@ refreshECats rules = [recas [i] rule | (i,rule) <- zip [0..] rules] where EIPlus (cat,t) -> EIPlus (updECat ii cat, [recss ii 0 s | s <- t]) EIOpt (cat,t) -> EIOpt (updECat ii cat, [recss ii 0 s | s <- t]) _ -> it - +-} pickERules :: NormERule -> [NormERule] pickERules rule@(cat,alts) = rule : concat (map pics (concat alts)) where pics it = case it of @@ -77,7 +77,7 @@ pickERules rule@(cat,alts) = rule : concat (map pics (concat alts)) where where cat' = mkNewECat cat "Plus" mkEOptRules cat = [(cat', [[],[EINonTerm cat]])] where cat' = mkNewECat cat "Opt" - +{- nubERules :: [NormERule] -> [NormERule] nubERules rules = nub optim where optim = map (substERules (map mkSubst replaces)) irreducibles @@ -100,7 +100,7 @@ substERules g (cat,itss) = (cat, map sub itss) where sub (EIStar r : ii) = EIStar (substERules g r) : ii sub (EIPlus r : ii) = EIPlus (substERules g r) : ii sub (EIOpt r : ii) = EIOpt (substERules g r) : ii - +-} eitem2cfitem :: EItem -> CFSymbol eitem2cfitem it = case it of EITerm a -> Terminal a @@ -145,8 +145,8 @@ prECat (c,ints) = c ++ "_" ++ prTList "_" (map show ints) mkCFCatE :: ECat -> Cat mkCFCatE = prECat - +{- updECat _ (c,[]) = (c,[]) updECat ii (c,_) = (c,ii) - +-} mkNewECat (c,ii) str = (c ++ str,ii) diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index 34b8a1bdf..6f254e7d3 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -190,9 +190,9 @@ allExtendsPlus gr i = where exts m = extends m ++ [j | MTInstance (j,_) <- [mtype m]] --- | initial search path: the nonqualified dependencies -searchPathModule :: ModuleInfo -> [ModuleName] -searchPathModule m = [i | OSimple i <- depPathModule m] +-- -- | initial search path: the nonqualified dependencies +-- searchPathModule :: ModuleInfo -> [ModuleName] +-- searchPathModule m = [i | OSimple i <- depPathModule m] prependModule :: Grammar -> Module -> Grammar prependModule (MGrammar mm ms) im@(i,m) = MGrammar (Map.insert i m mm) (im:ms) diff --git a/src/compiler/GF/Grammar/PatternMatch.hs b/src/compiler/GF/Grammar/PatternMatch.hs index 48cb9bd3f..845867459 100644 --- a/src/compiler/GF/Grammar/PatternMatch.hs +++ b/src/compiler/GF/Grammar/PatternMatch.hs @@ -201,7 +201,7 @@ varsOfPatt p = case p of PR r -> concat $ map (varsOfPatt . snd) r PT _ q -> varsOfPatt q _ -> [] --} + -- | to search matching parameter combinations in tables isMatchingForms :: [Patt] -> [Term] -> Bool isMatchingForms ps ts = all match (zip ps ts') where @@ -209,3 +209,4 @@ isMatchingForms ps ts = all match (zip ps ts') where match _ = True ts' = map appForm ts +-}
\ No newline at end of file |
