From: Tanaka Akira Date: 2008-02-21T00:29:15+09:00 Subject: Re: possible bug in regexp lexing In article <20080220125943.78CB3E0297@mail.bc9.jp>, Nobuyoshi Nakada writes: > I think it ambiguous, whether it means an escaped terminator or > an escaped meta character, and unsafe. We should define the > expected behavior for such cases first. We need to define two syntax to three semantics syntax: * non-escaped character * escaped charcter semantics: * regexp terminator * single character match * other constructs (repeat, choice, etc.) It is impossible to map the two to the three. If a character is selected as the terminator, the character in non-escaped form is used. So we need to define the semantics of the escaped form. If the character has no "other constructs" semantics, slash for example, there is no problem to define it as single character match. But the semantics exists, we have not enough syntax to represent the semantics. We must drop an semantics. ruby supports only non-alphnumerics as regexp terminators (since ruby 1.6.6). So the escaped form is always single character match in usual. 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. -- Tanaka Akira