/** * Implosion of AsFix Layout */ module stratego/asfix/implode/layout strategies /** * Layout can be ignored. */ is-ignorable-syntax = is-layout /** * Literals can be ignored. */ is-ignorable-syntax = ?appl(prod(_, lit(_), _), _) /** * Case insensitive literals can be ignored. * * @todo This is questionable: you cannot preserve the case of a literal in this way. */ is-ignorable-syntax = ?appl(prod(_, cilit(_), _), _) /** * In AsFix2ME, literals can occur directly as arguments of an * application. For this reason, we include literals in the possible */ is-ignorable-syntax = ?lit(_) is-ignorable-syntax = ?cilit(_) strategies is-layout = ?appl(prod(_, cf(opt(layout())), _), _) is-layout = cf(opt(layout())) /** * @todo Find out why this strategy is used. */ is-layout' = appl(prod(id, cf(opt(layout)), id), id) + cf(opt(layout)) + layout(id) strategies rm-layout = rec x( try( appl(id, filter(not(is-layout); x)) + amb(map(x)) ) ) rules ImplodeLayout : appl(prod(_,cf(layout()),_), x) -> <concat-strings> x ImplodeLayout : appl(prod(_,cf(opt(layout())),_),[]) -> layout([]) ImplodeLayout : appl(prod(_,cf(opt(layout())),_),[xs]) -> layout([xs]) /** * @todo Move to a more appropiate place. */ signature constructors layout : List(Foo) -> Layout