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
C
clean-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-platform
Commits
0630d34f
Verified
Commit
0630d34f
authored
Oct 06, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only find modules in the given directory/ies, not in their children
parent
d4997410
Pipeline
#14652
failed with stage
in 58 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
7 deletions
+36
-7
src/libraries/OS-Independent/Clean/ModuleFinder.icl
src/libraries/OS-Independent/Clean/ModuleFinder.icl
+14
-3
src/libraries/OS-Independent/Clean/Parse.dcl
src/libraries/OS-Independent/Clean/Parse.dcl
+12
-0
src/libraries/OS-Independent/Clean/Parse.icl
src/libraries/OS-Independent/Clean/Parse.icl
+10
-4
No files found.
src/libraries/OS-Independent/Clean/ModuleFinder.icl
View file @
0630d34f
...
...
@@ -4,6 +4,7 @@ import StdArray
import
StdList
import
StdString
import
Clean
.
Parse
import
Data
.
Error
from
Data
.
Func
import
$,
mapSt
import
System
.
Directory
...
...
@@ -66,12 +67,22 @@ where
findAllModules
::
!
ModuleFindingOptions
!*
World
->
*(![
OSError
],
![
FilePath
],
!*
World
)
findAllModules
opts
w
#
(
errs
,(
paths
,
w
))
=
mapSt
(
scanDirectory`
collect
)
(
baseDirectories
opts
)
([],
w
)
#
(
errs
,(
paths
,
w
))
=
mapSt
(
\
d
->
scanDirectory`
(
collect
d
)
d
)
(
baseDirectories
opts
)
([],
w
)
=
(
flatten
errs
,
paths
,
w
)
where
scanDirectory`
f
dir
(
st
,
w
)
=
(
err
,
(
st`
,
w`
))
where
(
err
,
st`
,
w`
)
=
scanDirectory
f
st
dir
w
collect
fp
fi
seen
w
collect
dir
fp
fi
seen
w
|
endsWith
(
if
opts
.
include_applications
".icl"
".dcl"
)
fp
=
([
fp
:
seen
],
w
)
#
(
modname
,
w
)
=
guessModuleName
fp
w
|
isError
modname
=
(
seen
,
w
)
#
modname
=
fromOk
modname
|
isNothing
modname
=
(
seen
,
w
)
#
modname
=
fromJust
modname
#
expected
=
{
if
(
c
==
pathSeparator
)
'.'
c
\\
c
<-:
fp
%
(
size
dir`
,
size
fp
-
5
)}
with
dir`
=
dir
</>
""
|
modname
==
expected
=
([
fp
:
seen
],
w
)
=
(
seen
,
w
)
|
otherwise
=
(
seen
,
w
)
src/libraries/OS-Independent/Clean/Parse.dcl
View file @
0630d34f
...
...
@@ -7,12 +7,24 @@ definition module Clean.Parse
from
Data
.
Error
import
::
MaybeError
from
Data
.
Maybe
import
::
Maybe
from
System
.
File
import
::
FileError
from
System
.
FilePath
import
::
FilePath
from
hashtable
import
::
HashTable
from
Heap
import
::
Heap
from
syntax
import
::
Module
,
::
ParsedDefinition
,
::
ParsedModule
/**
* Guess the module name of a Clean file.
*
* @param The path to the Clean file
* @result
* `Error`, if the file could not be read;
* `Ok Nothing`, if the module name could not be guessed;
* `Ok (Just name)` in case of success.
*/
guessModuleName
::
!
FilePath
!*
World
->
*(!
MaybeError
FileError
(
Maybe
String
),
!*
World
)
/**
* Parse a Clean module.
*
...
...
src/libraries/OS-Independent/Clean/Parse.icl
View file @
0630d34f
...
...
@@ -17,12 +17,18 @@ from hashtable import :: BoxedIdent{boxed_ident}, :: HashTable,
from
parse
import
wantModule
import
syntax
readModule
::
!
FilePath
!*
World
->
*(!
MaybeError
String
(
ParsedModule
,
HashTable
),
!*
World
)
readModul
e
filename
w
guessModuleName
::
!
FilePath
!*
World
->
*(!
MaybeError
FileError
(
Maybe
String
),
!*
World
)
guessModuleNam
e
filename
w
#
(
s
,
w
)
=
readFile
filename
w
|
isError
s
=
(
Error
(
toString
(
fromError
s
)
),
w
)
|
isError
s
=
(
Error
(
fromError
s
),
w
)
#
modname
=
getModuleName
(
fromString
(
fromOk
s
))
#
modname
=
fromMaybe
(
takeFileName
(
dropExtension
filename
))
modname
=
(
Ok
modname
,
w
)
readModule
::
!
FilePath
!*
World
->
*(!
MaybeError
String
(
ParsedModule
,
HashTable
),
!*
World
)
readModule
filename
w
#
(
modname
,
w
)
=
guessModuleName
filename
w
|
isError
modname
=
(
Error
(
toString
(
fromError
modname
)),
w
)
#
modname
=
fromMaybe
(
takeFileName
(
dropExtension
filename
))
(
fromOk
modname
)
#
ht
=
newHashTable
newHeap
#
ht
=
set_hte_mark
(
if
icl
1
0
)
ht
#
(
ok
,
f
,
w
)
=
fopen
filename
FReadText
w
...
...
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