diff options
author | Damien Doligez <damien.doligez@inria.fr> | 2016-02-17 13:36:07 +0100 |
---|---|---|
committer | Damien Doligez <damien.doligez@inria.fr> | 2016-02-17 13:36:37 +0100 |
commit | 6e794aee7257ea72e785dc743981b4cc36cb14c6 (patch) | |
tree | c0ac9b610cabc6fc7b3e7b7408247ef14b9d9bf8 /tools/check-typo | |
parent | 1d40d77502707e9265b62b8d0a8d5ef1fba75e02 (diff) | |
download | ocaml-6e794aee7257ea72e785dc743981b4cc36cb14c6.tar.gz |
tools/check-typo: switch to new header format
Diffstat (limited to 'tools/check-typo')
-rwxr-xr-x | tools/check-typo | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/check-typo b/tools/check-typo index 510b5e31a0..503a1e12d2 100755 --- a/tools/check-typo +++ b/tools/check-typo @@ -204,15 +204,25 @@ IGNORE_DIRS=" err("very-long-line", "line is over 132 characters"); } - 3 <= NR && NR <= 5 \ - && (/ OCaml / || / ocamlbuild / || / OCamldoc /) { - header_ocaml = NR; - } + # Header-recognition automaton. Read this from bottom to top. - header_ocaml && header_ocaml + 4 <= NR && NR <= header_ocaml + 6 \ - && / Copyright / { - header_copyright = 1; - } + state == "close" && $0 ~ /\*{74}/ { state = "OK"; } + state == "close" { state = "error"; } + state == "blurb" && $0 ~ /\* {72}\*/ { state = "close"; } + state == "blurb1" && $0 ~ /\* All rights reserved. / \ + { state = "blurb"; } + state == "blurb1" { state = "error"; } + state == "copyright" && $0 ~ /\* {72}\*/ { state = "blurb1"; } + state == "copyright" && $0 !~ /\* Copyright [0-9]{4}/ \ + && $0 !~ /\* / { state = "error"; } + state == "authors" && $0 ~ /\* {72}\*/ { state = "copyright"; } + state == "blank2" && $0 ~ /\* {72}\*/ { state = "authors"; } + state == "blank2" { state = "error"; } + state == "title" && $0 ~ /\* {32}OCaml {33}\*/ { state = "blank2"; } + state == "title" { state = "error"; } + state == "blank1" && $0 ~ /\* {72}\*/ { state = "title"; } + state == "blank1" { state = "error"; } + state == "" && NR < 4 && $0 ~ /\*{74}/ { state = "blank1"; } { prev_line = last_line; @@ -231,7 +241,7 @@ IGNORE_DIRS=" if (!empty_file && match(prev_line, /^$/)){ err("white-at-eof", "empty line(s) at EOF"); } - if (!(header_ocaml && header_copyright)){ + if (state != "OK"){ if (NR >= 10){ NR = 1; RSTART = 1; |