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.org
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
be9484fc
Verified
Commit
be9484fc
authored
Jun 24, 2017
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganise
parent
8fa4b3f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
59 deletions
+52
-59
backend/Cloogle
backend/Cloogle
+1
-1
backend/CloogleServer.icl
backend/CloogleServer.icl
+3
-3
backend/builddb.icl
backend/builddb.icl
+32
-36
frontend/api.js
frontend/api.js
+16
-19
No files found.
Cloogle
@
621e3ddf
Compare
b50e3c09
...
621e3ddf
Subproject commit
b50e3c0914c5edb01cd6ce1f2f72176dc5f55af9
Subproject commit
621e3ddf6213b828a71a37c075a7994aadf94f2f
backend/CloogleServer.icl
View file @
be9484fc
...
...
@@ -27,7 +27,7 @@ import Text.JSON
import
Cloogle
import
Type
import
Typ
eDB
import
Cloogl
eDB
import
Search
from
SimpleTCPServer
import
::
LogMessage
{..},
serve
,
::
Logger
...
...
@@ -93,7 +93,7 @@ where
#
io
=
io
<<<
"Could not lock memory ("
<<<
err
<<<
"); process may get swapped out
\n
"
=
snd
$
fclose
io
w
handle
::
!
Typ
eDB
!(
Maybe
Request
)
!*
World
->
*(!
Response
,
CacheKey
,
!*
World
)
handle
::
!
Cloogl
eDB
!(
Maybe
Request
)
!*
World
->
*(!
Response
,
CacheKey
,
!*
World
)
handle
db
Nothing
w
=
(
err
InvalidInput
"Couldn't parse input"
,
""
,
w
)
handle
db
(
Just
request
=:{
unify
,
name
,
page
})
w
//Check cache
...
...
@@ -154,7 +154,7 @@ where
}
(
give
,
keep
)
=
splitAt
MAX_RESULTS
results
suggs
::
!(
Maybe
String
)
!
Type
!
Typ
eDB
->
Maybe
[(
Request
,
[
Result
])]
suggs
::
!(
Maybe
String
)
!
Type
!
Cloogl
eDB
->
Maybe
[(
Request
,
[
Result
])]
suggs
n
(
Func
is
r
cc
)
db
|
length
is
<
3
=
Just
[
let
t`
=
concat
$
print
False
$
Func
is`
r
cc
in
...
...
backend/builddb.icl
View file @
be9484fc
...
...
@@ -16,9 +16,9 @@ import Data.Maybe
import
System
.
CommandLine
from
Text
import
class
Text
(
concat
,
startsWith
),
instance
Text
String
import
Typ
eDB
import
Cloogl
eDB
import
Type
from
Typ
eDBFactory
import
findModules
,
getModuleTypes
,
constructor_functions
,
from
Cloogl
eDBFactory
import
findModules
,
getModuleTypes
,
constructor_functions
,
record_functions
::
CLI
=
{
help
::
Bool
...
...
@@ -91,16 +91,14 @@ Start w
#!
db
=
putTypes
predefTypes
db
#!
db
=
putFunctions
(
flatten
$
map
constructor_functions
predefTypes
)
db
#!
db
=
putFunctions
(
flatten
$
map
record_functions
predefTypes
)
db
#
io
=
stderr
#
io
=
printStats
db
io
#
(
ok1
,
w
)
=
fclose
io
w
#
f
=
saveDb
db
f
#
(
ok2
,
w
)
=
fclose
f
w
#!
(
ok1
,
w
)
=
fclose
(
printStats
db
stderr
)
w
#!
f
=
saveDb
db
f
#!
(
ok2
,
w
)
=
fclose
f
w
=
(
ok1
&&
ok2
,
w
)
|
not
ok
=
abort
"Couldn't close stdio"
=
w
where
loop
::
String
[(
String
,
String
,
Bool
)]
!
TypeDB
!*
World
->
*(!
Typ
eDB
,
!*
World
)
loop
::
String
[(
String
,
String
,
Bool
)]
!
CloogleDB
!*
World
->
*(!
Cloogl
eDB
,
!*
World
)
loop
_
[]
db
w
=
(
db
,
w
)
loop
root
[(
lib
,
mod
,
iscore
):
list
]
db
w
#!
w
=
snd
(
fclose
(
stderr
<<<
lib
<<<
": "
<<<
mod
<<<
"
\n
"
)
w
)
...
...
@@ -118,23 +116,21 @@ where
(
"-l"
,
[
x
:
xs
])
=
(\
c
->{
c
&
libs
=[(
x
,
const
False
):
c
.
libs
]})
<$>
parseCLI
xs
(
x
,
_)
=
Left
$
"Unknown option '"
+++
x
+++
"'"
printStats
::
!
Typ
eDB
!*
File
->
*
File
printStats
::
!
Cloogl
eDB
!*
File
->
*
File
printStats
db
f
=
f
<<<
"+-------------+------+
\n
"
<<<
"+-------------+------
-
+
\n
"
<<<
"| Modules | "
<<<
modules
<<<
" |
\n
"
<<<
"| Functions | "
<<<
funs
<<<
" |
\n
"
<<<
"| Types | "
<<<
types
<<<
" |
\n
"
<<<
"| Macros | "
<<<
macros
<<<
" |
\n
"
<<<
"| Classes | "
<<<
classes
<<<
" |
\n
"
<<<
"| Instances | "
<<<
insts
<<<
" |
\n
"
<<<
"| Derivations | "
<<<
derives
<<<
" |
\n
"
<<<
"+-------------+------+
\n
"
<<<
"+-------------+------
-
+
\n
"
where
[
modules
,
funs
,
macros
,
types
,
classes
,
insts
,
derives
:_]
=
map
(
pad
4
)
[
modules
,
funs
,
types
,
classes
,
insts
,
derives
:_]
=
map
(
pad
5
)
[
moduleCount
db
,
functionCount
db
,
macroCount
db
,
typeCount
db
,
classCount
db
,
instanceCount
db
...
...
@@ -142,48 +138,48 @@ where
]
pad
n
i
=
{
' '
\\
_
<-
[
0
..
n
-
size
(
toString
i
)
-1
]}
+++
toString
i
predefFunctions
::
[(
Location
,
ExtendedType
)]
predefFunctions
::
[(
Location
,
FunctionEntry
)]
predefFunctions
=
[
(
Builtin
"if"
,
ET
(
Func
[
Type
"Bool"
[],
Var
"a"
,
Var
"a"
]
(
Var
"a"
)
[])
zero
,
{
zero
&
fe_type
=
Just
$
Func
[
Type
"Bool"
[],
Var
"a"
,
Var
"a"
]
(
Var
"a"
)
[]}
)
,
(
Builtin
"dynamic"
,
ET
(
Func
[
Var
"a"
]
(
Type
"Dynamic"
[])
[])
zero
,
{
zero
&
fe_type
=
Just
$
Func
[
Var
"a"
]
(
Type
"Dynamic"
[])
[]}
)
]
predefClasses
::
[(
Location
,
Class
)]
predefClasses
::
[(
Location
,
Class
Entry
)]
predefClasses
=
[
(
Builtin
"TC"
,
{
c
lass
_vars
=[
"v"
]
,
c
lass
_context
=[]
,
c
lass
_documentation
=
Nothing
,
c
lass
_members
=[]
,
{
c
e
_vars
=[
"v"
]
,
c
e
_context
=[]
,
c
e
_documentation
=
Nothing
,
c
e
_members
=[]
}
)
]
predefTypes
::
[(
Location
,
ExtendedTypeDef
)]
predefTypes
::
[(
Location
,
TypeDefEntry
)]
predefTypes
=
[
(
Builtin
"Bool"
,
{
deft
&
etd
_typedef
.
td_name
=
"Bool"
,
etd
_typedef
.
td_rhs
=
TDRCons
False
&
tde
_typedef
.
td_name
=
"Bool"
,
tde
_typedef
.
td_rhs
=
TDRCons
False
[
{
defc
&
cons_name
=
"False"
}
,
{
defc
&
cons_name
=
"True"
}
]
}
)
,
(
Builtin
"Int"
,
{
deft
&
etd
_typedef
.
td_name
=
"Int"
}
)
,
(
Builtin
"Real"
,
{
deft
&
etd
_typedef
.
td_name
=
"Real"
}
)
,
(
Builtin
"Char"
,
{
deft
&
etd
_typedef
.
td_name
=
"Char"
}
)
,
(
Builtin
"String"
,
{
deft
&
etd
_typedef
.
td_name
=
"String"
,
etd
_typedef
.
td_rhs
=
TDRSynonym
(
Type
"_#Array"
[
Type
"Char"
[]])
}
)
,
(
Builtin
"Dynamic"
,
{
deft
&
etd
_typedef
.
td_name
=
"Dynamic"
}
)
,
(
Builtin
"File"
,
{
deft
&
etd
_typedef
.
td_name
=
"File"
}
)
,
(
Builtin
"World"
,
{
deft
&
etd
_typedef
.
td_name
=
"World"
,
etd
_typedef
.
td_uniq
=
True
}
)
,
(
Builtin
"Int"
,
{
deft
&
tde
_typedef
.
td_name
=
"Int"
}
)
,
(
Builtin
"Real"
,
{
deft
&
tde
_typedef
.
td_name
=
"Real"
}
)
,
(
Builtin
"Char"
,
{
deft
&
tde
_typedef
.
td_name
=
"Char"
}
)
,
(
Builtin
"String"
,
{
deft
&
tde
_typedef
.
td_name
=
"String"
,
tde
_typedef
.
td_rhs
=
TDRSynonym
(
Type
"_#Array"
[
Type
"Char"
[]])
}
)
,
(
Builtin
"Dynamic"
,
{
deft
&
tde
_typedef
.
td_name
=
"Dynamic"
}
)
,
(
Builtin
"File"
,
{
deft
&
tde
_typedef
.
td_name
=
"File"
}
)
,
(
Builtin
"World"
,
{
deft
&
tde
_typedef
.
td_name
=
"World"
,
tde
_typedef
.
td_uniq
=
True
}
)
]
where
deft
=
{
etd_typedef
={
td_name
=
""
,
td_uniq
=
False
,
td_args
=[],
td_rhs
=
TDRAbstract
},
etd
_doc
=
Nothing
}
deft
=
{
tde_typedef
={
td_name
=
""
,
td_uniq
=
False
,
td_args
=[],
td_rhs
=
TDRAbstract
},
tde
_doc
=
Nothing
}
defc
=
{
cons_name
=
""
,
cons_args
=[],
cons_exi_vars
=[],
cons_context
=[],
cons_priority
=
Nothing
}
frontend/api.js
View file @
be9484fc
...
...
@@ -326,16 +326,22 @@ function getResults(str, libs, include_builtins, include_core, page) {
}
var
hl_entry
=
'
start
'
;
if
(
'
constructor_of
'
in
extra
)
{
meta
.
push
(
'
This is a type constructor of <code>
'
+
highlightFunction
(
'
::
'
+
extra
[
'
constructor_of
'
],
highlightCallback
)
+
'
</code>.
'
);
hl_entry
=
'
startConstructor
'
;
}
else
if
(
'
recordfield_of
'
in
extra
)
{
meta
.
push
(
'
This is a record field of <code>
'
+
highlightFunction
(
'
::
'
+
extra
[
'
recordfield_of
'
],
highlightCallback
)
+
'
</code>.
'
);
hl_entry
=
'
startRecordField
'
;
switch
(
extra
[
'
kind
'
][
0
])
{
case
'
Constructor
'
:
meta
.
push
(
'
This is a type constructor of <code>
'
+
highlightFunction
(
'
::
'
+
extra
[
'
constructor_of
'
],
highlightCallback
)
+
'
</code>.
'
);
hl_entry
=
'
startConstructor
'
;
break
;
case
'
RecordField
'
:
meta
.
push
(
'
This is a record field of <code>
'
+
highlightFunction
(
'
::
'
+
extra
[
'
recordfield_of
'
],
highlightCallback
)
+
'
</code>.
'
);
hl_entry
=
'
startRecordField
'
;
break
;
case
'
Macro
'
:
hl_entry
=
'
macro
'
;
break
;
}
return
makeGenericResultHTML
(
basic
,
meta
,
hidden
,
...
...
@@ -399,15 +405,6 @@ function getResults(str, libs, include_builtins, include_core, page) {
return
makeGenericResultHTML
(
basic
,
meta
,
hidden
,
html
);
case
'
MacroResult
'
:
if
(
'
macro_param_doc
'
in
extra
&&
extra
[
'
macro_param_doc
'
].
length
>
0
)
hidden
.
push
([
makeParametersHTML
(
'
Parameter
'
,
extra
[
'
macro_param_doc
'
])]);
if
(
'
macro_result_doc
'
in
extra
)
hidden
.
push
([
'
Result:
'
+
extra
[
'
macro_result_doc
'
]]);
return
makeGenericResultHTML
(
basic
,
meta
,
hidden
,
highlightFunction
(
extra
[
'
macro_representation
'
],
highlightCallback
,
'
macro
'
));
case
'
ModuleResult
'
:
if
(
extra
[
'
module_is_core
'
])
meta
.
push
([
'
<span class="core-module">
'
+
...
...
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