Skip to content

Commit

Permalink
Merge pull request #71 from coq-community/declare-scopes
Browse files Browse the repository at this point in the history
Make sure scopes are declared before use
  • Loading branch information
proux01 authored Nov 30, 2022
2 parents def90f1 + e96c39c commit 52f293f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
4 changes: 0 additions & 4 deletions BigNumPrelude.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ Require Export Zpow_facts.
Require Uint63.
Require Import Lia.

Declare Scope bigN_scope.
Declare Scope bigZ_scope.
Declare Scope bigQ_scope.

Declare ML Module "bignums_syntax_plugin:coq-bignums.plugin".

(* *** Nota Bene ***
Expand Down
1 change: 1 addition & 0 deletions _CoqProject
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-generate-meta-for-package coq-bignums
-I plugin
-R . Bignums
-arg -w -arg +undeclared-scope

BigN/Nbasic.v
BigN/NMake.v
Expand Down
42 changes: 24 additions & 18 deletions plugin/bignums_syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ let bigN_list_of_constructors =
build 0

(* Actually declares the interpreter for bigN *)
let _ = Notation.declare_numeral_interpreter bigN_scope
(bigN_path, bigN_module)
interp_bigN
(bigN_list_of_constructors,
uninterp_bigN,
true)
let _ =
Notation.declare_scope bigN_scope;
Notation.declare_numeral_interpreter bigN_scope
(bigN_path, bigN_module)
interp_bigN
(bigN_list_of_constructors,
uninterp_bigN,
true)


(*** Parsing for bigZ in digital notation ***)
Expand Down Expand Up @@ -232,13 +234,15 @@ let uninterp_bigZ (AnyGlobConstr rc) =
None

(* Actually declares the interpreter for bigZ *)
let _ = Notation.declare_numeral_interpreter bigZ_scope
(bigZ_path, bigZ_module)
interp_bigZ
([DAst.make @@ GRef (bigZ_pos, None);
DAst.make @@ GRef (bigZ_neg, None)],
uninterp_bigZ,
true)
let _ =
Notation.declare_scope bigZ_scope;
Notation.declare_numeral_interpreter bigZ_scope
(bigZ_path, bigZ_module)
interp_bigZ
([DAst.make @@ GRef (bigZ_pos, None);
DAst.make @@ GRef (bigZ_neg, None)],
uninterp_bigZ,
true)

(*** Parsing for bigQ in digital notation ***)
let interp_bigQ ?loc n =
Expand All @@ -253,8 +257,10 @@ let uninterp_bigQ (AnyGlobConstr rc) =
with Non_closed -> None

(* Actually declares the interpreter for bigQ *)
let _ = Notation.declare_numeral_interpreter bigQ_scope
(bigQ_path, bigQ_module)
interp_bigQ
([DAst.make @@ GRef (bigQ_z, None)], uninterp_bigQ,
true)
let _ =
Notation.declare_scope bigQ_scope;
Notation.declare_numeral_interpreter bigQ_scope
(bigQ_path, bigQ_module)
interp_bigQ
([DAst.make @@ GRef (bigQ_z, None)], uninterp_bigQ,
true)

0 comments on commit 52f293f

Please sign in to comment.