diff options
author | Enrico Tassi <gareuselesinge@debian.org> | 2015-01-25 14:42:51 +0100 |
---|---|---|
committer | Enrico Tassi <gareuselesinge@debian.org> | 2015-01-25 14:42:51 +0100 |
commit | 7cfc4e5146be5666419451bdd516f1f3f264d24a (patch) | |
tree | e4197645da03dc3c7cc84e434cc31d0a0cca7056 /tools/coqwc.mll | |
parent | 420f78b2caeaaddc6fe484565b2d0e49c66888e5 (diff) |
Imported Upstream version 8.5~beta1+dfsg
Diffstat (limited to 'tools/coqwc.mll')
-rw-r--r-- | tools/coqwc.mll | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/coqwc.mll b/tools/coqwc.mll index db927efb..417ec535 100644 --- a/tools/coqwc.mll +++ b/tools/coqwc.mll @@ -1,13 +1,13 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2014 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2015 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) (* coqwc - counts the lines of spec, proof and comments in Coq sources - * Copyright (C) 2003 Jean-Christophe Filliâtre *) + * Copyright (C) 2003 Jean-Christophe Filliâtre *) (*s {\bf coqwc.} Counts the lines of spec, proof and comments in a Coq source. It assumes the files to be lexically well-formed. *) @@ -15,7 +15,6 @@ (*i*){ open Printf open Lexing -open Filename (*i*) (*s Command-line options. *) @@ -96,6 +95,8 @@ let stars = "(*" '*'* "*)" let dot = '.' (' ' | '\t' | '\n' | '\r' | eof) let proof_start = "Theorem" | "Lemma" | "Fact" | "Remark" | "Goal" | "Correctness" | "Obligation" | "Next" +let def_start = + "Definition" | "Fixpoint" | "Instance" let proof_end = ("Save" | "Qed" | "Defined" | "Abort" | "Admitted") [^'.']* '.' @@ -108,14 +109,10 @@ rule spec = parse | '\n' { newline (); spec lexbuf } | space+ | stars { spec lexbuf } - | proof_start space + | proof_start { seen_spec := true; spec_to_dot lexbuf; proof lexbuf } - | proof_start '\n' - { seen_spec := true; newline (); spec_to_dot lexbuf; proof lexbuf } - | "Program"? "Definition" space + | def_start { seen_spec := true; definition lexbuf } - | "Program"? "Fixpoint" space - { seen_spec := true; definition lexbuf } | character | _ { seen_spec := true; spec lexbuf } | eof { () } @@ -134,7 +131,7 @@ and spec_to_dot = parse { seen_spec := true; spec_to_dot lexbuf } | eof { () } -(*s [definition] scans a definition; passes to [proof] is the body is +(*s [definition] scans a definition; passes to [proof] if the body is absent, and to [spec] otherwise *) and definition = parse @@ -160,6 +157,8 @@ and proof = parse { proof lexbuf } | '\n' { newline (); proof lexbuf } | "Proof" space* '.' + | "Proof" space+ "with" + | "Proof" space+ "using" { seen_proof := true; proof lexbuf } | "Proof" space { proof_term lexbuf } |