mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 09:02:50 -06:00
unlexer bug ; "vilka" ; lib path warning ; p -lines result
This commit is contained in:
20
src/GF.hs
20
src/GF.hs
@@ -31,11 +31,11 @@ import GF.Text.UTF8
|
|||||||
|
|
||||||
import GF.Today (today,version)
|
import GF.Today (today,version)
|
||||||
import GF.System.Arch
|
import GF.System.Arch
|
||||||
import System (getArgs,system)
|
import System (getArgs,system,getEnv)
|
||||||
import Control.Monad (foldM,liftM)
|
import Control.Monad (foldM,liftM)
|
||||||
import Data.List (nub)
|
import Data.List (nub)
|
||||||
|
|
||||||
-- AR 19/4/2000 -- 28/4/2005
|
-- AR 19/4/2000 -- 21/3/2006
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
@@ -52,7 +52,8 @@ main = do
|
|||||||
putStrLnFlush $ encodeUTF8 helpMsg
|
putStrLnFlush $ encodeUTF8 helpMsg
|
||||||
|
|
||||||
_ | opt forJava -> do
|
_ | opt forJava -> do
|
||||||
putStrLnFlush $ encodeUTF8 welcomeMsg
|
welcome <- welcomeMsgLib
|
||||||
|
putStrLnFlush $ encodeUTF8 welcome
|
||||||
st <- useIOE st0 $
|
st <- useIOE st0 $
|
||||||
foldM (shellStateFromFiles os) st0 fs
|
foldM (shellStateFromFiles os) st0 fs
|
||||||
sessionLineJ True st
|
sessionLineJ True st
|
||||||
@@ -77,8 +78,8 @@ main = do
|
|||||||
if opt beSilent then return () else putStrLnFlush "</gfbatch>"
|
if opt beSilent then return () else putStrLnFlush "</gfbatch>"
|
||||||
return ()
|
return ()
|
||||||
_ -> do
|
_ -> do
|
||||||
|
welcome <- welcomeMsgLib
|
||||||
ifNotSil $ putStrLnFlush $ welcomeMsg
|
ifNotSil $ putStrLnFlush $ welcome
|
||||||
st <- useIOE st0 $
|
st <- useIOE st0 $
|
||||||
foldM (shellStateFromFiles os) st0 fs
|
foldM (shellStateFromFiles os) st0 fs
|
||||||
if null fs then return () else (ifNotSil putCPU)
|
if null fs then return () else (ifNotSil putCPU)
|
||||||
@@ -110,9 +111,16 @@ helpMsg = unlines [
|
|||||||
"which suppresses all messages except the output and fatal errors."
|
"which suppresses all messages except the output and fatal errors."
|
||||||
]
|
]
|
||||||
|
|
||||||
welcomeMsg =
|
welcomeMsgLib = do
|
||||||
|
lib <- catch
|
||||||
|
(getEnv "GF_LIB_PATH" >>= return . ("GF_LIB_PATH is set to" +++))
|
||||||
|
(const (return "Warning: GF_LIB_PATH is not defined."))
|
||||||
|
return $ welcomeMsg lib
|
||||||
|
|
||||||
|
welcomeMsg lib =
|
||||||
"Welcome to " ++ authorMsg ++++
|
"Welcome to " ++ authorMsg ++++
|
||||||
"If ä and ö (umlaut letters) look strange, see 'h -coding'." ++
|
"If ä and ö (umlaut letters) look strange, see 'h -coding'." ++
|
||||||
|
"\n" ++ lib ++
|
||||||
"\n\nType 'h' for help, and 'h [Command] for more detailed help.\n"
|
"\n\nType 'h' for help, and 'h [Command] for more detailed help.\n"
|
||||||
|
|
||||||
authorMsg = unlines [
|
authorMsg = unlines [
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import qualified GF.Grammar.Lookup as L
|
|||||||
import qualified GF.Canon.GFC as GFC
|
import qualified GF.Canon.GFC as GFC
|
||||||
import qualified GF.Canon.Look as Look
|
import qualified GF.Canon.Look as Look
|
||||||
import qualified GF.Canon.CMacros as CMacros
|
import qualified GF.Canon.CMacros as CMacros
|
||||||
|
import qualified GF.Grammar.MMacros as MMacros
|
||||||
import qualified GF.Compile.GrammarToCanon as GrammarToCanon
|
import qualified GF.Compile.GrammarToCanon as GrammarToCanon
|
||||||
import GF.Grammar.Values
|
import GF.Grammar.Values
|
||||||
import GF.UseGrammar.GetTree
|
import GF.UseGrammar.GetTree
|
||||||
@@ -236,7 +237,10 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
|||||||
let ss = (if oElem showAll opts then id else filter (not . null)) $
|
let ss = (if oElem showAll opts then id else filter (not . null)) $
|
||||||
lines $ prCommandArg a
|
lines $ prCommandArg a
|
||||||
mts <- mapM parse ss
|
mts <- mapM parse ss
|
||||||
let a' = ATrms [t | (_,ATrms ts) <- mts, t <- ts]
|
let mark s ts = case ts of
|
||||||
|
[] -> [MMacros.uTree] -- to leave a trace of unparsed line
|
||||||
|
_ -> ts
|
||||||
|
let a' = ATrms [t | (s,(_,ATrms ts)) <- zip ss mts, t <- mark s ts]
|
||||||
changeArg (const a') sa
|
changeArg (const a') sa
|
||||||
| otherwise -> parse $ prCommandArg a
|
| otherwise -> parse $ prCommandArg a
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ formatAsCodeLit :: String -> String
|
|||||||
formatAsCodeLit = formatAsCode . unwords . map unStringLit . words
|
formatAsCodeLit = formatAsCode . unwords . map unStringLit . words
|
||||||
|
|
||||||
formatAsText,formatAsHTML,formatAsLatex :: String -> String
|
formatAsText,formatAsHTML,formatAsLatex :: String -> String
|
||||||
formatAsText = formatAsTextGen (=="&-") (=="&-")
|
formatAsText = formatAsTextGen (const False) (=="&-")
|
||||||
formatAsHTML = formatAsTextGen (\s -> take 1 s == "<" || last s == '>') (const False)
|
formatAsHTML = formatAsTextGen (\s -> take 1 s == "<" || last s == '>') (const False)
|
||||||
formatAsLatex = formatAsTextGen ((=="\\") . take 1) (const False)
|
formatAsLatex = formatAsTextGen ((=="\\") . take 1) (const False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user