1 Mar 2000 15:39
Re: Sieve regex extension
Ken Murchison <ken <at> oceana.com>
2000-03-01 14:39:17 GMT
2000-03-01 14:39:17 GMT
Tim Showalter wrote: > > Randall Gellens <randy <at> Qualcomm.Com> writes: > > > At 3:17 PM -0500 2/9/00, Ken Murchison wrote: > > > > >CMU Sieve currently strips all single backslashes in quoted strings, > > >which seems to be one reasonable implementation based on the working in > > >the spec. This behavior requires that any escaped meta-character in a > > >regex must be preceded by two backslashes. This behavior also effects > > >the :matches match-type in the base spec and imapflags as defined in > > >draft-melnikov-sieve-imapflags-02. > > > > > >I am not up to speed on the discussions that led to the current wording > > >in the spec, but I'd like to see all escape sequences passed through > > >untouched, or perhaps be context-sensitive as hinted at in the spec. > > >But, "this is just my opinion, and I could be wrong." > > > > I agree with you. Two backslashes should mean one literal backslash. > > "\." in a regexp should mean a literal dot. "\\." should mean a > > literal backslash followed by any character. Otherwise it's too > > confusing. > > I believe that this is impossible to correctly parse without passing > information between the parser and the lexer in a very unsavory way. > In particular, if you're trying to decide what a backslash means at > the lexer level, you can't, and you have to wait until the string is > used in context. > > I'm not happy that the spec says what it does. It was a mistake. > > For consistancy, I believe only \ and \" should be significant in a > string; to escape a metacharacter, the syntax should be "\\?" (i.e., > match a literal question mark). The sequence "\\\?" is not > syntactically legal. > > Programmers can grasp this (it's what C, Perl, and some Lisp > implementations do) and no one else will understand it, no matter what > we decide. > > I would like to change the spec to reflect the behavior implemented in > CMU's Sieve implementation. Tim, When might you get to this? Alexey suggested that I add an example or two to the regex spec, but I want this to jive with the wording in the base spec. Ken -- -- Kenneth Murchison Oceana Matrix Ltd. Software Engineer 21 Princeton Place 716-662-8973 x26 Orchard Park, NY 14127 --PGP Public Key-- http://www.oceana.com/~ken/ksm.pgp
RSS Feed