mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
hmsg for Hajo's editor
This commit is contained in:
@@ -754,7 +754,7 @@ oper
|
|||||||
love ;
|
love ;
|
||||||
|
|
||||||
reflTransVerb : TransVerb -> VerbGroup = \se ->
|
reflTransVerb : TransVerb -> VerbGroup = \se ->
|
||||||
useVerb se (\\_,n,p => se.s1 ++ {-strPrep-} se.s2 ++ reflPron n p) ;
|
useVerb se (\\_,n,p => {-strPrep-} se.s2 ++ reflPron n p) ;
|
||||||
|
|
||||||
reflPron : Number -> Person -> Str ;
|
reflPron : Number -> Person -> Str ;
|
||||||
|
|
||||||
@@ -771,7 +771,7 @@ oper
|
|||||||
DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \ge,dig,vin ->
|
DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \ge,dig,vin ->
|
||||||
useVerb
|
useVerb
|
||||||
ge
|
ge
|
||||||
(\\_,_,_ => ge.s1 ++ ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc) ;
|
(\\_,_,_ => ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc) ;
|
||||||
|
|
||||||
-- Adjective-complement ditransitive verbs.
|
-- Adjective-complement ditransitive verbs.
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ oper
|
|||||||
DitransAdjVerb -> NounPhrase -> AdjPhrase -> VerbGroup = \gor,dig,sur ->
|
DitransAdjVerb -> NounPhrase -> AdjPhrase -> VerbGroup = \gor,dig,sur ->
|
||||||
useVerb
|
useVerb
|
||||||
gor
|
gor
|
||||||
(\\_,_,_ => gor.s1 ++ {-strPrep-} gor.s2 ++ dig.s ! PAcc ++
|
(\\_,_,_ => {-strPrep-} gor.s2 ++ dig.s ! PAcc ++
|
||||||
sur.s ! predFormAdj dig.g dig.n ! Nom) ;
|
sur.s ! predFormAdj dig.g dig.n ! Nom) ;
|
||||||
|
|
||||||
complAdjVerb :
|
complAdjVerb :
|
||||||
@@ -1011,20 +1011,20 @@ oper
|
|||||||
SentenceVerb : Type = Verb ;
|
SentenceVerb : Type = Verb ;
|
||||||
|
|
||||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \se,duler ->
|
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \se,duler ->
|
||||||
useVerb se (\\_,_,_ => se.s1 ++ optStr infinAtt ++ duler.s ! Sub) ;
|
useVerb se (\\_,_,_ => optStr infinAtt ++ duler.s ! Sub) ;
|
||||||
|
|
||||||
complQuestVerb : SentenceVerb -> QuestionSent -> VerbGroup = \se,omduler ->
|
complQuestVerb : SentenceVerb -> QuestionSent -> VerbGroup = \se,omduler ->
|
||||||
useVerb se (\\_,_,_ => se.s1 ++ omduler.s ! IndirQ) ;
|
useVerb se (\\_,_,_ => omduler.s ! IndirQ) ;
|
||||||
|
|
||||||
complDitransSentVerb : TransVerb -> NounPhrase -> Sentence -> VerbGroup =
|
complDitransSentVerb : TransVerb -> NounPhrase -> Sentence -> VerbGroup =
|
||||||
\sa,honom,duler ->
|
\sa,honom,duler ->
|
||||||
useVerb sa
|
useVerb sa
|
||||||
(\\_,_,_ => sa.s1 ++ {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ optStr infinAtt ++ duler.s ! Main) ;
|
(\\_,_,_ => {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ optStr infinAtt ++ duler.s ! Main) ;
|
||||||
|
|
||||||
complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> VerbGroup =
|
complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> VerbGroup =
|
||||||
\sa,honom,omduler ->
|
\sa,honom,omduler ->
|
||||||
useVerb sa
|
useVerb sa
|
||||||
(\\_,_,_ => sa.s1 ++ {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ omduler.s ! IndirQ) ;
|
(\\_,_,_ => {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ omduler.s ! IndirQ) ;
|
||||||
|
|
||||||
--3 Verb-complement verbs
|
--3 Verb-complement verbs
|
||||||
--
|
--
|
||||||
@@ -1038,14 +1038,12 @@ oper
|
|||||||
complVerbVerb : VerbVerb -> VerbPhrase -> VerbGroup = \vilja, simma ->
|
complVerbVerb : VerbVerb -> VerbPhrase -> VerbGroup = \vilja, simma ->
|
||||||
useVerb vilja
|
useVerb vilja
|
||||||
(\\g,n,p =>
|
(\\g,n,p =>
|
||||||
vilja.s1 ++
|
|
||||||
if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
||||||
simma.s ! VIInfinit ! g ! n ! p) ;
|
simma.s ! VIInfinit ! g ! n ! p) ;
|
||||||
|
|
||||||
transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta ->
|
transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta ->
|
||||||
{s = vilja.s ;
|
{s = vilja.s ;
|
||||||
s1 = vilja.s1 ++
|
s1 = if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
||||||
if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
|
||||||
hitta.s ! VI (Inf Act) ++ hitta.s1 ;
|
hitta.s ! VI (Inf Act) ++ hitta.s1 ;
|
||||||
s2 = hitta.s2
|
s2 = hitta.s2
|
||||||
} ;
|
} ;
|
||||||
@@ -1065,7 +1063,7 @@ oper
|
|||||||
Bool -> DitransVerbVerb -> NounPhrase -> VerbPhrase -> VerbGroup =
|
Bool -> DitransVerbVerb -> NounPhrase -> VerbPhrase -> VerbGroup =
|
||||||
\obj,be,dig,simma ->
|
\obj,be,dig,simma ->
|
||||||
useVerb be
|
useVerb be
|
||||||
(\\g,n,p => be.s1 ++ {-strPrep-} be.s2 ++ dig.s ! PAcc ++ be.s3 ++
|
(\\g,n,p => {-strPrep-} be.s2 ++ dig.s ! PAcc ++ be.s3 ++
|
||||||
if_then_Str obj
|
if_then_Str obj
|
||||||
(simma.s ! VIInfinit ! dig.g ! dig.n ! dig.p)
|
(simma.s ! VIInfinit ! dig.g ! dig.n ! dig.p)
|
||||||
(simma.s ! VIInfinit ! g ! n ! p)
|
(simma.s ! VIInfinit ! g ! n ! p)
|
||||||
@@ -1098,14 +1096,13 @@ oper
|
|||||||
|
|
||||||
slashTransVerb : NounPhrase -> TransVerb -> ClauseSlashNounPhrase =
|
slashTransVerb : NounPhrase -> TransVerb -> ClauseSlashNounPhrase =
|
||||||
\jag, se ->
|
\jag, se ->
|
||||||
predVerbGroupClause jag (useVerb se (\\_,_,_ => se.s1)) ** {s2 = se.s2} ;
|
predVerbGroupClause jag (useVerb se (\\_,_,_ => [])) ** {s2 = se.s2} ;
|
||||||
|
|
||||||
--- this does not give negative or anterior forms
|
--- this does not give negative or anterior forms
|
||||||
|
|
||||||
slashVerbVerb : NounPhrase -> VerbVerb -> TransVerb -> ClauseSlashNounPhrase =
|
slashVerbVerb : NounPhrase -> VerbVerb -> TransVerb -> ClauseSlashNounPhrase =
|
||||||
\jag,vilja,se ->
|
\jag,vilja,se ->
|
||||||
predVerbGroupClause jag (useVerb vilja (\\g,n,p =>
|
predVerbGroupClause jag (useVerb vilja (\\g,n,p =>
|
||||||
vilja.s1 ++
|
|
||||||
if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++
|
||||||
se.s ! VI (Inf Act))
|
se.s ! VI (Inf Act))
|
||||||
) ** {s2 = se.s2} ;
|
) ** {s2 = se.s2} ;
|
||||||
|
|||||||
@@ -11,7 +11,15 @@ instance SyntaxSwe of SyntaxScand = TypesSwe **
|
|||||||
|
|
||||||
oper
|
oper
|
||||||
|
|
||||||
npMan : NounPhrase = nameNounPhrase (mkProperName "man" (NUtr Masc)) ;
|
npMan : NounPhrase = {
|
||||||
|
s = table {
|
||||||
|
PNom => "man" ;
|
||||||
|
PAcc => "en" ;
|
||||||
|
PGen _ => "ens"
|
||||||
|
} ;
|
||||||
|
g = Utr ; n = Sg ; p = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ;
|
npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ;
|
||||||
|
|
||||||
mkAdjForm : Species -> Number -> NounGender -> AdjFormPos = \b,n,g ->
|
mkAdjForm : Species -> Number -> NounGender -> AdjFormPos = \b,n,g ->
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
-- Stability : (stable)
|
-- Stability : (stable)
|
||||||
-- Portability : (portable)
|
-- Portability : (portable)
|
||||||
--
|
--
|
||||||
-- > CVS $Date: 2005/02/24 11:46:36 $
|
-- > CVS $Date: 2005/03/10 11:14:11 $
|
||||||
-- > CVS $Author: peb $
|
-- > CVS $Author: aarne $
|
||||||
-- > CVS $Revision: 1.14 $
|
-- > CVS $Revision: 1.15 $
|
||||||
--
|
--
|
||||||
-- (Description of the module)
|
-- (Description of the module)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@@ -77,13 +77,19 @@ getCommand = do
|
|||||||
|
|
||||||
-- | decodes UTF8 if u==False, i.e. if the grammar does not use UTF8;
|
-- | decodes UTF8 if u==False, i.e. if the grammar does not use UTF8;
|
||||||
-- used in the Java GUI, which always uses UTF8
|
-- used in the Java GUI, which always uses UTF8
|
||||||
getCommandUTF :: Bool -> IO Command
|
getCommandUTF :: Bool -> IO (String,Command)
|
||||||
getCommandUTF u = do
|
getCommandUTF u = do
|
||||||
s <- getLine
|
s <- getLine
|
||||||
return $ pCommand $ if u then s else decodeUTF8 s
|
return $ pCommandMsg $ if u then s else decodeUTF8 s
|
||||||
|
|
||||||
pCommand :: String -> Command
|
pCommand :: String -> Command
|
||||||
pCommand = pCommandWords . words where
|
pCommand = snd . pCommandMsg
|
||||||
|
|
||||||
|
pCommandMsg :: String -> (String,Command)
|
||||||
|
pCommandMsg s = (m,pCommandWords $ words c) where
|
||||||
|
(m,c) = case s of
|
||||||
|
'[':s2 -> let (a,b) = span (/=']') s2 in (a,drop 1 b)
|
||||||
|
_ -> ("",s)
|
||||||
pCommandWords s = case s of
|
pCommandWords s = case s of
|
||||||
"n" : cat : _ -> CNewCat cat
|
"n" : cat : _ -> CNewCat cat
|
||||||
"t" : ws -> CNewTree $ unwords ws
|
"t" : ws -> CNewTree $ unwords ws
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
-- Stability : (stable)
|
-- Stability : (stable)
|
||||||
-- Portability : (portable)
|
-- Portability : (portable)
|
||||||
--
|
--
|
||||||
-- > CVS $Date: 2005/02/24 11:46:36 $
|
-- > CVS $Date: 2005/03/10 11:14:11 $
|
||||||
-- > CVS $Author: peb $
|
-- > CVS $Author: aarne $
|
||||||
-- > CVS $Revision: 1.35 $
|
-- > CVS $Revision: 1.36 $
|
||||||
--
|
--
|
||||||
-- temporary hacks for GF 2.0
|
-- temporary hacks for GF 2.0
|
||||||
--
|
--
|
||||||
@@ -449,9 +449,10 @@ displaySStateIn env state = (tree',msg,menu) where
|
|||||||
separ = singleton . map unlines . intersperse [replicate 72 '*']
|
separ = singleton . map unlines . intersperse [replicate 72 '*']
|
||||||
|
|
||||||
-- | the Boolean is a temporary hack to have two parallel GUIs
|
-- | the Boolean is a temporary hack to have two parallel GUIs
|
||||||
displaySStateJavaX :: Bool -> CEnv -> SState -> String
|
displaySStateJavaX :: Bool -> CEnv -> SState -> String -> String
|
||||||
displaySStateJavaX isNew env state = encodeUTF8 $ mkUnicode $
|
displaySStateJavaX isNew env state m = encodeUTF8 $ mkUnicode $
|
||||||
unlines $ tagXML "gfedit" $ concat [
|
unlines $ tagXML "gfedit" $ concat [
|
||||||
|
if null m then [] else tagXML "hmsg" [m],
|
||||||
tagXML "linearizations" (concat
|
tagXML "linearizations" (concat
|
||||||
[tagAttrXML "lin" ("lang", prLanguage lang) ss | (lang,ss) <- lins]),
|
[tagAttrXML "lin" ("lang", prLanguage lang) ss | (lang,ss) <- lins]),
|
||||||
tagXML "tree" tree,
|
tagXML "tree" tree,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
-- Stability : (stable)
|
-- Stability : (stable)
|
||||||
-- Portability : (portable)
|
-- Portability : (portable)
|
||||||
--
|
--
|
||||||
-- > CVS $Date: 2005/02/24 11:46:37 $
|
-- > CVS $Date: 2005/03/10 11:14:11 $
|
||||||
-- > CVS $Author: peb $
|
-- > CVS $Author: aarne $
|
||||||
-- > CVS $Revision: 1.10 $
|
-- > CVS $Revision: 1.11 $
|
||||||
--
|
--
|
||||||
-- GF editing session controlled by e.g. a Java program. AR 16\/11\/2001
|
-- GF editing session controlled by e.g. a Java program. AR 16\/11\/2001
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@@ -43,20 +43,20 @@ sessionLineJ isNew env = do
|
|||||||
-- the Boolean is a temporary hack to have two parallel GUIs
|
-- the Boolean is a temporary hack to have two parallel GUIs
|
||||||
editLoopJnewX :: Bool -> CEnv -> SState -> IO ()
|
editLoopJnewX :: Bool -> CEnv -> SState -> IO ()
|
||||||
editLoopJnewX isNew env state = do
|
editLoopJnewX isNew env state = do
|
||||||
c <- getCommandUTF (isCEnvUTF8 env state) ----
|
(m,c) <- getCommandUTF (isCEnvUTF8 env state) ----
|
||||||
case c of
|
case c of
|
||||||
CQuit -> return ()
|
CQuit -> return ()
|
||||||
|
|
||||||
c -> do
|
c -> do
|
||||||
(env',state') <- execCommand env c state
|
(env',state') <- execCommand env c state
|
||||||
let inits = initAndEditMsgJavaX isNew env' state'
|
let inits = initAndEditMsgJavaX isNew env' state' m
|
||||||
let package = case c of
|
let package = case c of
|
||||||
CCEnvImport _ -> inits
|
CCEnvImport _ -> inits
|
||||||
CCEnvEmptyAndImport _ -> inits
|
CCEnvEmptyAndImport _ -> inits
|
||||||
CCEnvOpenTerm _ -> inits
|
CCEnvOpenTerm _ -> inits
|
||||||
CCEnvOpenString _ -> inits
|
CCEnvOpenString _ -> inits
|
||||||
CCEnvEmpty -> initEditMsgJavaX env'
|
CCEnvEmpty -> initEditMsgJavaX env'
|
||||||
_ -> displaySStateJavaX isNew env' state'
|
_ -> displaySStateJavaX isNew env' state' m
|
||||||
putStrLnFlush package
|
putStrLnFlush package
|
||||||
editLoopJnewX isNew env' state'
|
editLoopJnewX isNew env' state'
|
||||||
|
|
||||||
@@ -74,6 +74,6 @@ initEditMsgJavaX env = encodeUTF8 $ mkUnicode $ unlines $ tagXML "gfinit" $
|
|||||||
(file,lang) <- zip (allGrammarFileNames env) (allLanguages env)]
|
(file,lang) <- zip (allGrammarFileNames env) (allLanguages env)]
|
||||||
|
|
||||||
|
|
||||||
initAndEditMsgJavaX :: Bool -> CEnv -> SState -> String
|
initAndEditMsgJavaX :: Bool -> CEnv -> SState -> String -> String
|
||||||
initAndEditMsgJavaX isNew env state =
|
initAndEditMsgJavaX isNew env state m =
|
||||||
initEditMsgJavaX env ++++ displaySStateJavaX isNew env state
|
initEditMsgJavaX env ++++ displaySStateJavaX isNew env state m
|
||||||
|
|||||||
Reference in New Issue
Block a user