Skip to content

Commit 91b19fc

Browse files
todd-coxeter: update for changes in libsemigroups
1 parent 3d9e980 commit 91b19fc

File tree

6 files changed

+485
-31
lines changed

6 files changed

+485
-31
lines changed

docs/source/main-algorithms/todd-coxeter/class/modifiers.rst

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
..
2-
Copyright (c) 2024 J. D. Mitchell
2+
Copyright (c) 2024-2026 J. D. Mitchell
33
44
Distributed under the terms of the GPL license version 3.
55

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

18+
Contents
19+
--------
20+
21+
.. autosummary::
22+
:signatures: short
23+
24+
ToddCoxeter.perform_lookahead
25+
ToddCoxeter.perform_lookahead_for
26+
ToddCoxeter.perform_lookahead_until
27+
ToddCoxeter.perform_lookbehind
28+
ToddCoxeter.perform_lookbehind_no_checks
29+
ToddCoxeter.perform_lookbehind_for
30+
ToddCoxeter.perform_lookbehind_for_no_checks
31+
ToddCoxeter.perform_lookbehind_until
32+
ToddCoxeter.perform_lookbehind_until_no_checks
33+
ToddCoxeter.shrink_to_fit
34+
ToddCoxeter.standardize
35+
36+
Full API
37+
--------
38+
1839
.. automethod:: ToddCoxeter.perform_lookahead
1940

41+
.. automethod:: ToddCoxeter.perform_lookahead_for
42+
43+
.. automethod:: ToddCoxeter.perform_lookahead_until
44+
45+
.. automethod:: ToddCoxeter.perform_lookbehind
46+
47+
.. automethod:: ToddCoxeter.perform_lookbehind_no_checks
48+
49+
.. automethod:: ToddCoxeter.perform_lookbehind_for
50+
51+
.. automethod:: ToddCoxeter.perform_lookbehind_for_no_checks
52+
53+
.. automethod:: ToddCoxeter.perform_lookbehind_until
54+
55+
.. automethod:: ToddCoxeter.perform_lookbehind_until_no_checks
56+
2057
.. automethod:: ToddCoxeter.shrink_to_fit
2158

2259
.. automethod:: ToddCoxeter.standardize

etc/catch-cpp-to-pytest-f1.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function! CatchCPPToPytest()
2+
silent '<,'>s/{/[/ge
3+
silent '<,'>s/}/]/ge
4+
silent '<,'>s/::/./ge
5+
silent '<,'>s/true/True/ge
6+
silent '<,'>s/false/False/ge
7+
silent '<,'>s/;//ge
8+
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
9+
silent '<,'>s/<[^>]*>//ge
10+
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
11+
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
12+
silent '<,'>s/\<\(\d\)_w/\1]/ge
13+
silent '<,'>s/!/not /ge
14+
silent '<,'>s/\/\/.*$//ge
15+
endfunction
16+
17+
map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
18+
map <F1> :call CatchCPPToPytest()<CR>
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
1-
function! CatchCPPToPytest()
2-
silent '<,'>s/{/[/ge
3-
silent '<,'>s/}/]/ge
4-
silent '<,'>s/::/./ge
5-
silent '<,'>s/true/True/ge
6-
silent '<,'>s/false/False/ge
7-
silent '<,'>s/;//ge
8-
silent '<,'>s/REQUIRE(\([^)]*\))/assert \1/ge
9-
silent '<,'>s/<[^>]*>//ge
10-
silent '<,'>s/REQUIRE_THROWS_AS(\([^,]\+\),\s\+LibsemigroupsException)/with pytest.raises(RuntimeError):\r assert \1/ge
11-
silent '<,'>s/\(\d\)\(\d\+_w\)/\1, \2/ge
12-
silent '<,'>s/\<\(\d\)_w/\1]/ge
13-
silent '<,'>s/!/not /ge
14-
silent '<,'>s/\/\/.*$//ge
15-
endfunction
16-
171
function! DoxyToSphinx()
182
silent '<,'>s/\/\/!//ge
193
silent '<,'>s/^.*\\tparam.*$//ge
20-
silent '<,'>s/\\param\s\+\(\w\)\+\(.*\)$/:param \1: \2\r :type \1: ??/ge
4+
silent '<,'>s/\\param\s\+\(\w\+\)/:param \1:/ge
215
silent '<,'>s/\\returns/:returns:/ge
226
silent '<,'>s/\\throws LibsemigroupsException/:raises RuntimeError:/ge
237
silent '<,'>s/`\{-1}/``/ge
248
silent '<,'>s/`\{4}/``/ge
25-
silent '<,'>s/\\p\s\+\(\w\+\)/``\1``/ge
26-
silent '<,'>s/\\ref\s\+\(\w\+\)/:py:any:`\1`/ge
9+
silent '<,'>s/\\p\s\+\(\w\+\)/*\1*/ge
2710
silent '<,'>s/\\c\s\+\(\w\+\)/``\1``/ge
2811
silent '<,'>s/``true``/``True``/ge
2912
silent '<,'>s/``false``/``False``/ge
@@ -33,9 +16,13 @@ function! DoxyToSphinx()
3316
silent '<,'>s/\\f\$\(.\{-}\)\\f\$/:math:`\1`/ge
3417
silent '<,'>s/:math:``\(.\{-}\)``/:math:`\1`/ge
3518
silent '<,'>s/``\(.\{-}\)``_/`\1`_/ge
19+
silent '<,'>s/\\ref_knuth_bendix/:any:`KnuthBendix`/ge
20+
silent '<,'>s/\\brief//ge
21+
silent '<,'>s/\\ref\s\+\([a-zA-z:]\+\)/:any:`\1`/ge
22+
silent '<,'>s/:any:``\(.\{-}\)``/:any:`\1`/ge
23+
silent '<,'>s/::/./ge
24+
silent '<,'>s/^\s*//ge
3625
endfunction
3726

38-
map! <F1> <ESC>:call CatchCPPToPytest()<CR>i
39-
map <F1> :call CatchCPPToPytest()<CR>
4027
map! <F2> <ESC>:call DoxyToSphinx()<CR>i
4128
map <F2> :call DoxyToSphinx()<CR>

src/todd-coxeter-impl.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,13 @@ returned by this function may not be compatible with the relations of
14001400
// Modifiers
14011401
////////////////////////////////////////////////////////////////////////
14021402

1403-
thing.def("perform_lookahead",
1404-
&ToddCoxeterImpl_::perform_lookahead,
1405-
py::arg("stop_early"),
1406-
R"pbdoc(
1403+
thing.def(
1404+
"perform_lookahead",
1405+
[](ToddCoxeterImpl_& self, bool stop_early) {
1406+
self.perform_lookahead(stop_early);
1407+
},
1408+
py::arg("stop_early"),
1409+
R"pbdoc(
14071410
:sig=(self: ToddCoxeter, stop_early: bool) -> None:
14081411
14091412
Perform a lookahead.

0 commit comments

Comments
 (0)