forked from GitHub/gf-core
Replace Category with Type in the PGF API. Added readLanguage and showLanguage.
This commit is contained in:
@@ -578,7 +578,7 @@ allCommands cod pgf = Map.fromList [
|
||||
lang -> map mkCId (chunks ',' lang)
|
||||
optLang opts = head $ optLangs opts ++ [wildCId]
|
||||
optType opts =
|
||||
let str = valStrOpts "cat" (lookStartCat pgf) opts
|
||||
let str = valStrOpts "cat" (prCId $ lookStartCat pgf) opts
|
||||
in case readType str of
|
||||
Just ty -> ty
|
||||
Nothing -> error ("Can't parse '"++str++"' as type")
|
||||
@@ -595,7 +595,7 @@ allCommands cod pgf = Map.fromList [
|
||||
toString = unwords . toStrings
|
||||
|
||||
prGrammar opts = case opts of
|
||||
_ | isOpt "cats" opts -> unwords $ map prCId $ categories pgf
|
||||
_ | isOpt "cats" opts -> unwords $ map showType $ categories pgf
|
||||
_ | isOpt "fullform" opts -> concatMap
|
||||
(prFullFormLexicon . buildMorpho pgf) $ optLangs opts
|
||||
_ | isOpt "missing" opts ->
|
||||
|
||||
@@ -26,7 +26,7 @@ pgf2js pgf =
|
||||
n = prCId $ absname pgf
|
||||
as = abstract pgf
|
||||
cs = Map.assocs (concretes pgf)
|
||||
start = M.lookStartCat pgf
|
||||
start = prCId $ M.lookStartCat pgf
|
||||
grammar = new "GFGrammar" [js_abstract, js_concrete]
|
||||
js_abstract = abstract2js start as
|
||||
js_concrete = JS.EObj $ map (concrete2js start n) cs
|
||||
|
||||
@@ -31,7 +31,7 @@ toBNF f pgf cnc = prCFG $ f $ pgfToCFG pgf cnc
|
||||
pgfToCFG :: PGF
|
||||
-> CId -- ^ Concrete syntax name
|
||||
-> CFG
|
||||
pgfToCFG pgf lang = mkCFG (lookStartCat pgf) extCats (startRules ++ concatMap fruleToCFRule rules)
|
||||
pgfToCFG pgf lang = mkCFG (prCId (lookStartCat pgf)) extCats (startRules ++ concatMap fruleToCFRule rules)
|
||||
where
|
||||
pinfo = fromMaybe (error "pgfToCFG: No parser.") (lookParser pgf lang)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ grammar2vxml pgf cnc = showsXMLDoc (skel2vxml name language start skel qs) ""
|
||||
name = prCId cnc
|
||||
qs = catQuestions pgf cnc (map fst skel)
|
||||
language = getSpeechLanguage pgf cnc
|
||||
start = mkCId (lookStartCat pgf)
|
||||
start = lookStartCat pgf
|
||||
|
||||
--
|
||||
-- * VSkeleton: a simple description of the abstract syntax.
|
||||
|
||||
Reference in New Issue
Block a user