diff --git a/src/compiler/GF/Command/Abstract.hs b/src/compiler/GF/Command/Abstract.hs index ebf6bc29b..e1b4c5871 100644 --- a/src/compiler/GF/Command/Abstract.hs +++ b/src/compiler/GF/Command/Abstract.hs @@ -16,10 +16,12 @@ data Command data TransactionCommand = CreateFun [Option] Fun Type | CreateCat [Option] Cat [Hypo] + | CreateConcrete [Option] ConcName | CreateLin [Option] Fun Term | CreateLincat [Option] Cat Term | DropFun [Option] Fun | DropCat [Option] Cat + | DropConcrete [Option] ConcName | DropLin [Option] Fun | DropLincat [Option] Cat deriving Show diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index c06df6865..0578f4c1e 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -684,10 +684,10 @@ pgfCommands = Map.fromList [ }), ("c", emptyCommandInfo { longname = "create", - syntax = "create fun f = ..; create cat c = ..; create lin c = ..; or create lincat c = ..", - synopsis = "Dynamically adds new functions and categories to the current grammar.", + syntax = "create fun f = ..; create cat c = ..; create concrete l; create lin c = ..; or create lincat c = ..", + synopsis = "Dynamically adds new functions, categories and languages to the current grammar.", explanation = unlines [ - "After the command you can write fun, data, cat, lin or a lincat definition.", + "After the command you can write fun, data, cat, concrete, lin or a lincat definition.", "The syntax is the same as if the definition was in a module. If you want to use", "any operations inside lin and lincat, you should import them", "by using the command `i -resource `." @@ -700,11 +700,11 @@ pgfCommands = Map.fromList [ }), ("d", emptyCommandInfo { longname = "drop", - syntax = "drop fun f; drop cat c; drop lin c; or drop lincat c", - synopsis = "Dynamically removes functions and categories from the current grammar.", + syntax = "drop fun f; drop cat c; drop concrete l; drop lin c; or drop lincat c", + synopsis = "Dynamically removes functions, categories and languages from the current grammar.", explanation = unlines [ "After the command you must specify whether you want to remove", - "fun, data, cat, lin or a lincat definition.", + "fun, data, cat, concrete, lin or a lincat definition.", "Note that if you are removing an abstract function or category,", "then all corresponding linearizations will be dropped as well." ], diff --git a/src/compiler/GF/Command/Parse.hs b/src/compiler/GF/Command/Parse.hs index 31cb13abf..bd5920890 100644 --- a/src/compiler/GF/Command/Parse.hs +++ b/src/compiler/GF/Command/Parse.hs @@ -75,6 +75,13 @@ pTransactionCommand = do | take 1 cmd == "d" -> do c <- pIdent return (DropCat opts c) + "concrete" + | take 1 cmd == "c" -> do + name <- pIdent + return (CreateConcrete opts name) + | take 1 cmd == "d" -> do + name <- pIdent + return (DropConcrete opts name) "lin" | take 1 cmd == "c" -> do f <- pIdent skipSpaces diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs index c9db4683b..0cbe23faf 100644 --- a/src/compiler/GF/Interactive.hs +++ b/src/compiler/GF/Interactive.hs @@ -242,6 +242,9 @@ transactionCommand (CreateCat opts c ctxt) pgf = do Left msg -> putStrLnE msg Right ty -> do lift $ modifyPGF pgf (createCategory c ctxt prob) return () +transactionCommand (CreateConcrete opts name) pgf = do + lift $ modifyPGF pgf (createConcrete name (return ())) + return () transactionCommand (CreateLin opts f t) pgf = do lang <- optLang pgf opts lift $ modifyPGF pgf (alterConcrete lang (createLin f [])) @@ -256,6 +259,9 @@ transactionCommand (DropFun opts f) pgf = do transactionCommand (DropCat opts c) pgf = do lift $ modifyPGF pgf (dropCategory c) return () +transactionCommand (DropConcrete opts name) pgf = do + lift $ modifyPGF pgf (dropConcrete name) + return () transactionCommand (DropLin opts f) pgf = do lang <- optLang pgf opts lift $ modifyPGF pgf (alterConcrete lang (dropLin f))