From abeb18fb20386ff7f14c8a564bc5af2d5eef1432 Mon Sep 17 00:00:00 2001 From: bringert Date: Sun, 21 Jan 2007 17:10:10 +0000 Subject: [PATCH] Use _cat category as root in SRGS ABNF and JSGF. SRGS XML already did this. --- src/GF/Speech/PrJSGF.hs | 4 +++- src/GF/Speech/PrSRGS_ABNF.hs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs index f6f0b19b2..a86cd71b7 100644 --- a/src/GF/Speech/PrJSGF.hs +++ b/src/GF/Speech/PrJSGF.hs @@ -55,7 +55,9 @@ prJSGF sisr srg@(SRG{grammarName=name,grammarLanguage=ml, text ("grammar " ++ name ++ ";") lang = maybe empty text ml mainCat = comment ("Start category: " ++ origStart) $$ - rule True "MAIN" [prCat start] + case cfgCatToGFCat origStart of + Just c -> rule True "MAIN" [prCat (catFormId c)] + Nothing -> empty prRule (SRGRule cat origCat rhs) = comment origCat $$ rule False cat (map prAlt (ebnfSRGAlts rhs)) diff --git a/src/GF/Speech/PrSRGS_ABNF.hs b/src/GF/Speech/PrSRGS_ABNF.hs index d79ee7b55..9ba705926 100644 --- a/src/GF/Speech/PrSRGS_ABNF.hs +++ b/src/GF/Speech/PrSRGS_ABNF.hs @@ -60,7 +60,9 @@ prABNF sisr probs srg@(SRG{grammarName=name,grammarLanguage=ml, language = maybe empty (\l -> text "language" <+> text l <> char ';') ml tagFormat | isJust sisr = text "tag-format" <+> text "" <> char ';' | otherwise = empty - mainCat = text "root" <+> prCat start <> char ';' + mainCat = case cfgCatToGFCat origStart of + Just c -> text "root" <+> prCat (catFormId c) <> char ';' + Nothing -> empty prRule (SRGRule cat origCat rhs) = comment origCat $$ rule False cat (map prAlt (ebnfSRGAlts rhs))