mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
option -mac to vt command (uses open with ps)
This commit is contained in:
@@ -68,7 +68,7 @@ showCheckModule mos m = do
|
|||||||
checkModule :: GF -> SourceModule -> Check SourceModule
|
checkModule :: GF -> SourceModule -> Check SourceModule
|
||||||
checkModule gf0 (name,mo) = checkIn ("checking module" +++ prt name) $ do
|
checkModule gf0 (name,mo) = checkIn ("checking module" +++ prt name) $ do
|
||||||
let gr = gf0 {gfmodules = Map.insert name mo (gfmodules gf0)}
|
let gr = gf0 {gfmodules = Map.insert name mo (gfmodules gf0)}
|
||||||
---- checkRestrictedInheritance gr (name, mo)
|
---- checkRestrictedInheritance gr (name, mo)
|
||||||
mo1 <- case mtype mo of
|
mo1 <- case mtype mo of
|
||||||
MTAbstract -> judgementOpModule (checkAbsInfo gr name) mo
|
MTAbstract -> judgementOpModule (checkAbsInfo gr name) mo
|
||||||
MTGrammar -> entryOpModule (checkResInfo gr name) mo
|
MTGrammar -> entryOpModule (checkResInfo gr name) mo
|
||||||
@@ -83,7 +83,6 @@ checkModule gf0 (name,mo) = checkIn ("checking module" +++ prt name) $ do
|
|||||||
|
|
||||||
MTInstance iname -> do
|
MTInstance iname -> do
|
||||||
intf <- checkErr $ lookupModule gr iname
|
intf <- checkErr $ lookupModule gr iname
|
||||||
-- checkCompleteInstance abs mo -- this is done in Rebuild
|
|
||||||
entryOpModule (checkResInfo gr name) mo
|
entryOpModule (checkResInfo gr name) mo
|
||||||
|
|
||||||
return $ (name, mo1)
|
return $ (name, mo1)
|
||||||
|
|||||||
@@ -266,7 +266,8 @@ transResDef x = case x of
|
|||||||
returnl [(f, resOper pt pe) | (f,(pt,pe)) <- defs']
|
returnl [(f, resOper pt pe) | (f,(pt,pe)) <- defs']
|
||||||
|
|
||||||
DefFlag defs -> liftM (Right . concat) $ mapM transFlagDef defs
|
DefFlag defs -> liftM (Right . concat) $ mapM transFlagDef defs
|
||||||
_ -> Bad $ "illegal definition form in resource" +++ printTree x
|
_ -> return $ Left [] ----
|
||||||
|
---- _ -> Bad $ "illegal definition form in resource" +++ printTree x
|
||||||
where
|
where
|
||||||
|
|
||||||
mkParamDefs (p,pars) =
|
mkParamDefs (p,pars) =
|
||||||
@@ -317,7 +318,8 @@ transCncDef x = case x of
|
|||||||
let defs2 = [(f, termInPattern t) | (f,(_,Yes t)) <- defs']
|
let defs2 = [(f, termInPattern t) | (f,(_,Yes t)) <- defs']
|
||||||
returnl [(f, G.CncFun Nothing (yes t) nope) | (f,t) <- defs2]
|
returnl [(f, G.CncFun Nothing (yes t) nope) | (f,t) <- defs2]
|
||||||
-}
|
-}
|
||||||
_ -> errIn ("illegal definition in concrete syntax:") $ transResDef x
|
_ -> return $ Left [] ----
|
||||||
|
---- _ -> errIn ("illegal definition in concrete syntax:") $ transResDef x
|
||||||
|
|
||||||
transPrintDef :: Def -> Err [(Ident,G.Term)]
|
transPrintDef :: Def -> Err [(Ident,G.Term)]
|
||||||
transPrintDef x = case x of
|
transPrintDef x = case x of
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ isLink j = jform j == JLink
|
|||||||
-- constructing judgements from parse tree
|
-- constructing judgements from parse tree
|
||||||
|
|
||||||
emptyJudgement :: JudgementForm -> Judgement
|
emptyJudgement :: JudgementForm -> Judgement
|
||||||
emptyJudgement form = Judgement form meta meta meta (identC "#NOLINK") 0 where
|
emptyJudgement form = Judgement form meta meta meta (identC "#") 0 where
|
||||||
meta = Meta 0
|
meta = Meta 0
|
||||||
|
|
||||||
addJType :: Type -> Judgement -> Judgement
|
addJType :: Type -> Judgement -> Judgement
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ data Module = Module {
|
|||||||
mtype :: ModuleType,
|
mtype :: ModuleType,
|
||||||
miscomplete :: Bool,
|
miscomplete :: Bool,
|
||||||
minterfaces :: [(Ident,Ident)], -- non-empty for functors
|
minterfaces :: [(Ident,Ident)], -- non-empty for functors
|
||||||
minstances :: [((Ident,MInclude),[(Ident,Ident)])], -- non-empty for instant'ions
|
minstances :: [((Ident,MInclude),[(Ident,Ident)])], -- non-empty for inst'ions
|
||||||
mextends :: [(Ident,MInclude)],
|
mextends :: [(Ident,MInclude)],
|
||||||
mopens :: [(Ident,Ident)], -- used name, original name
|
mopens :: [(Ident,Ident)], -- used name, original name
|
||||||
mflags :: Map Ident String,
|
mflags :: Map Ident String,
|
||||||
@@ -49,8 +49,8 @@ data Judgement = Judgement {
|
|||||||
jtype :: Type, -- context type lincat - type PType
|
jtype :: Type, -- context type lincat - type PType
|
||||||
jdef :: Term, -- lindef def lindef lin def constrs
|
jdef :: Term, -- lindef def lindef lin def constrs
|
||||||
jprintname :: Term, -- - - prname prname - -
|
jprintname :: Term, -- - - prname prname - -
|
||||||
jlink :: Ident,
|
jlink :: Ident, -- if inherited, the supermodule name, else #
|
||||||
jposition :: Int
|
jposition :: Int -- line number where def begins
|
||||||
}
|
}
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
@@ -136,11 +136,11 @@ data Patt =
|
|||||||
| PAlt Patt Patt -- ^ disjunctive pattern: p1 | p2
|
| PAlt Patt Patt -- ^ disjunctive pattern: p1 | p2
|
||||||
| PSeq Patt Patt -- ^ sequence of token parts: p + q
|
| PSeq Patt Patt -- ^ sequence of token parts: p + q
|
||||||
| PRep Patt -- ^ repetition of token part: p*
|
| PRep Patt -- ^ repetition of token part: p*
|
||||||
| PChar -- ^ string of length one
|
| PChar -- ^ string of length one: ?
|
||||||
| PChars String -- ^ list of characters
|
| PChars String -- ^ list of characters: ["aeiou"]
|
||||||
|
|
||||||
| PMacro Ident --
|
| PMacro Ident -- #p
|
||||||
| PM Ident Ident
|
| PM Ident Ident -- #m.p
|
||||||
|
|
||||||
deriving (Read, Show, Eq, Ord)
|
deriving (Read, Show, Eq, Ord)
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,16 @@ More options (debugging flags):
|
|||||||
-4 -- ... type checking
|
-4 -- ... type checking
|
||||||
-5 -- ... refreshing
|
-5 -- ... refreshing
|
||||||
|
|
||||||
|
==Compiler Phases==
|
||||||
|
|
||||||
|
LexGF
|
||||||
|
ParGF
|
||||||
|
SourceToGF
|
||||||
|
Extend
|
||||||
|
Rename
|
||||||
|
CheckGrammar
|
||||||
|
Refresh
|
||||||
|
Optimize
|
||||||
|
Factorize
|
||||||
|
GFtoGFCC
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ dps = dropWhile isSpace
|
|||||||
spaceIf pre post w = case w of
|
spaceIf pre post w = case w of
|
||||||
_ | pre w -> "\n" ++ w
|
_ | pre w -> "\n" ++ w
|
||||||
_ | post w -> w ++ "\n"
|
_ | post w -> w ++ "\n"
|
||||||
c:cs | isAlpha c || isDigit c -> " " ++ w
|
c:_ | isAlpha c || isDigit c -> " " ++ w
|
||||||
|
'_':_ -> " " ++ w
|
||||||
_ -> w
|
_ -> w
|
||||||
|
|
||||||
keywordGF w = elem w ["cat","fun","lin","lincat","lindef","oper","param"]
|
keywordGF w = elem w ["cat","fun","lin","lincat","lindef","oper","param"]
|
||||||
|
|||||||
@@ -365,9 +365,10 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
|||||||
CShowTreeGraph | oElem emitCode opts -> do -- -o
|
CShowTreeGraph | oElem emitCode opts -> do -- -o
|
||||||
returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa
|
returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa
|
||||||
CShowTreeGraph -> do
|
CShowTreeGraph -> do
|
||||||
|
let gv = if oElem (iOpt "mac") opts then "open" else "gv" ---- config!
|
||||||
let g0 = writeFile "grphtmp.dot" $ visualizeTrees opts $ strees $ s2t a
|
let g0 = writeFile "grphtmp.dot" $ visualizeTrees opts $ strees $ s2t a
|
||||||
g1 = system "dot -Tps grphtmp.dot >grphtmp.ps"
|
g1 = system "dot -Tps grphtmp.dot >grphtmp.ps"
|
||||||
g2 = system "gv grphtmp.ps &"
|
g2 = system (gv +++ "grphtmp.ps &")
|
||||||
g3 = return () ---- system "rm -f grphtmp.*"
|
g3 = return () ---- system "rm -f grphtmp.*"
|
||||||
justOutput opts (g0 >> g1 >> g2 >> g3 >> return ()) sa
|
justOutput opts (g0 >> g1 >> g2 >> g3 >> return ()) sa
|
||||||
|
|
||||||
@@ -453,9 +454,10 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
|||||||
returnArg (AString (optPrintMultiGrammar opts cgr')) sa
|
returnArg (AString (optPrintMultiGrammar opts cgr')) sa
|
||||||
CShowGrammarGraph -> do
|
CShowGrammarGraph -> do
|
||||||
---- sa' <- changeState purgeShellState sa
|
---- sa' <- changeState purgeShellState sa
|
||||||
|
let gv = if oElem (iOpt "mac") opts then "open" else "gv" ---- config!
|
||||||
let g0 = writeFile "grphtmp.dot" $ visualizeCanonGrammar opts cgr
|
let g0 = writeFile "grphtmp.dot" $ visualizeCanonGrammar opts cgr
|
||||||
g1 = system "dot -Tps grphtmp.dot >grphtmp.ps"
|
g1 = system "dot -Tps grphtmp.dot >grphtmp.ps"
|
||||||
g2 = system "gv grphtmp.ps &"
|
g2 = system (gv +++ "grphtmp.ps &")
|
||||||
g3 = return () ---- system "rm -f grphtmp.*"
|
g3 = return () ---- system "rm -f grphtmp.*"
|
||||||
justOutput opts (g0 >> g1 >> g2 >> g3 >> return ()) sa
|
justOutput opts (g0 >> g1 >> g2 >> g3 >> return ()) sa
|
||||||
CPrintSourceGrammar ->
|
CPrintSourceGrammar ->
|
||||||
|
|||||||
Reference in New Issue
Block a user