feat(library/tactic): add repeat1 and determ tacticals

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-11-24 11:38:45 -08:00
parent cb7a5288c5
commit 40d612eca0

View file

@ -173,6 +173,10 @@ tactic par(tactic const & t1, tactic const & t2, unsigned check_ms = 1);
\brief Return a tactic that keeps applying \c t until it fails.
*/
tactic repeat(tactic const & t);
/**
\brief Similar to \c repeat, but applies \c t at least once.
*/
inline tactic repeat1(tactic const & t) { return then(t, repeat(t)); }
/**
\brief Similar to \c repeat, but execute \c t at most \c k times.
@ -186,6 +190,10 @@ tactic repeat_at_most(tactic const & t, unsigned k);
k elements from the sequence produced by \c t.
*/
tactic take(tactic const & t, unsigned k);
/**
\brief Syntax sugar for take(t, 1)
*/
inline tactic determ(tactic const & t) { return take(t, 1); }
/**
\brief Return a tactic that forces \c t to produce all
the elements in the resultant sequence.