Skip to content

Commit

Permalink
Merge pull request #76 from liyishuai/patch
Browse files Browse the repository at this point in the history
Allow empty patch version
  • Loading branch information
mjambon committed Sep 15, 2021
2 parents 7d21786 + 6ec744e commit 94b2d0f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/cppo_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let add_extension tbl s =
let semver_re = Str.regexp "\
\\([0-9]+\\)\
\\.\\([0-9]+\\)\
\\.\\([0-9]+\\)\
\\(\\.\\([0-9]+\\)\\)?\
\\([~-]\\([^+]*\\)\\)?\
\\(\\+\\(.*\\)\\)?\
\r?$"
Expand All @@ -28,9 +28,9 @@ let parse_semver s =
else
let major = Str.matched_group 1 s in
let minor = Str.matched_group 2 s in
let patch = Str.matched_group 3 s in
let prerelease = try Some (Str.matched_group 5 s) with Not_found -> None in
let build = try Some (Str.matched_group 7 s) with Not_found -> None in
let patch = try (Str.matched_group 4 s) with Not_found -> "0" in
let prerelease = try Some (Str.matched_group 6 s) with Not_found -> None in
let build = try Some (Str.matched_group 8 s) with Not_found -> None in
Some (major, minor, patch, prerelease, build)

let define var s =
Expand Down
2 changes: 1 addition & 1 deletion test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
(action
(with-stdout-to
%{targets}
(run %{bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 %{<}))))
(run %{bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 -V COQ:8.13+beta1 %{<}))))

(alias
(name runtest)
Expand Down
2 changes: 2 additions & 0 deletions test/version.cppo
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ patch: X_PATCH
#else
#error ""
#endif

Coq: COQ_VERSION

0 comments on commit 94b2d0f

Please sign in to comment.