Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
357b2921
Commit
357b2921
authored
Feb 18, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restrict enum conversion to parts
parent
ec766657
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
12 deletions
+1
-12
src/Convert/Enum.hs
+1
-12
No files found.
src/Convert/Enum.hs
View file @
357b2921
...
...
@@ -36,24 +36,13 @@ convert :: [AST] -> [AST]
convert
=
map
$
concatMap
convertDescription
convertDescription
::
Description
->
[
Description
]
convertDescription
(
Package
ml
name
items
)
=
[
Package
ml
name
$
concatMap
convertPackageItem
items
]
convertDescription
(
description
@
Part
{})
=
[
Part
attrs
extern
kw
lifetime
name
ports
items'
]
where
items'
=
inject
enumItems
items
-- only keep what's used
Part
attrs
extern
kw
lifetime
name
ports
items
=
description'
(
description'
,
enumItems
)
=
convertDescription'
description
convertDescription
(
PackageItem
item
)
=
map
PackageItem
$
convertPackageItem
item
-- explode a package item with its corresponding enum items
convertPackageItem
::
PackageItem
->
[
PackageItem
]
convertPackageItem
item
=
do
item'
:
enumItems
where
(
PackageItem
item'
,
enumItems
)
=
convertDescription'
$
PackageItem
item
convertDescription
other
=
[
other
]
-- replace and collect the enum types in a description
convertDescription'
::
Description
->
(
Description
,
[
PackageItem
])
...
...
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