Skip to content

Commit

Permalink
versions of glob that ignore universes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Malecha committed Jun 5, 2015
1 parent 577afe6 commit 1ecde10
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/term_match.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
type ('a,'b,'c) pattern =
| Glob of Term.constr Lazy.t
| EGlob of Term.constr
| Glob_no_univ of Term.constr Lazy.t
| EGlob_no_univ of Term.constr
| App of ('a,'b,'c) pattern * ('a,'b,'c) pattern
| Lam of 'b * ('a,'b,'c) pattern * ('a,'b,'c) pattern
| As of ('a,'b,'c) pattern * 'a
Expand Down Expand Up @@ -43,6 +45,22 @@ let rec match_pattern p e ctx s =
else
raise Match_failure
end
| Glob_no_univ name ->
begin
if Term.eq_constr_nounivs (Lazy.force name) e
then
s
else
raise Match_failure
end
| EGlob_no_univ name ->
begin
if Term.eq_constr_nounivs name e
then
s
else
raise Match_failure
end
| Filter (f, p) ->
if f ctx e then match_pattern p e ctx s else raise Match_failure
| Choice pl ->
Expand Down
2 changes: 2 additions & 0 deletions src/term_match.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
type ('a,'b,'c) pattern =
| Glob of Term.constr Lazy.t
| EGlob of Term.constr
| Glob_no_univ of Term.constr Lazy.t
| EGlob_no_univ of Term.constr
| App of ('a,'b,'c) pattern * ('a,'b,'c) pattern
| Lam of 'b * ('a,'b,'c) pattern * ('a,'b,'c) pattern
| As of ('a,'b,'c) pattern * 'a
Expand Down

0 comments on commit 1ecde10

Please sign in to comment.