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
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
125
Issues
125
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
c249ccb9
Commit
c249ccb9
authored
Oct 29, 2015
by
Johannes Kanig
Committed by
David Hauzar
Nov 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OA26-022 move string utility function to string utility module
parent
4868b088
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
src/transform/intro_vc_vars_counterexmp.ml
src/transform/intro_vc_vars_counterexmp.ml
+1
-7
src/util/strings.ml
src/util/strings.ml
+6
-0
src/util/strings.mli
src/util/strings.mli
+4
-0
No files found.
src/transform/intro_vc_vars_counterexmp.ml
View file @
c249ccb9
...
...
@@ -194,12 +194,6 @@ let () = Trans.register_transform "intro_vc_vars_counterexmp"
intro_vc_vars_counterexmp
~
desc
:
"Introduce."
let
rec
string_join
sep
l
=
match
l
with
|
[]
->
""
|
[
x
]
->
x
|
x
::
rest
->
x
^
sep
^
string_join
sep
rest
let
get_location_of_vc
task
=
let
meta_args
=
Task
.
on_meta_excl
meta_vc_location
task
in
match
meta_args
with
...
...
@@ -214,7 +208,7 @@ let get_location_of_vc task =
let
line
=
int_of_string
line
in
let
col1
=
int_of_string
col1
in
let
col2
=
int_of_string
col2
in
let
filename
=
string_
join
":"
(
List
.
rev
rest
)
in
let
filename
=
Strings
.
join
":"
(
List
.
rev
rest
)
in
Some
(
Loc
.
user_position
filename
line
col1
col2
)
|
_
->
None
in
loc
...
...
src/util/strings.ml
View file @
c249ccb9
...
...
@@ -39,6 +39,12 @@ let rev_bounded_split c s n =
let
bounded_split
c
s
n
=
List
.
rev
(
rev_bounded_split
c
s
n
)
let
rec
join
sep
l
=
match
l
with
|
[]
->
""
|
[
x
]
->
x
|
x
::
rest
->
x
^
sep
^
join
sep
rest
let
ends_with
s
suf
=
let
rec
aux
s
suf
suflen
offset
i
=
i
>=
suflen
||
(
s
.
[
i
+
offset
]
=
suf
.
[
i
]
...
...
src/util/strings.mli
View file @
c249ccb9
...
...
@@ -32,6 +32,10 @@ val bounded_split : char -> string -> int -> string list
[n] substring at most.
The concatenation of returned substrings is equal to the string s.*)
val
join
:
string
->
string
list
->
string
(** [join sep l] joins all the strings in [l] together, in the same
order, separating them by [sep] *)
val
ends_with
:
string
->
string
->
bool
(** test if a string ends with another *)
...
...
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