diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-03-15 14:53:42 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-03-15 14:53:42 +0000 |
| commit | c73bc4f996b3259fa162d7dd11a23224053ceeae (patch) | |
| tree | dd3406d9f06beefedb214feffabf9d119d8383ce /src/GF/Grammar | |
| parent | eff08dfe88d677453a889b128f05a01935bf4e10 (diff) | |
switched to unmodified BNFC-generated components
Diffstat (limited to 'src/GF/Grammar')
| -rw-r--r-- | src/GF/Grammar/Grammar.hs | 1 | ||||
| -rw-r--r-- | src/GF/Grammar/PrGrammar.hs | 17 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/GF/Grammar/Grammar.hs b/src/GF/Grammar/Grammar.hs index 85e515342..45b3da84b 100644 --- a/src/GF/Grammar/Grammar.hs +++ b/src/GF/Grammar/Grammar.hs @@ -191,6 +191,7 @@ data Patt = | PSeq Patt Patt -- ^ sequence of token parts: p + q | PRep Patt -- ^ repetition of token part: p* | PChar -- ^ string of length one + | PChars [Char] -- ^ character list deriving (Read, Show, Eq, Ord) diff --git a/src/GF/Grammar/PrGrammar.hs b/src/GF/Grammar/PrGrammar.hs index ad65f452b..c3a21d1d6 100644 --- a/src/GF/Grammar/PrGrammar.hs +++ b/src/GF/Grammar/PrGrammar.hs @@ -48,6 +48,8 @@ import GF.Infra.Option import GF.Infra.Ident import GF.Data.Str +import GF.Infra.CompactPrint + import Data.List (intersperse) class Print a where @@ -71,24 +73,27 @@ class Print a where prtBad :: Print a => String -> a -> Err b prtBad s a = Bad (s +++ prt a) +pprintTree :: P.Print a => a -> String +pprintTree = compactPrint . P.printTree + prGrammar :: SourceGrammar -> String -prGrammar = P.printTree . trGrammar +prGrammar = pprintTree . trGrammar prModule :: (Ident, SourceModInfo) -> String -prModule = P.printTree . trModule +prModule = pprintTree . trModule instance Print Term where - prt = P.printTree . trt + prt = pprintTree . trt prt_ = prExp instance Print Ident where - prt = P.printTree . tri + prt = pprintTree . tri instance Print Patt where - prt = P.printTree . trp + prt = pprintTree . trp instance Print Label where - prt = P.printTree . trLabel + prt = pprintTree . trLabel instance Print MetaSymb where prt (MetaSymb i) = "?" ++ show i |
