module lang::sdf2::filters::IndirectPreferAvoid
rascal-0.40.16
Usage
import lang::sdf2::filters::IndirectPreferAvoid;
Dependencies
import ParseTree;
import Set;
function isPreferred
default bool isPreferred(Tree _)
bool isPreferred(appl(prod(_,_,{\tag("prefer"()),*_}),_))
bool isPreferred(appl(prod(Symbol _,[Symbol _],set[Attr] _), [Tree arg]))
function isAvoided
default bool isAvoided(Tree _)
bool isAvoided(appl(prod(_,_,{\tag("avoid"()),*_}),_))
bool isAvoided(appl(prod(Symbol _,[Symbol _],set[Attr] _), [Tree arg]))
function indirectPreferAvoidFilter
Import his module if you want prefer/avoid filtering enabled for your grammar. Use @prefer and @avoid to label alternatives.
&T <:Tree indirectPreferAvoidFilter(amb(set[&T <:Tree] alternatives))