Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
curry-base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
curry
curry-base
Commits
2ade4fcf
Commit
2ade4fcf
authored
11 years ago
by
Matthias Böhm
Browse files
Options
Downloads
Patches
Plain Diff
added extractOrigName function that extracts the original name of an identifier
parent
95a1c7c2
No related branches found
Tags
prototype-4
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Curry/Base/Ident.hs
+17
-1
17 additions, 1 deletion
src/Curry/Base/Ident.hs
with
17 additions
and
1 deletion
src/Curry/Base/Ident.hs
+
17
−
1
View file @
2ade4fcf
...
...
@@ -67,7 +67,7 @@ module Curry.Base.Ident
,
recordExtId
,
labelExtId
,
isRecordExtId
,
isLabelExtId
,
fromRecordExtId
,
fromLabelExtId
,
renameLabel
,
recordExt
,
labelExt
,
mkLabelIdent
-- ** Constructed identifiers
,
identPrefix
,
Curry
.
Base
.
Ident
.
sep
,
identPrefix
,
Curry
.
Base
.
Ident
.
sep
,
extractOrigName
)
where
import
Data.Char
(
isAlpha
,
isAlphaNum
,
isSpace
)
...
...
@@ -709,3 +709,19 @@ identPrefix = "#"
-- elements
sep
::
String
sep
=
":_"
-- |Extracts the original name of the given identifier. This is the string after
-- the last "sep".
extractOrigName
::
Ident
->
Ident
extractOrigName
=
updIdentName
extractOrigName'
extractOrigName'
::
String
->
String
extractOrigName'
s
=
last
(
split'
s
""
[]
)
where
sep'
=
Curry
.
Base
.
Ident
.
sep
lenSep
=
length
sep'
split'
::
String
->
String
->
[
String
]
->
[
String
]
split'
str
acc1
acc2
|
sep'
`
isPrefixOf
`
str
=
split'
(
drop
lenSep
str
)
""
(
reverse
acc1
:
acc2
)
|
null
str
=
reverse
(
reverse
acc1
:
acc2
)
|
otherwise
=
split'
(
tail
str
)
(
head
str
:
acc1
)
acc2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment