| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (* We define some high-level properties of vernacular commands, used |
| 12 | mainly by the UI components *) |
| 13 | |
| 14 | open Vernacexpr |
| 15 | |
| 16 | let has_query_control { CAst.v } = |
| 17 | List.exists (function { CAst.v = ControlFail | ControlSucceed } -> true | _ -> false) v.control |
| 18 | |
| 19 | (* Navigation commands are allowed in a coqtop session but not in a .v file *) |
| 20 | let is_navigation_vernac = function |
| 21 | | VernacSynPure (VernacResetInitial | VernacResetName _ | VernacBack _) -> true |
| 22 | | _ -> false |
| 23 | |
| 24 | (* NB: Reset is now allowed again as asked by A. Chlipala *) |
| 25 | let is_reset = function |
| 26 | | VernacSynPure (VernacResetInitial | VernacResetName _) -> true |
| 27 | | _ -> false |
| 28 | |
| 29 | let is_debug = function |
| 30 | | VernacSynterp (VernacSetOption (_, ["Ltac";"Debug"], _)) -> true |
| 31 | | _ -> false |
| 32 | |
| 33 | let is_undo = function |
| 34 | | VernacSynPure (VernacUndo _ | VernacUndoTo _) -> true |
| 35 | | _ -> false |