Commit ea5e58d6 authored by Michael Hanus 's avatar Michael Hanus

Description updated

parent 453c2aa8
......@@ -9,7 +9,7 @@ Curry source code and classifies it into a few standard categories
The tool can be directly installed by the command
> cpm installbin addtypes
> cypm install addtypes
This installs the executable `curry-addtypes` in the bin directory of CPM.
......@@ -22,3 +22,7 @@ be added, e.g.,
> curry-addtypes LazyProgram
This command replaces the program `LazyProgram.curry` by a new
program text where type signatures to top-level operations
have been added. The old version of the program is saved
to `LazyProgram.ORG.curry`.
......@@ -13,8 +13,8 @@
"wl-pprint" : ">= 0.0.1"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
"pakcs": ">= 2.0.0, < 3.0.0",
"kics2": ">= 2.0.0, < 3.0.0"
},
"description":
"This package contains a tool which adds missing type signatures
......
......@@ -22,17 +22,17 @@
---
--- @author Bernd Brassel
--- @version April 2005
--- @category meta
----------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-incomplete-patterns #-}
module CurryStringClassifier
(Tokens,Token(..), scan, plainCode, unscan,
isSmallComment, isBigComment, isComment, isText, isLetter,
isCode, isModuleHead, isMeta, readScan,testScan)
where
( Tokens, Token(..), scan, plainCode, unscan
, isSmallComment, isBigComment, isComment, isText, isLetter
, isCode, isModuleHead, isMeta, readScan, testScan
) where
import Char(isDigit,isSpace)
import Char ( isDigit, isSpace )
--- The different categories to classify the source code.
data Token = SmallComment String
......@@ -47,39 +47,47 @@ type Tokens = [Token]
--- test for category "SmallComment"
isSmallComment :: Token -> Bool
isSmallComment x = case x of
SmallComment _ -> True
_ -> False
--- test for category "BigComment"
isBigComment :: Token -> Bool
isBigComment x = case x of
BigComment _ -> True
_ -> False
--- test if given token is a comment (big or small)
isComment :: Token -> Bool
isComment x = isSmallComment x || isBigComment x
--- test for category "Text" (String)
isText :: Token -> Bool
isText x = case x of
Text _ -> True
_ -> False
--- test for category "Letter" (Char)
isLetter :: Token -> Bool
isLetter x = case x of
Letter _ -> True
_ -> False
--- test for category "Code"
isCode :: Token -> Bool
isCode x = case x of
Code _ -> True
_ -> False
--- test for category "ModuleHead", ie imports and operator declarations
isModuleHead :: Token -> Bool
isModuleHead x = case x of
ModuleHead _ -> True
_ -> False
--- test for category "Meta", ie between {+ and +}
isMeta :: Token -> Bool
isMeta x = case x of
Meta _ -> True
_ -> False
......@@ -93,6 +101,7 @@ unweaveCode [] = ([],[])
unweaveCode (t:ts) = let (cs,ncs) = unweaveCode ts in
if isCode t then (t:cs,ncs) else (cs,t:ncs)
weave :: ([a],[a]) -> [a]
weave xys = case xys of
([],[]) -> []
([],[y]) -> [y]
......@@ -231,6 +240,7 @@ toBeEscaped = "\\\n\r\t\""
maybeCode :: [Char] -> Tokens -> Tokens
maybeCode s ts = {-if s=="" then ts else-} Code s:ts
maybeMo :: String -> [Token] -> [Token]
maybeMo s ts = if s=="" then ts else ModuleHead s:case ts of
Code c:ts' -> Code ('\n':c):ts'
_ -> ts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment