Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Cloogle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cloogle
Cloogle
Commits
537593aa
Verified
Commit
537593aa
authored
May 20, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export strictness information
parent
1063d1b7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
62 deletions
+59
-62
Clean/Doc.dcl
Clean/Doc.dcl
+38
-38
Clean/Doc.icl
Clean/Doc.icl
+11
-13
CleanPrettyPrint
CleanPrettyPrint
+1
-1
CleanTypes
CleanTypes
+1
-1
Cloogle/DB/Factory.dcl
Cloogle/DB/Factory.dcl
+5
-5
Cloogle/DB/Factory.icl
Cloogle/DB/Factory.icl
+2
-3
libcloogle
libcloogle
+1
-1
No files found.
Clean/Doc.dcl
View file @
537593aa
...
...
@@ -36,9 +36,9 @@ class docProperties d :: !d -> [Property]
* Documentation of a Clean module.
*/
::
ModuleDoc
=
{
description
::
Maybe
Description
,
property_bootstrap
::
Maybe
MultiLineString
//* For generating unit tests with clean-test
,
property_test_with
::
[
PropertyVarInstantiation
]
//* With which types to test the properties
{
description
::
!
Maybe
Description
,
property_bootstrap
::
!
Maybe
MultiLineString
//* For generating unit tests with clean-test
,
property_test_with
::
!
[
PropertyVarInstantiation
]
//* With which types to test the properties
}
instance
docDescription
ModuleDoc
...
...
@@ -50,14 +50,14 @@ derive gDefault ModuleDoc
* Documentation of a Clean function.
*/
::
FunctionDoc
=
{
description
::
Maybe
Description
,
params
::
[
Description
]
//* Descriptions of the parameters
,
vars
::
[
Description
]
//* Descriptions of the type variables (for generics)
,
results
::
[
Description
]
//* Descriptions of the result(s, for tuples)
,
type
::
Maybe
Type
//* The type (for macros)
,
throws
::
[
Description
]
//* The exceptions it may throw (iTasks)
,
properties
::
[
Property
]
//* Properties of this function
,
property_test_with
::
[
PropertyVarInstantiation
]
//* With which types to test the properties
{
description
::
!
Maybe
Description
,
params
::
!
[
Description
]
//* Descriptions of the parameters
,
vars
::
!
[
Description
]
//* Descriptions of the type variables (for generics)
,
results
::
!
[
Description
]
//* Descriptions of the result(s, for tuples)
,
type
::
!
Maybe
Type
//* The type (for macros)
,
throws
::
!
[
Description
]
//* The exceptions it may throw (iTasks)
,
properties
::
!
[
Property
]
//* Properties of this function
,
property_test_with
::
!
[
PropertyVarInstantiation
]
//* With which types to test the properties
}
instance
docDescription
FunctionDoc
...
...
@@ -70,9 +70,9 @@ instance docPropertyTestWith FunctionDoc
instance
docProperties
FunctionDoc
::
Property
=
ForAll
String
[(
String
,
Type
)]
String
=
ForAll
!
String
![(!
String
,!
Type
)]
!
String
::
PropertyVarInstantiation
=
PropertyVarInstantiation
(
String
,
Type
)
::
PropertyVarInstantiation
=
PropertyVarInstantiation
!(!
String
,
!
Type
)
derive
gDefault
FunctionDoc
,
Property
,
PropertyVarInstantiation
...
...
@@ -81,11 +81,11 @@ derive gDefault FunctionDoc, Property, PropertyVarInstantiation
* For an explanation of the fields, see the documentation on {{`FunctionDoc`}}.
*/
::
ClassMemberDoc
=
{
description
::
Maybe
Description
,
params
::
[
Description
]
,
results
::
[
Description
]
,
type
::
Maybe
Type
,
throws
::
[
Description
]
{
description
::
!
Maybe
Description
,
params
::
!
[
Description
]
,
results
::
!
[
Description
]
,
type
::
!
Maybe
Type
,
throws
::
!
[
Description
]
}
instance
docDescription
ClassMemberDoc
...
...
@@ -100,8 +100,8 @@ derive gDefault ClassMemberDoc
* For an explanation of the fields, see the documentation on {{`FunctionDoc`}}.
*/
::
ConstructorDoc
=
{
description
::
Maybe
Description
,
params
::
[
Description
]
{
description
::
!
Maybe
Description
,
params
::
!
[
Description
]
}
instance
docDescription
ConstructorDoc
...
...
@@ -112,9 +112,9 @@ derive gDefault ConstructorDoc
* Documentation of a Clean class.
*/
::
ClassDoc
=
{
description
::
Maybe
Description
,
vars
::
[
Description
]
//* The type variables
,
members
::
[
Maybe
ClassMemberDoc
]
//* Documentation on the members
{
description
::
!
Maybe
Description
,
vars
::
!
[
Description
]
//* The type variables
,
members
::
!
[
Maybe
ClassMemberDoc
]
//* Documentation on the members
}
instance
docDescription
ClassDoc
...
...
@@ -126,11 +126,11 @@ derive gDefault ClassDoc
* Documentation of a Clean type.
*/
::
TypeDoc
=
{
description
::
Maybe
Description
,
vars
::
[
Description
]
//* Type variables
,
representation
::
Maybe
(
Maybe
Description
)
//* For synonym types
,
fields
::
Maybe
[
Maybe
Description
]
//* For records
,
constructors
::
Maybe
[
Maybe
ConstructorDoc
]
//* For ADTs
{
description
::
!
Maybe
Description
,
vars
::
!
[
Description
]
//* Type variables
,
representation
::
!
Maybe
(
Maybe
Description
)
//* For synonym types
,
fields
::
!
Maybe
[
Maybe
Description
]
//* For records
,
constructors
::
!
Maybe
[
Maybe
ConstructorDoc
]
//* For ADTs
}
instance
docDescription
TypeDoc
...
...
@@ -149,9 +149,9 @@ derive gDefault TypeDoc
* Parse error for parsing Clean documentation; no documentation could be found
*/
::
ParseError
=
MissingAsterisk
String
//* At least one line did not start with a *
|
MissingField
String
//* A required field was missing
|
UnknownError
String
//* Another error
=
MissingAsterisk
!
String
//* At least one line did not start with a *
|
MissingField
!
String
//* A required field was missing
|
UnknownError
!
String
//* Another error
|
InternalNoDataError
/**
...
...
@@ -159,11 +159,11 @@ derive gDefault TypeDoc
* best-effort result nevertheless
*/
::
ParseWarning
=
UnknownField
String
//* Unknown @-field
|
IllegalField
String
//* This @-field is not allowed in this docblock
|
NoDescription
//* The main description is missing
|
UsedReturn
//* Used @return instead of @result
|
UnparsableType
String
//* Could not parse a @type field as a type
=
UnknownField
!
String
//* Unknown @-field
|
IllegalField
!
String
//* This @-field is not allowed in this docblock
|
NoDescription
//* The main description is missing
|
UsedReturn
//* Used @return instead of @result
|
UnparsableType
!
String
//* Could not parse a @type field as a type
/**
* Convert a ConstructorDoc to a FunctionDoc.
...
...
@@ -192,14 +192,14 @@ parseSingleLineDoc :: (String -> String)
/**
* Parse a documentation block. The magic happens in {{`docBlockToDoc`}}.
*/
parseDoc
::
!
String
->
Either
ParseError
(
d
,
[
ParseWarning
])
|
docBlockToDoc
{|*|}
d
parseDoc
::
!
String
->
Either
ParseError
(
!
d
,
!
[
ParseWarning
])
|
docBlockToDoc
{|*|}
d
/**
* A documentation block.
* @representation An order list of key-value pairs. A key can occur multiple
* times. The description has key `description`.
*/
::
DocBlock
:==
[(
String
,
String
)]
::
DocBlock
:==
[(
!
String
,
!
String
)]
/**
* The magic for {{`parseDoc`}}. Usually, a record type like {{`FunctionDoc`}}
...
...
Clean/Doc.icl
View file @
537593aa
...
...
@@ -93,7 +93,7 @@ addClassMemberDoc d m = {d & members=d.members ++ [m]}
parseSingleLineDoc
::
(
String
->
String
)
parseSingleLineDoc
=
toString
o
trim
o
dropWhile
((==)
'*'
)
o
fromString
parseDoc
::
!
String
->
Either
ParseError
(
d
,
[
ParseWarning
])
|
docBlockToDoc
{|*|}
d
parseDoc
::
!
String
->
Either
ParseError
(
!
d
,
!
[
ParseWarning
])
|
docBlockToDoc
{|*|}
d
parseDoc
s
=
docBlockToDoc
{|*|}
(
Left
[
s
])
generic
docBlockToDoc
d
::
!(
Either
[
String
]
DocBlock
)
->
Either
ParseError
(!
d
,
![
ParseWarning
])
...
...
@@ -109,7 +109,7 @@ docBlockToDoc{|FIELD of d|} fx (Right db) = case fx (Left [v \\ (k,v) <- db | k
Left
InternalNoDataError
->
Left
(
MissingField
d
.
gfd_name
)
Left
e
->
Left
e
where
(
matches
)
infix
4
::
String
String
->
Bool
(
matches
)
infix
4
::
!
String
!
String
->
Bool
(
matches
)
k
name
=
k`
==
name
||
pluralise
English
k`
==
name
||
...
...
@@ -148,7 +148,7 @@ where
Left
es
->
Left
(
UnknownError
"failed to parse property signature"
)
Right
(
name
,
args
)
->
Right
(
ForAll
name
args
,
[])
where
parser
::
Parser
Char
(
String
,
[(
String
,
Type
)])
parser
::
Parser
Char
(
!
String
,
![(!
String
,
!
Type
)])
parser
=
skipSpaces
*>
pMany
(
pSatisfy
\
c
->
c
<>
':'
&&
not
(
isSpace
c
))
>>=
\
name
->
skipSpaces
*>
pToken
':'
*>
...
...
@@ -179,7 +179,7 @@ docBlockToDoc{|PropertyVarInstantiation|} (Left [s]) = case split "=" s of
derive
docBlockToDoc
ModuleDoc
,
FunctionDoc
,
ClassMemberDoc
,
ConstructorDoc
,
ClassDoc
,
TypeDoc
trimMultiLine
::
[
String
]
->
String
trimMultiLine
::
!
[
String
]
->
String
trimMultiLine
ss
=
join
"
\n
"
[
s
%
(
trimn
,
size
s
-
1
)
\\
s
<-
ss
]
where
trimn
=
minList
[
i
\\
Just
i
<-
map
(
firstNonSpace
0
)
ss
]
...
...
@@ -190,19 +190,17 @@ where
|
isSpace
s
.[
i
]
=
firstNonSpace
(
i
+1
)
s
|
otherwise
=
Just
i
::
DocBlock
:==
[(
String
,
String
)]
parseDocBlock
::
!
String
->
Either
ParseError
(
DocBlock
,
[
ParseWarning
])
parseDocBlock
::
!
String
->
Either
ParseError
(!
DocBlock
,
![
ParseWarning
])
parseDocBlock
b
=
prepareString
b
>>=
parsef
where
parsef
::
[[
Char
]]
->
Either
ParseError
(
DocBlock
,
[
ParseWarning
])
parsef
::
![[
Char
]]
->
Either
ParseError
(!
DocBlock
,
!
[
ParseWarning
])
parsef
[]
=
Right
([],
[])
parsef
lines
=
case
span
(\
l
->
isEmpty
l
||
hd
l
<>
'@'
)
lines
of
([],
[
ln
])
=
parseFields
[
ln
]
([],
rest
)
=
appSnd
(\
ws
->
[
NoDescription
:
ws
])
<$>
parseFields
rest
(
desc
,
rest
)
=
appFst
(\
d
->
[(
"description"
,
linesToString
desc
):
d
])
<$>
parseFields
rest
parseFields
::
[[
Char
]]
->
Either
ParseError
(
DocBlock
,
[
ParseWarning
])
parseFields
::
![[
Char
]]
->
Either
ParseError
(!
DocBlock
,
!
[
ParseWarning
])
parseFields
[]
=
Right
([],
[])
parseFields
[[
'@'
:
line
]:
rest
]
...
...
@@ -213,13 +211,13 @@ where
(
restdesc
,
rest`
)
=
span
(\
l
->
isEmpty
l
||
hd
l
<>
'@'
)
rest
desc
=
flatten
$
intersperse
[
'
\n
'
]
$
if
(
isEmpty
descline
)
restdesc
[
tl
descline
:
restdesc
]
parseFs
::
[
Char
]
[
Char
]
DocBlock
->
Either
ParseError
(
DocBlock
,
[
ParseWarning
])
parseFs
::
![
Char
]
![
Char
]
!
DocBlock
->
Either
ParseError
(!
DocBlock
,
!
[
ParseWarning
])
parseFs
field
val
d
=
Right
([(
toString
field
,
toString
val
):
d
],
[])
prepareString
::
(
String
->
Either
ParseError
[[
Char
]])
prepareString
=
checkAsterisks
o
map
trim
o
break
'\n'
o
fromString
where
checkAsterisks
::
[[
Char
]]
->
Either
ParseError
[[
Char
]]
checkAsterisks
::
!
[[
Char
]]
->
Either
ParseError
[[
Char
]]
checkAsterisks
[[
'*'
:
line
]]
=
Right
[
safetl
line
]
checkAsterisks
[
line
]
=
Right
[
line
]
checkAsterisks
lines
...
...
@@ -227,11 +225,11 @@ where
=
Right
$
map
(
safetl
o
dropWhile
((==)
'*'
))
lines
=
Left
$
MissingAsterisk
$
toString
$
hd
$
filter
(\
l
->
not
(
isEmpty
l
)
&&
hd
l
<>
'*'
)
lines
safetl
::
[
a
]
->
[
a
]
safetl
::
!
[
a
]
->
[
a
]
safetl
[]
=
[]
safetl
[_:
xs
]
=
xs
break
::
a
->
[
a
]
->
[[
a
]]
|
==
a
break
::
!
a
->
[
a
]
->
[[
a
]]
|
==
a
break
e
=
foldr
f
[]
where
f
x
[]
=
if
(
x
==
e
)
[]
[[
x
]]
...
...
CleanPrettyPrint
@
7b51a8ac
Compare
2de872a9
...
7b51a8ac
Subproject commit
2de872a93430eef1ae767596a2765bcc5120596e
Subproject commit
7b51a8ac1859f530b013411a3ef251589ce6fdd5
CleanTypes
@
dc782524
Compare
e4eda2f0
...
dc782524
Subproject commit
e4eda2f035b11f6786ff1f643bb1803d8421d643
Subproject commit
dc782524f6fbfc7b386c24d03190ca5cfa1b99ee
Cloogle/DB/Factory.dcl
View file @
537593aa
...
...
@@ -66,9 +66,9 @@ findModules :: !String !IndexItem !String !*World -> *(![ModuleEntry], !*World)
indexModule
::
!
Bool
!
String
!
ModuleEntry
!
TemporaryDB
!*
World
->
*(!
TemporaryDB
,
!*
World
)
::
LocationInModule
=
{
dcl_line
::
Maybe
Int
,
icl_line
::
Maybe
Int
,
name
::
Maybe
String
{
dcl_line
::
!
Maybe
Int
,
icl_line
::
!
Maybe
Int
,
name
::
!
Maybe
String
}
/**
...
...
@@ -105,9 +105,9 @@ findModuleContents :: !Bool !String !*World
/**
* Transform the constructors of an algebraic data type into plain functions.
*/
constructor_functions
::
TypeDefEntry
->
[
FunctionEntry
]
constructor_functions
::
!
TypeDefEntry
->
[
FunctionEntry
]
/**
* Transform the record fields of a record type into plain functions.
*/
record_functions
::
TypeDefEntry
->
[
FunctionEntry
]
record_functions
::
!
TypeDefEntry
->
[
FunctionEntry
]
Cloogle/DB/Factory.icl
View file @
537593aa
...
...
@@ -422,7 +422,6 @@ indexModule include_locals root mod db w
#!
(
functions
,
macros
,
generics
,
typedefs
,
clss
,
insts
,
derivs
,
clsderivs
,(
modname
,
mod`
,
imports
),
w
)
=
findModuleContents
include_locals
(
root
</>
lib
</>
mkdir
('
CDB
'.
getName
mod
.
me_loc
))
w
#!
typedefs
=
[{
td
&
tde_loc
=
castLoc
modname
loc
}
\\
(
loc
,
td
)
<-
typedefs
]
#!
lib
=
lib
%
(
0
,
size
lib
-
size
modname
+
size
('
CDB
'.
getName
mod
.
me_loc
)
-
1
)
#!
db
=
{
db
&
temp_functions
=
...
...
@@ -775,7 +774,7 @@ where
setLine
True
pos
loc
=
{
loc
&
dcl_line
=
toLine
pos
}
setLine
False
pos
loc
=
{
loc
&
icl_line
=
toLine
pos
}
constructor_functions
::
'
CDB
'.
TypeDefEntry
->
['
CDB
'.
FunctionEntry
]
constructor_functions
::
!
'
CDB
'.
TypeDefEntry
->
['
CDB
'.
FunctionEntry
]
constructor_functions
etd
=
[
{
zero
&
fe_loc
='
CDB
'.
setName
c
etd
.
tde_loc
...
...
@@ -794,7 +793,7 @@ where
cons_doc
=
fromMaybe
[]
(
docConstructors
=<<
'
CDB
'.
getTypeDefDoc
etd
)
++
repeat
Nothing
record_functions
::
'
CDB
'.
TypeDefEntry
->
['
CDB
'.
FunctionEntry
]
record_functions
::
!
'
CDB
'.
TypeDefEntry
->
['
CDB
'.
FunctionEntry
]
record_functions
etd
=
[
{
zero
&
fe_loc
='
CDB
'.
setName
f
etd
.
tde_loc
...
...
libcloogle
@
a19e2a1a
Compare
1c6953e7
...
a19e2a1a
Subproject commit
1c6953e7a65caee8e68004fe49632271b022b113
Subproject commit
a19e2a1a43ca923218a476a4c291c5bdc43540bc
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