Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry
curry-frontend
Commits
7416da4c
Commit
7416da4c
authored
Apr 22, 2014
by
Björn Peemöller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed module Frontend
parent
6754e3aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
72 deletions
+50
-72
curry-frontend.cabal
curry-frontend.cabal
+0
-1
src/Frontend.hs
src/Frontend.hs
+0
-66
src/Html/CurryHtml.hs
src/Html/CurryHtml.hs
+50
-5
No files found.
curry-frontend.cabal
View file @
7416da4c
...
...
@@ -70,7 +70,6 @@ Executable cymake
, Env.TypeConstructor
, Env.Value
, Exports
, Frontend
, Generators
, Generators.GenAbstractCurry
, Generators.GenFlatCurry
...
...
src/Frontend.hs
deleted
100644 → 0
View file @
6754e3aa
{- |
Module : $Header$
Description : API to access cymake as a library
Copyright : (c) 2005 Martin Engelke
2011 - 2014 Björn Peemöller
License : OtherLicense
Maintainer : bjp@informatik.uni-kiel.de
Stability : experimental
Portability : portable
This module provides an API for dealing with several kinds of Curry
program representations.
-}
module
Frontend
(
parse
,
fullParse
)
where
import
Control.Monad.Writer
import
Control.Monad.Trans.Either
import
Curry.Base.Message
import
Curry.Syntax
(
Module
(
..
),
parseModule
)
import
CompilerOpts
(
Options
(
..
),
defaultOptions
)
import
CurryBuilder
(
buildCurry
)
import
Modules
(
loadAndCheckModule
,
checkModuleHeader
)
{- |Return the result of a syntactical analysis of the source program 'src'.
The result is the syntax tree of the program (type 'Module'; see Module
"CurrySyntax").
-}
parse
::
FilePath
->
String
->
MessageM
Module
parse
fn
src
=
parseModule
fn
src
>>=
genCurrySyntax
where
genCurrySyntax
mod1
=
do
checked
<-
lift
$
runEitherT
$
checkModuleHeader
defaultOptions
fn
mod1
case
checked
of
Left
hdrErrs
->
failWith
$
show
$
head
hdrErrs
Right
mdl
->
return
mdl
{- |Return the syntax tree of the source program 'src' (type 'Module'; see
Module "CurrySyntax").after inferring the types of identifiers.
'fullParse' always searches for standard Curry libraries in the path
defined in the
environment variable "PAKCSLIBPATH". Additional search paths can
be defined using the argument 'paths'.
-}
fullParse
::
Options
->
FilePath
->
String
->
MessageIO
Module
fullParse
opts
fn
_
=
do
errs
<-
liftIO
$
makeInterfaces
opts
fn
if
null
errs
then
do
checked
<-
liftIO
$
runEitherT
$
loadAndCheckModule
opts
fn
case
checked
of
Left
errs'
->
failWith
$
show
$
head
errs'
Right
(
_
,
mod'
)
->
return
mod'
else
failWith
$
show
$
head
errs
-- Generates interface files for importes modules, if they don't exist or
-- if they are not up-to-date.
makeInterfaces
::
Options
->
FilePath
->
IO
[
Message
]
makeInterfaces
opts
fn
=
do
res
<-
runEitherT
$
buildCurry
opts
fn
case
res
of
Left
errs
->
return
errs
Right
_
->
return
[]
src/Html/CurryHtml.hs
View file @
7416da4c
{- |
Module : $Header$
Description : Generating HTML documentation
Copyright : (c) 2011, Björn Peemöller
(bjp@informatik.uni-kiel.de)
Copyright : (c) 2011
- 2014
, Björn Peemöller
License : OtherLicense
Maintainer : bjp@informatik.uni-kiel.de
...
...
@@ -13,21 +13,25 @@
-}
module
Html.CurryHtml
(
source2html
)
where
import
Control.Monad.Writer
import
Control.Monad.Trans.Either
import
Data.Char
(
toLower
)
import
Data.Maybe
(
fromMaybe
,
isJust
)
import
Curry.Base.Ident
(
QualIdent
(
..
),
unqualify
)
import
Curry.Base.Message
(
fromIO
)
import
Curry.Base.Message
import
Curry.Base.Pretty
(
text
)
import
Curry.Files.Filenames
(
dropExtension
,
takeFileName
)
import
Curry.Files.PathUtils
(
readModule
,
lookupCurryFile
)
import
Curry.Syntax
(
lexSourc
e
)
import
Curry.Syntax
(
Module
,
lexSource
,
parseModul
e
)
import
Html.SyntaxColoring
import
Base.Messages
import
CompilerOpts
(
Options
(
..
),
TargetType
(
..
))
import
Frontend
(
parse
,
fullParse
)
import
CompilerOpts
(
Options
(
..
),
TargetType
(
..
),
defaultOptions
)
import
CurryBuilder
(
buildCurry
)
import
Modules
(
loadAndCheckModule
,
checkModuleHeader
)
--- translate source file into HTML file with syntaxcoloring
--- @param sourcefilename
...
...
@@ -55,6 +59,47 @@ filename2program opts f = do
lexed
=
lexSource
f
src
return
$
genProgram
src
[
typed
,
checked
,
parsed
]
lexed
{- |Return the result of a syntactical analysis of the source program 'src'.
The result is the syntax tree of the program (type 'Module'; see Module
"CurrySyntax").
-}
parse
::
FilePath
->
String
->
MessageM
Module
parse
fn
src
=
parseModule
fn
src
>>=
genCurrySyntax
where
genCurrySyntax
mod1
=
do
checked
<-
lift
$
runEitherT
$
checkModuleHeader
defaultOptions
fn
mod1
case
checked
of
Left
hdrErrs
->
failWith
$
show
$
head
hdrErrs
Right
mdl
->
return
mdl
{- |Return the syntax tree of the source program 'src' (type 'Module'; see
Module "CurrySyntax").after inferring the types of identifiers.
'fullParse' always searches for standard Curry libraries in the path
defined in the
environment variable "PAKCSLIBPATH". Additional search paths can
be defined using the argument 'paths'.
-}
fullParse
::
Options
->
FilePath
->
String
->
MessageIO
Module
fullParse
opts
fn
_
=
do
errs
<-
liftIO
$
makeInterfaces
opts
fn
if
null
errs
then
do
checked
<-
liftIO
$
runEitherT
$
loadAndCheckModule
opts
fn
case
checked
of
Left
errs'
->
failWith
$
show
$
head
errs'
Right
(
_
,
mod'
)
->
return
mod'
else
failWith
$
show
$
head
errs
-- Generates interface files for importes modules, if they don't exist or
-- if they are not up-to-date.
makeInterfaces
::
Options
->
FilePath
->
IO
[
Message
]
makeInterfaces
opts
fn
=
do
res
<-
runEitherT
$
buildCurry
opts
fn
case
res
of
Left
errs
->
return
errs
Right
_
->
return
[]
-- generates htmlcode with syntax highlighting
-- @param modulname
-- @param a program
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment