aboutsummaryrefslogtreecommitdiff
path: root/doc/tools
diff options
context:
space:
mode:
authorThéo Zimmermann2019-02-16 15:14:46 +0100
committerGaëtan Gilbert2019-02-18 21:24:11 +0100
commitea8a9125a4e81e7c848cf53f1e34f534d359e832 (patch)
tree3495980fb3efcc41fd2cd658ac3ead6b12f47846 /doc/tools
parent2e4e082637771bc047fbd977aaa5de26956c4618 (diff)
[sphinx] Add abort and restart options to directive coqtop.
Diffstat (limited to 'doc/tools')
-rw-r--r--doc/tools/coqrst/coqdomain.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/doc/tools/coqrst/coqdomain.py b/doc/tools/coqrst/coqdomain.py
index 2d8bb43e62..36b842d347 100644
--- a/doc/tools/coqrst/coqdomain.py
+++ b/doc/tools/coqrst/coqdomain.py
@@ -566,7 +566,7 @@ class CoqtopDirective(Directive):
Definition a := 1.
The blank line after the directive is required. If you begin a proof,
- include an ``Abort`` afterwards to reset coqtop for the next example.
+ use the ``abort`` option to reset coqtop for the next example.
Here is a list of permissible options:
@@ -580,7 +580,9 @@ class CoqtopDirective(Directive):
- Behavior options
- ``reset``: Send a ``Reset Initial`` command before running this block
- - ``fail``: Don't die if a command fails.
+ - ``fail``: Don't die if a command fails
+ - ``restart``: Send a ``Restart`` command before running this block (only works in proof mode)
+ - ``abort``: Send an ``Abort All`` command after running this block (leaves all pending proofs if any)
``coqtop``\ 's state is preserved across consecutive ``.. coqtop::`` blocks
of the same document (``coqrst`` creates a single ``coqtop`` process per
@@ -831,16 +833,18 @@ class CoqtopBlocksTransform(Transform):
"""Parse options according to the description in CoqtopDirective."""
opt_reset = 'reset' in options
opt_fail = 'fail' in options
+ opt_restart = 'restart' in options
+ opt_abort = 'abort' in options
opt_all, opt_none = 'all' in options, 'none' in options
opt_input, opt_output = opt_all or 'in' in options, opt_all or 'out' in options
- unexpected_options = list(set(options) - set(('reset', 'fail', 'all', 'none', 'in', 'out')))
+ unexpected_options = list(set(options) - set(('reset', 'fail', 'restart', 'abort', 'all', 'none', 'in', 'out')))
if unexpected_options:
raise ValueError("Unexpected options for .. coqtop:: {}".format(unexpected_options))
elif (opt_input or opt_output) and opt_none:
raise ValueError("Inconsistent options for .. coqtop:: ‘none’ with ‘in’, ‘out’, or ‘all’")
- return opt_reset, opt_fail, opt_input and not opt_none, opt_output and not opt_none
+ return opt_reset, opt_fail, opt_restart, opt_abort, opt_input and not opt_none, opt_output and not opt_none
@staticmethod
def block_classes(should_show, contents=None):
@@ -866,10 +870,12 @@ class CoqtopBlocksTransform(Transform):
def add_coq_output_1(self, repl, node):
options = node['coqtop_options']
- opt_reset, opt_fail, opt_input, opt_output = self.parse_options(options)
+ opt_reset, opt_fail, opt_restart, opt_abort, opt_input, opt_output = self.parse_options(options)
pairs = []
+ if opt_restart:
+ repl.sendone("Restart.")
if opt_reset:
repl.sendone("Reset Initial.")
repl.sendone("Set Coqtop Exit On Error.")
@@ -877,6 +883,8 @@ class CoqtopBlocksTransform(Transform):
repl.sendone("Unset Coqtop Exit On Error.")
for sentence in self.split_sentences(node.rawsource):
pairs.append((sentence, repl.sendone(sentence)))
+ if opt_abort:
+ repl.sendone("Abort All.")
if opt_fail:
repl.sendone("Set Coqtop Exit On Error.")