On Friday 05 of October 2012 10:34:04 erik quanstrom wrote: > > however, i thought of a really sneaky cheat, that is almost correct. > > since > > \n is 0a, and we almost never see 09 or 0b (ht and vt), we could build a > > sneaky character class to elude the parser: > > > > data matches 'error[ -]' > > plumb start window > > i didn't think hard enough about mailers mangling this. what i had was > > data matches 'error[0x09-0x11] > > of course, replace 0x09 and 0x11 with their literal codepoints.
it's succinct, it works and yes, it went through correctly :D another possible way -- separate verb for multiline match. meta -- is it ok to send Git patches as an attachment? cheers, -- dexen deVries [[[↓][→]]]
commit fb99b4872ee3252bea88cf1f187c6cbedeba085b Author: dexen deVries <[email protected]> Date: Fri Oct 5 16:45:19 2012 +0200 usability: provide multiline matching in plumber diff --git a/src/cmd/plumb/match.c b/src/cmd/plumb/match.c index 5a4cd88..0dcc664 100644 --- a/src/cmd/plumb/match.c +++ b/src/cmd/plumb/match.c @@ -283,6 +283,7 @@ matchpat(Plumbmsg *m, Exec *e, Rule *r) case VIsfile: return verbisfile(r->obj, m, r, e, ~DMDIR, DMDIR, &e->file); case VMatches: + case VMatchesMultiline: return verbmatches(r->obj, m, r, e); case VSet: verbset(r->obj, m, r, e); diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h index c8f3081..cd00680 100644 --- a/src/cmd/plumb/plumber.h +++ b/src/cmd/plumb/plumber.h @@ -29,6 +29,7 @@ enum VIsdir, VIsfile, VMatches, + VMatchesMultiline, VSet, VStart, VTo diff --git a/src/cmd/plumb/rules.c b/src/cmd/plumb/rules.c index 4da4bb2..d815db9 100644 --- a/src/cmd/plumb/rules.c +++ b/src/cmd/plumb/rules.c @@ -64,6 +64,7 @@ char *verbs[] = "isdir", "isfile", "matches", + "matchesmultiline", "set", "start", "to", @@ -363,6 +364,10 @@ parserule(Rule *r) r->regex = regcomp(r->qarg); return; } + if(r->verb == VMatchesMultiline){ + r->regex = regcompnl(r->qarg); + return; + } break; case OPlumb: if(r->verb!=VClient && r->verb!=VStart && r->verb!=VTo)
