From: Nobuyoshi Nakada Date: 2008-02-21T02:39:05+09:00 Subject: Re: possible bug in regexp lexing Hi, At Thu, 21 Feb 2008 00:29:15 +0900, Tanaka Akira wrote in [ruby-core:15628]: > I think there is no reason to change the semantics for > escaped form even if the character is selected as a > terminator. If it is changed, it violates > "non-alphanumeric character can be escaped by slash". > So %r?\?? should means single character match for a QUESTION > MARK. Am I missing any meta characters? Index: parse.y =================================================================== --- parse.y (revision 15555) +++ parse.y (working copy) @@ -2968,6 +2968,11 @@ tokadd_escape(term) return -1; + case '(': case ')': case '{': case '}': case '[': case ']': + case '?': case '+': case '*': case '|': case '.': case '\\': + tokadd('\\'); + tokadd(c); + break; default: - if (c != '\\' || c != term) + if (c != term) tokadd('\\'); tokadd(c); -- Nobu Nakada