File | conditional.str |
Author | unknown |
Since | unknown |
Conditionals
General | |
Lines of code | 135 |
Stratego | |
Module number | 1 (100% documented) |
Constructor number | 0 |
Overlay number | 0 |
Strategy number | 16 (62% documented) |
Rule number | 2 (0% documented) |
DynamicRule number | 0 |
Strategy summary |
||
and(Strategy s1, Strategy s2) | and(s1, s2) applies s1 and s2 to the current term and succeeds if both succeed | conditional.str |
eq | n/a | conditional.str |
equal | Tests whether two terms are equal | conditional.str |
equal(ATerm x) | Tests whether current term is equal to argument term | conditional.str |
equal(ATerm x, ATerm y) | Tests whether two argument terms are equal to each other | conditional.str |
false | false is a synonym for id | conditional.str |
finally(Strategy s, Strategy f) | Applies s followed by f whether s failed or not | conditional.str |
if(Strategy c, Strategy b) | n/a | conditional.str |
if(Strategy c, Strategy b1, Strategy b2) | n/a | conditional.str |
ior(Strategy s1, Strategy s2) | ior(s1, s2) implements 'inclusive or', that is, the inclusive choice of s1 and s2 | conditional.str |
maybe(Strategy s) | n/a | conditional.str |
or(Strategy s1, Strategy s2) | or(s1, s2) is similar to ior(s1,s2), but the application of the strategies is only tested | conditional.str |
restore(Strategy s, Strategy rest) | Apply restoring action 'rest' if s fails, and then fail | conditional.str |
restore-always(Strategy s, Strategy rest) | Apply restoring action 'rest' after s terminates, and preserve success/failure behaviour of s | conditional.str |
true | n/a | conditional.str |
try(Strategy s) | n/a | conditional.str |
Rule summary |
||
maybe(Strategy s1, Strategy s2) | n/a | conditional.str |
maybe(Strategy s1, Strategy s2) | n/a | conditional.str |
Strategy details |
|||||||||||||||
ATerm | and(Strategy s1, Strategy s2) | ||||||||||||||
and(s1, s2) applies s1 and s2 to the currentterm and succeeds if both succeed. s2 will alwaysbe applied, i.e., and is *not* a short-circuit operator |
|||||||||||||||
ATerm | equal | ||||||||||||||
Tests whether two terms are equal. |
|||||||||||||||
ATerm | equal(ATerm x) | ||||||||||||||
Tests whether current term is equal to argument term. |
|||||||||||||||
ATerm | equal(ATerm x, ATerm y) | ||||||||||||||
Tests whether two argument terms are equal to each other. |
|||||||||||||||
ATerm | false | ||||||||||||||
false is a synonym for id. |
|||||||||||||||
ATerm | finally(Strategy s, Strategy f) | ||||||||||||||
Applies s followed by f whether s failed or not.
|
|||||||||||||||
ATerm | ior(Strategy s1, Strategy s2) | ||||||||||||||
ior(s1, s2) implements 'inclusive or', that is, theinclusive choice of s1 and s2. It first tries s1, ifthat fails it applies s2 (just like s1 <+ s2). However,when s1 succeeds it also tries to apply s2. The results of the transformations are returned. |
|||||||||||||||
ATerm | or(Strategy s1, Strategy s2) | ||||||||||||||
or(s1, s2) is similar to ior(s1,s2), but the applicationof the strategies is only tested. |
|||||||||||||||
ATerm | restore(Strategy s, Strategy rest) | ||||||||||||||
Apply restoring action 'rest' if s fails, and then fail. Typically useful if s performs side effects that should berestored/undone in case s fails. |
|||||||||||||||
ATerm | restore-always(Strategy s, Strategy rest) | ||||||||||||||
Apply restoring action 'rest' after s terminates, and preservesuccess/failure behaviour of s. Typically useful if s performs side effects that should berestored always, e.g., when maintaining scope information. |
|||||||||||||||