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
7438d3c8
Verified
Commit
7438d3c8
authored
Jul 11, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Regex dependency
parent
011c4de3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
Clean/Doc.icl
Clean/Doc.icl
+12
-10
No files found.
Clean/Doc.icl
View file @
7438d3c8
...
...
@@ -26,8 +26,6 @@ from Text import class Text(join,split,trim,rtrim),
import
Text
.
Language
import
Text
.
Parsers
.
Simple
.
ParserCombinators
import
Regex
from
Clean
.
Types
import
::
Type
,
::
TypeRestriction
import
qualified
Clean
.
Types
.
Parse
as
T
...
...
@@ -148,16 +146,20 @@ docBlockToDoc{|OBJECT|} fx doc = appFst OBJECT <$> fx doc
docBlockToDoc
{|
MultiLineString
|}
(
Left
[
s
])
=
Right
(
MultiLine
$
trimMultiLine
$
split
"
\n
"
s
,
[])
docBlockToDoc
{|
ParamDoc
|}
(
Left
[
s
])
=
case
match
rgx
(
fromString
s
)
of
[(_,_,
groups
):_]
->
Right
(
{
name
=
toString
<$>
lookup
(
NotNamed
0
)
groups
,
description
=
case
lookup
(
NotNamed
1
)
groups
of
Just
cs
=:[_:_]
->
Just
(
toString
cs
)
_
->
Nothing
docBlockToDoc
{|
ParamDoc
|}
(
Left
[
s
])
=
case
findName
(
fromString
s
)
of
Just
(
name
,
rest
)
->
Right
(
{
name
=
Just
$
toString
name
,
description
=
case
rest
of
[]
->
Nothing
_
->
Just
$
toString
rest
},
[])
[]
->
Right
({
name
=
Nothing
,
description
=
Just
s
},
[])
_
->
Right
({
name
=
Nothing
,
description
=
Just
s
},
[])
where
rgx
=
regex
[
'^(
\\
w+):
\\
s*(.*)$'
]
findName
cs
#
(
name
,
cs
)
=
span
(\
c
->
isAlphanum
c
||
c
==
'`'
)
cs
|
not
(
isEmpty
name
)
&&
not
(
isEmpty
cs
)
&&
hd
cs
==
':'
=
Just
(
toString
name
,
dropWhile
isSpace
(
tl
cs
))
=
Nothing
docBlockToDoc
{|
Type
|}
(
Left
[])
=
Left
InternalNoDataError
docBlockToDoc
{|
Type
|}
(
Left
ss
)
=
case
[
v
\\
Just
v
<-
map
(
'T'
.
parseType
o
fromString
)
ss
]
of
...
...
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