Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion docs/source/main-algorithms/todd-coxeter/class/modifiers.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
..
Copyright (c) 2024 J. D. Mitchell
Copyright (c) 2024-2026 J. D. Mitchell

Distributed under the terms of the GPL license version 3.

Expand All @@ -15,8 +15,45 @@ that can be used to modify the state of a :any:`ToddCoxeter` instance. In other
words, for modifying the :any:`WordGraph` that is the output of the algorithm in
a way that preserves it up to isomorphism.

Contents
--------

.. autosummary::
:signatures: short

ToddCoxeter.perform_lookahead
ToddCoxeter.perform_lookahead_for
ToddCoxeter.perform_lookahead_until
ToddCoxeter.perform_lookbehind
ToddCoxeter.perform_lookbehind_no_checks
ToddCoxeter.perform_lookbehind_for
ToddCoxeter.perform_lookbehind_for_no_checks
ToddCoxeter.perform_lookbehind_until
ToddCoxeter.perform_lookbehind_until_no_checks
ToddCoxeter.shrink_to_fit
ToddCoxeter.standardize

Full API
--------

.. automethod:: ToddCoxeter.perform_lookahead

.. automethod:: ToddCoxeter.perform_lookahead_for

.. automethod:: ToddCoxeter.perform_lookahead_until

.. automethod:: ToddCoxeter.perform_lookbehind

.. automethod:: ToddCoxeter.perform_lookbehind_no_checks

.. automethod:: ToddCoxeter.perform_lookbehind_for

.. automethod:: ToddCoxeter.perform_lookbehind_for_no_checks

.. automethod:: ToddCoxeter.perform_lookbehind_until

.. automethod:: ToddCoxeter.perform_lookbehind_until_no_checks

.. automethod:: ToddCoxeter.shrink_to_fit

.. automethod:: ToddCoxeter.standardize
18 changes: 18 additions & 0 deletions etc/catch-cpp-to-pytest-f1.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function! CatchCPPToPytest()
silent '<,'>s/{/[/ge
silent '<,'>s/}/]/ge
silent '<,'>s/::/./ge
silent '<,'>s/true/True/ge
silent '<,'>s/false/False/ge
silent '<,'>s/;//ge
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
silent '<,'>s/<[^>]*>//ge
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
silent '<,'>s/\<\(\d\)_w/\1]/ge
silent '<,'>s/!/not /ge
silent '<,'>s/\/\/.*$//ge
endfunction

map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
map <F1> :call CatchCPPToPytest()<CR>
29 changes: 8 additions & 21 deletions etc/catch-cpp-to-pytest.vim → etc/doxy-to-sphinx-f2.vim
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
function! CatchCPPToPytest()
silent '<,'>s/{/[/ge
silent '<,'>s/}/]/ge
silent '<,'>s/::/./ge
silent '<,'>s/true/True/ge
silent '<,'>s/false/False/ge
silent '<,'>s/;//ge
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
silent '<,'>s/<[^>]*>//ge
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
silent '<,'>s/\<\(\d\)_w/\1]/ge
silent '<,'>s/!/not /ge
silent '<,'>s/\/\/.*$//ge
endfunction

function! DoxyToSphinx()
silent '<,'>s/\/\/!//ge
silent '<,'>s/^.*\\tparam.*$//ge
silent '<,'>s/\\param\s\+\(\w\)\+\(.*\)$/:param \1: \2\r :type \1: ??/ge
silent '<,'>s/\\param\s\+\(\w\+\)/:param \1:/ge
silent '<,'>s/\\returns/:returns:/ge
silent '<,'>s/\\throws LibsemigroupsException/:raises RuntimeError:/ge
silent '<,'>s/`\{-1}/``/ge
silent '<,'>s/`\{4}/``/ge
silent '<,'>s/\\p\s\+\(\w\+\)/``\1``/ge
silent '<,'>s/\\ref\s\+\(\w\+\)/:py:any:`\1`/ge
silent '<,'>s/\\p\s\+\(\w\+\)/*\1*/ge
silent '<,'>s/\\c\s\+\(\w\+\)/``\1``/ge
silent '<,'>s/``true``/``True``/ge
silent '<,'>s/``false``/``False``/ge
Expand All @@ -33,9 +16,13 @@ function! DoxyToSphinx()
silent '<,'>s/\\f\$\(.\{-}\)\\f\$/:math:`\1`/ge
silent '<,'>s/:math:``\(.\{-}\)``/:math:`\1`/ge
silent '<,'>s/``\(.\{-}\)``_/`\1`_/ge
silent '<,'>s/\\ref_knuth_bendix/:any:`KnuthBendix`/ge
silent '<,'>s/\\brief//ge
silent '<,'>s/\\ref\s\+\([a-zA-z:]\+\)/:any:`\1`/ge
silent '<,'>s/:any:``\(.\{-}\)``/:any:`\1`/ge
silent '<,'>s/::/./ge
silent '<,'>s/^\s*//ge
endfunction

map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
map <F1> :call CatchCPPToPytest()<CR>
map! <F2> <ESC>:call DoxyToSphinx()<CR>i
map <F2> :call DoxyToSphinx()<CR>
11 changes: 7 additions & 4 deletions src/todd-coxeter-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,10 +1400,13 @@ returned by this function may not be compatible with the relations of
// Modifiers
////////////////////////////////////////////////////////////////////////

thing.def("perform_lookahead",
&ToddCoxeterImpl_::perform_lookahead,
py::arg("stop_early"),
R"pbdoc(
thing.def(
"perform_lookahead",
[](ToddCoxeterImpl_& self, bool stop_early) {
self.perform_lookahead(stop_early);
},
py::arg("stop_early"),
R"pbdoc(
:sig=(self: ToddCoxeter, stop_early: bool) -> None:

Perform a lookahead.
Expand Down
Loading
Loading