mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-19 09:49:33 -06:00
last-minute bug fixes
This commit is contained in:
@@ -20,7 +20,7 @@ import UTF8
|
||||
|
||||
initEditLoop :: CEnv -> IO () -> IO ()
|
||||
initEditLoop env resume = do
|
||||
let env' = addGlobalOptions (options [sizeDisplay "short"]) env
|
||||
let env' = startEditEnv env
|
||||
putStrLnFlush $ initEditMsg env'
|
||||
let state = initSStateEnv env'
|
||||
putStrLnFlush $ showCurrentState env' state
|
||||
@@ -113,7 +113,9 @@ pCommand = pCommandWords . words where
|
||||
-- well, this lists the commands of the line-based editor
|
||||
initEditMsg env = unlines $
|
||||
"State-dependent editing commands are given in the menu:" :
|
||||
" n = new, r = refine, w = wrap, d = delete, s = select." :
|
||||
" n [Cat] = new, r [Fun] = refine, w [Fun] [Int] = wrap,":
|
||||
" ch [Fun] = change head, d = delete, s [Int] = select," :
|
||||
" x [Var] [Var] = alpha convert." :
|
||||
"Commands changing the environment:" :
|
||||
" i [file] = import, e = empty." :
|
||||
"Other commands:" :
|
||||
|
||||
@@ -26,6 +26,7 @@ import Unicode
|
||||
|
||||
import CF
|
||||
import CFIdent (cat2CFCat, cfCat2Cat)
|
||||
import PPrCF (prCFCat)
|
||||
import Linear
|
||||
import Randomized
|
||||
import Editing
|
||||
@@ -130,10 +131,10 @@ execCommand env c s = case c of
|
||||
|
||||
CCEnvEmptyAndImport file -> useIOE (emptyShellState, initSState) $ do
|
||||
st <- shellStateFromFiles opts emptyShellState file
|
||||
return (st,s)
|
||||
return (startEditEnv st,s)
|
||||
|
||||
CCEnvEmpty -> do
|
||||
return (emptyShellState, initSState)
|
||||
return (startEditEnv emptyShellState, initSState)
|
||||
|
||||
CCEnvGFShell command -> do
|
||||
let cs = PShell.pCommandLines command
|
||||
@@ -224,7 +225,7 @@ execECommand env c = case c of
|
||||
let cat = cat2CFCat (qualifTop sgr (actCat (stateSState s)))
|
||||
ts = parseAny agrs cat str
|
||||
in (if null ts ---- debug
|
||||
then withMsg [str, "parse failed in cat" +++ show cat]
|
||||
then withMsg [str, "parse failed in cat" +++ prCFCat cat]
|
||||
else id)
|
||||
(refineByTrees der cgr ts) s
|
||||
|
||||
@@ -270,6 +271,10 @@ string2varPair s = case words s of
|
||||
x : y : [] -> liftM2 (,) (string2ident x) (string2ident y)
|
||||
_ -> Bad "expected format 'x y'"
|
||||
|
||||
|
||||
|
||||
startEditEnv env = addGlobalOptions (options [sizeDisplay "short"]) env
|
||||
|
||||
-- seen on display
|
||||
|
||||
cMenuDisplay :: String -> Command
|
||||
|
||||
@@ -136,7 +136,7 @@ optionsOfCommand co = case co of
|
||||
CStripState -> none
|
||||
CTransformGrammar _ -> flags "printer"
|
||||
CConvertLatex _ -> none
|
||||
CLinearize _ -> both "table struct record all" "lang number unlexer"
|
||||
CLinearize _ -> both "utf8 table struct record all" "lang number unlexer"
|
||||
CParse -> both "new n ign raw v" "cat lang lexer parser number rawtrees"
|
||||
CTranslate _ _ -> opts "cat lexer parser"
|
||||
CGenerateRandom -> flags "cat lang number depth"
|
||||
@@ -161,7 +161,8 @@ optionsOfCommand co = case co of
|
||||
CShowTerm -> flags "printer"
|
||||
CSystemCommand _ -> none
|
||||
|
||||
CPrintGrammar -> flags "printer"
|
||||
CPrintGrammar -> both "utf8" "printer"
|
||||
CPrintMultiGrammar -> opts "utf8"
|
||||
|
||||
CHelp _ -> opts "all"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user