Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
b194f525
Commit
b194f525
authored
Mar 31, 2014
by
Jean-Christophe Filliâtre
Browse files
fixed why3doc
parent
ede62577
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tools/why3wc.mll
View file @
b194f525
...
...
@@ -9,7 +9,13 @@
(* *)
(********************************************************************)
(** Count spec/code tokens/lines and comment lines in Why3 source files *)
(** Count spec/code tokens/lines and comment lines in Why3 source files
Features and current limitations:
- blank lines are ignored
- "type", "constant", and "function" are counted as spec, not code
- a type containing a mutable field is counted in both spec and code
*)
{
open
Lexing
...
...
@@ -17,7 +23,7 @@
let
skip_header
=
ref
true
let
tokens
=
ref
false
let
factor
=
ref
false
(* TODO: what kinds of de Bruijn factors? *)
let
factor
=
ref
false
let
files
=
Queue
.
create
()
(** counters *)
...
...
@@ -170,7 +176,9 @@ and start_annotation = parse
| "
(*"
{ add_comment (comment 0 lexbuf); start_annotation lexbuf }
| "{"
{ scan_annotation lexbuf }
{ add_token (); scan_annotation lexbuf }
| '\n'
{ new_line (); start_annotation lexbuf }
| _
{ add_token () (* no curly brace, we give up *) }
| eof
...
...
@@ -182,9 +190,9 @@ and scan_annotation = parse
| space+
{ scan_annotation lexbuf }
| "{" (* nested curly braces (e.g. records) *)
{ scan_annotation lexbuf; scan_annotation lexbuf }
{
add_token ();
scan_annotation lexbuf; scan_annotation lexbuf }
| "}"
{ () }
{
add_token
() }
| "(*" space* '\n'?
{ add_comment (comment 0 lexbuf); scan_annotation lexbuf }
| '"'
...
...
@@ -211,7 +219,7 @@ and string n = parse
| eof { n }
(** [comment n] reads a comment until its end and returns n + the number
of n
ew
lines it contains. *)
of n
on-empty
lines it contains
(not counting the first one)
. *)
and comment n = parse
| ('\n' | space)* "*)"
...
...
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