// args.java //
// An example file distributed with com.stevesoft.pat // and com.stevesoft.pat.apps //
// This software comes without express or implied warranty.
// No claim is made about the suitability of this software for
// any purpose and neither I nor SteveSoft shall be liable for
// damages suffered by the user of this software.
import com.stevesoft.pat.*;
// Deeply Weird Stuff: Giving
// arguments to user defined patterns and
// replacement rules. You probably don't
// want to try and understand this unless
// you are already defining and using your
// own patterns and replacement rules.
// This is a replace rule that copies the
// matched text m times when replacing.
// ${multi:3} is equivalent to $&$&$&
// ${multi:5} is equivalent to $&$&$&$&$&.
class MultiplicityRule extends ReplaceRule {
int m = 1;
MultiplicityRule() {}
MultiplicityRule(int mi) { m = mi; }
// This is the thing that does the actual replacing
// see fancy.java for the basics.
public void apply(StringBufferLike sb,RegRes rr) {
for(int i=0;i