#! @BIN_PATH@/crm # do rewriting, based on rewrite rules in rewrites.mfp # { isolate (:rewrites:) input (:rewrites:) [:*:_arg2:] # reset matching on rewrites to start of string } # # Be sure we're at the start of the rewrites, and the start of the :_dw: match [:rewrites:] // # { # Grab the next regexturn the one-per-line patterns into a regex # First, do the line-spanning regexes. match // match (:ch: :fr: :to:) [:rewrites:] /(.+)>-->(.*)/ output [/dev/tty] /:*:_nl: checking :*:ch: -- / # see if the "fr" regex matches anywhere { match (:place:) /:*:fr:/ # Yep, it matched... alter it and do it again # alter (:place:) /:*:to:/ output [/dev/tty] /./ liaf } # Nope, didn't match... grab the next regex and try again, liaf } # # reset back to the start of the rewrites, and the start of the :_dw:. # match [:rewrites:] // # # and do it again for non-line-spanners { # Go through and do it again, except this time do it for # the non-line-spanning regexes. match // match (:ch: :fr: :to:) [:rewrites:] /(.+)>->(.*)/ output [/dev/tty] /:*:_nl:checking :*:ch: --/ # see if the "fr" regex matches anywhere { match (:place:) /:*:fr:/ # Yep, it matched... alter it and do it again # alter (:place:) /:*:to:/ output [/dev/tty] /./ liaf } # Nope, didn't match... grab the next regex and try again, liaf } output [/dev/tty] /:*:_nl:/ accept