On Tue, Sep 27, 2016 at 01:31:15PM +0200, Jakub Jelinek wrote: > I think it is important to think in terms of what regexps we still want to > match, even when the matching is actually implemented in C, not using > regexps. And yes, you list one reason why arbitrary text with fall and > through somewhere in it is not a good idea. Another: > /* XXX Really fallthru? */ > (what we have in pch.c). > So, if you want to allow ... fall through ... and else fall through, and > perhaps // fall through - some explanation > then it might be e.g. > //-fallthrough$ > //@fallthrough@$ > /\*-fallthrough\*/ > /\*@fallthrough@\*/ > //[ \t.]*(ELSE )?FALL(S | |-)?THR(OUGH|U)[ \t.]*(-.*)?$ > //[ \t.]*(Else )?Fall(s | |-)?[Tt]hr(ough|u)[ \t.]*(-.*)?$ > //[ \t.]*(else )?fall(s | |-)?thr(ough|u)[ \t.]*(-.*)?$ > /\*[ \t.]*(ELSE )?FALL(S | |-)?THR(OUGH|U)[ \t.]*(-.*)?\*/ > /\*[ \t.]*(Else )?Fall(s | |-)?[Tt]hr(ough|u)[ \t.]*(-.*)?\*/ > /\*[ \t.]*(else )?fall(s | |-)?thr(ough|u)[ \t.]*(-.*)?\*/ > where . would match even newlines in the last 3, > but $ would always match just end of line?
Any comment with text ^[^_[:alnum:]]*(else )?fall(s | |-)?thr(ough|u)[^_[:alnum:]]*$ perhaps? Case-insensitive. Or allow any amount of space, or even any interpunction. Just don't allow any alphanumerics except for those exact words, and there won't be many false hits at all. Segher