mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-01 23:32:51 -06:00
"Committed_by_peb"
This commit is contained in:
15
src/GF.hs
15
src/GF.hs
@@ -1,11 +1,16 @@
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
-- |
|
-- |
|
||||||
-- Module: Main
|
-- Module : Main
|
||||||
-- Responsible: Aarne Ranta (aarne@cs.chalmers.se)
|
-- Maintainer : Aarne Ranta
|
||||||
-- Time-stamp: <2005-02-02, 15:41>
|
-- Stability : (stability)
|
||||||
|
-- Portability : (portability)
|
||||||
--
|
--
|
||||||
-- This is the main module in GF
|
-- > CVS $Date: 2005/02/03 15:13:35 $
|
||||||
----------------------------------------------------------------------
|
-- > CVS $Author: peb $
|
||||||
|
-- > CVS $Revision: 1.18 $
|
||||||
|
--
|
||||||
|
-- (Description)
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ getCanonModule file = do
|
|||||||
getCanonGrammar :: FilePath -> IOE CanonGrammar
|
getCanonGrammar :: FilePath -> IOE CanonGrammar
|
||||||
getCanonGrammar file = do
|
getCanonGrammar file = do
|
||||||
s <- ioeIO $ readFileIf file
|
s <- ioeIO $ readFileIf file
|
||||||
c <- ioeErr {- $ err2err -} $ pCanon $ myLexer s
|
-- c <- ioeErr $ err2err $ pCanon $ myLexer s
|
||||||
|
c <- ioeErr $ pCanon $ myLexer s
|
||||||
return $ canon2grammar c
|
return $ canon2grammar c
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ checkEqLType env t u trm = do
|
|||||||
|
|
||||||
(RecType rs, RecType ts) -> -- and [alpha g a b && l == k --- too strong req
|
(RecType rs, RecType ts) -> -- and [alpha g a b && l == k --- too strong req
|
||||||
-- | ((l,a),(k,b)) <- zip rs ts]
|
-- | ((l,a),(k,b)) <- zip rs ts]
|
||||||
-- || -- if fails, try subtyping:
|
-- . || -- if fails, try subtyping:
|
||||||
all (\ (l,a) ->
|
all (\ (l,a) ->
|
||||||
any (\ (k,b) -> alpha g a b && l == k) ts) rs
|
any (\ (k,b) -> alpha g a b && l == k) ts) rs
|
||||||
|
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ topoSort g = reverse $ tsort 0 [ffs | ffs@(f,_) <- g, inDeg f == 0] [] where
|
|||||||
|
|
||||||
-- the generic fix point iterator
|
-- the generic fix point iterator
|
||||||
|
|
||||||
iterFix :: Eq a => ([a] -> [a]) -> [a] -> [a]
|
iterFix :: Eq a => ([a] -> [a]) -> [a] -> [a]
|
||||||
iterFix more start = iter start start
|
iterFix more start = iter start start
|
||||||
where
|
where
|
||||||
iter old new = if (null new')
|
iter old new = if (null new')
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
-- |
|
-- |
|
||||||
-- Module: GFModes
|
-- Module : Main
|
||||||
-- Responsible: Aarne Ranta (aarne@cs.chalmers.se)
|
-- Maintainer : Aarne Ranta
|
||||||
-- Time-stamp: <2005-02-02, 15:24>
|
-- Stability : (stability)
|
||||||
|
-- Portability : (portability)
|
||||||
--
|
--
|
||||||
-- (Description of the module)
|
-- > CVS $Date: 2005/02/03 15:13:36 $
|
||||||
----------------------------------------------------------------------
|
-- > CVS $Author: peb $
|
||||||
|
-- > CVS $Revision: 1.4 $
|
||||||
|
--
|
||||||
|
-- (Description)
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GFModes (gfInteract, gfBatch, batchCompile) where
|
module GFModes (gfInteract, gfBatch, batchCompile) where
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ pCommand = pCommandWords . words where
|
|||||||
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
|
||||||
"g" : ws -> CRefineWithTree $ unwords ws -- *g*ive
|
"g" : ws -> CRefineWithTree $ unwords ws -- example: *g*ive
|
||||||
"p" : ws -> CRefineParse $ unwords ws
|
"p" : ws -> CRefineParse $ unwords ws
|
||||||
"rc": i : _ -> CRefineWithClip (readIntArg i)
|
"rc": i : _ -> CRefineWithClip (readIntArg i)
|
||||||
">" : i : _ -> CAhead $ readIntArg i
|
">" : i : _ -> CAhead $ readIntArg i
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ data SRG = SRG { grammarName :: String -- ^ grammar name
|
|||||||
data SRGRule = SRGRule String String [SRGAlt] -- ^ SRG category name, original category name
|
data SRGRule = SRGRule String String [SRGAlt] -- ^ SRG category name, original category name
|
||||||
-- and productions
|
-- and productions
|
||||||
type SRGAlt = [Symbol String Token]
|
type SRGAlt = [Symbol String Token]
|
||||||
type CatName = (String,String) -- ^ SRG category name and original name
|
type CatName = (String,String)
|
||||||
|
-- ^ SRG category name and original name
|
||||||
|
|
||||||
type CatNames = FiniteMap String String
|
type CatNames = FiniteMap String String
|
||||||
|
|
||||||
|
|||||||
81
src/haddock/haddock-script.csh
Normal file
81
src/haddock/haddock-script.csh
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/tcsh
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Author: Peter Ljunglöf
|
||||||
|
# Time-stamp: "2005-02-03, 16:05"
|
||||||
|
# CVS $Date: 2005/02/03 15:13:36 $
|
||||||
|
# CVS $Author: peb $
|
||||||
|
#
|
||||||
|
# a script for producing documentation through Haddock
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
set base = `pwd`
|
||||||
|
set docdir = $base/haddock
|
||||||
|
set resourcedir = $base/haddock-resources
|
||||||
|
|
||||||
|
set dirs = (. api compile grammar infra shell source canonical useGrammar cf newparsing parsers notrace cfgm speech visualization for-ghc)
|
||||||
|
set rmfiles = {Lex,Par}{CFG,GF,GFC}.hs
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo 0. Cleaning Haddock directory
|
||||||
|
|
||||||
|
rm $docdir/*
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo 1. Selecting and copying Haskell files
|
||||||
|
|
||||||
|
foreach d ($dirs)
|
||||||
|
echo -- Directory: $d
|
||||||
|
cd $base/$d
|
||||||
|
foreach f (*.hs)
|
||||||
|
tr "\240" " " < $f > $docdir/$f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 2. Removing unnecessary files
|
||||||
|
|
||||||
|
cd $docdir
|
||||||
|
echo -- `ls $rmfiles`
|
||||||
|
rm $rmfiles
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 3. Invoking Haddock
|
||||||
|
|
||||||
|
cd $docdir
|
||||||
|
haddock -h -t 'Grammatical Framework' *.hs
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 4. Restructuring to HTML framesets
|
||||||
|
|
||||||
|
cd $docdir
|
||||||
|
echo -- Substituting for frame targets inside html files
|
||||||
|
mv index.html index-frame.html
|
||||||
|
foreach f (*.html)
|
||||||
|
perl -pe 's/<HEAD/<HEAD><BASE TARGET="contents"/; s/"index.html"/"index-frame.html"/; s/(<A HREF = "\S*index\S*.html")/$1 TARGET="index"/' $f > tempfile
|
||||||
|
mv tempfile $f
|
||||||
|
end
|
||||||
|
|
||||||
|
cd $resourcedir
|
||||||
|
echo -- Copying resource files:
|
||||||
|
echo -- `ls`
|
||||||
|
cp * $docdir
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 5. Finished
|
||||||
|
echo -- The documentation is located at:
|
||||||
|
echo -- $docdir/index.html
|
||||||
|
|
||||||
|
cd $base
|
||||||
|
|
||||||
|
|
||||||
10
src/haddock/resources/blank.html
Normal file
10
src/haddock/resources/blank.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||||
|
|
||||||
|
<!-- Time-stamp: "2005-02-03, 15:59" -->
|
||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<LINK HREF="haddock.css" REL=stylesheet>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
14
src/haddock/resources/index.html
Normal file
14
src/haddock/resources/index.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
|
||||||
|
"http://www.w3.org/TR/html4/frameset.dtd">
|
||||||
|
|
||||||
|
<!-- Time-stamp: "2005-02-03, 15:53" -->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
|
||||||
|
<title>Grammatical Framework programmer's documentation</title>
|
||||||
|
</head>
|
||||||
|
<frameset cols="1*,2*">
|
||||||
|
<frame name="index" src="index-frame.html">
|
||||||
|
<frame name="contents" src="blank.html">
|
||||||
|
</frameset>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user