Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
personoj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
koizel
personoj
Commits
b371f1a0
Commit
b371f1a0
authored
3 years ago
by
hondet
Browse files
Options
Downloads
Patches
Plain Diff
parsing with angstrom exclusively
parent
52cba94e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
proofs/chainprops/Makefile
+3
-0
3 additions, 0 deletions
proofs/chainprops/Makefile
proofs/chainprops/chainprops.ml
+16
-11
16 additions, 11 deletions
proofs/chainprops/chainprops.ml
with
19 additions
and
11 deletions
proofs/chainprops/Makefile
+
3
−
0
View file @
b371f1a0
...
...
@@ -5,3 +5,6 @@ _build/default/chainprops.exe: chainprops.ml
psnj-chainprops
:
_build/default/chainprops.exe
@
cp
-f
_build/default/chainprops.exe psnj-chainprops
man
:
psnj-chainprops
@
./psnj-chainprops
--help
=
groff
>
psnj-chainprops.1
This diff is collapsed.
Click to expand it.
proofs/chainprops/chainprops.ml
+
16
−
11
View file @
b371f1a0
(** Parse dependencies file *)
module
Deps
=
struct
module
Deps
:
sig
type
t
val
pp
:
Format
.
formatter
->
t
->
unit
val
parse
:
in_channel
->
t
list
end
=
struct
open
Angstrom
type
t
=
string
*
string
list
...
...
@@ -10,27 +16,26 @@ module Deps = struct
let
blank1
=
satisfy
is_space
*>
blank
let
eol
=
string
"
\n\r
"
<|>
string
"
\n
"
let
colon
=
blank
*>
char
'
:
'
<*
blank
let
word
=
take_till
is_space
let
word
=
take_till
(
fun
c
->
is_space
c
||
c
=
'\n'
||
c
=
'\r'
)
let
line
=
both
(
word
<*
colon
)
(
sep_by
blank1
word
)
let
deps
=
sep_by
(
many1
eol
)
line
let
pp
ppf
((
s
,
deps
)
:
t
)
=
let
open
Format
in
let
pp_sep
=
pp_print_space
in
fprintf
ppf
"@[<h>%s:@ %a@]"
s
(
pp_print_list
~
pp_sep
pp_print_string
)
deps
let
parse
(
ic
:
in_channel
)
:
t
list
=
let
deps
=
ref
[]
in
try
while
true
do
match
parse_string
~
consume
:
Prefix
line
(
input_line
ic
)
with
|
Ok
v
->
deps
:=
v
::
!
deps
|
Error
msg
->
failwith
msg
done
;
assert
false
(* End of line should be reached*)
with
End_of_file
->
List
.
rev
!
deps
let
file
=
really_input_string
ic
(
in_channel_length
ic
)
in
match
parse_string
~
consume
:
Prefix
deps
file
with
|
Ok
v
->
v
|
Error
msg
->
failwith
msg
end
open
Cmdliner
...
...
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