diff options
| author | bringert <bringert@cs.chalmers.se> | 2006-12-20 21:43:41 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2006-12-20 21:43:41 +0000 |
| commit | 642809fd3b193c6e51c42914543a4381902a2d0f (patch) | |
| tree | e1c5a4dfe76dde1d86d5fe3d3c2812ee141ae5b8 /src | |
| parent | f07b0ef88e79c4abfe56c5609a11af3133395399 (diff) | |
JSGF pretty printing tweaks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/GF/Speech/PrJSGF.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs index 6d123df5f..ffb5d6630 100644 --- a/src/GF/Speech/PrJSGF.hs +++ b/src/GF/Speech/PrJSGF.hs @@ -52,13 +52,13 @@ prJSGF srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs} header = text "#JSGF V1.0 UTF-8;" $$ comment ("JSGF speech recognition grammar for " ++ name) $$ comment "Generated by GF" $$ - text ("grammar " ++ name ++ ";") + text ("grammar " ++ name ++ ";") $$ emptyLine mainCat = comment ("Start category: " ++ origStart) $$ - rule True "MAIN" [prCat start] + rule True "MAIN" [prCat start] $$ emptyLine prRule (SRGRule cat origCat rhs) = comment origCat $$ -- rule False cat (map prAlt (ebnfSRGAlts rhs)) - rule False cat (map prAlt rhs) $$ text "" + rule False cat (map prAlt rhs) $$ emptyLine -- FIXME: use the probability -- prAlt (EBnfSRGAlt mp n rhs) = tag sisr (profileInitSISR n) . showChar ' '. prItem sisr rhs prAlt (SRGAlt mp n rhs) = initTag <+> prItem sisr n rhs <+> finalTag @@ -120,6 +120,9 @@ isPunct c = c `elem` "-_.;.,?!" comment :: String -> Doc comment s = text "//" <+> text s +emptyLine :: Doc +emptyLine = text "" + prepunctuate :: Doc -> [Doc] -> [Doc] prepunctuate _ [] = [] prepunctuate p (x:xs) = x : map (p <>) xs |
