Antony Scriven wrote: > On 26/03/2008, Xiaozhou Liu <[EMAIL PROTECTED]> wrote: > > > Hi Vimmers, > > > > During the development of the new regexp, one thing > > confuses me a lot: ordered alternation. (e.g. given r.e. > > 'ab\|abc' and text 'abc', 'ab' matched, not 'abc') > > > > I know that 100% compatibility is one of the project > > goals. So I try to keep this feature in the new regexp. > > But the problem is, ordered alternation is kind of 'side > > effect' of the original back track regexp matcher. > > AFAIK, It is very hard to implement this feature in the > > new, truly NFA matcher, if it is not impossible. We can > > resort to the original regexp when we see '\|', but we > > don't solve the problem perfectly. > > I thought Russ Cox had solved this in the code on his > website, or am I mistaken? > > > So does anyone really need this feature to be kept? > > I don't need it, and though I'd prefer the longest match > rather than the first alternative (as specified by POSIX) > I don't really care too much as long as it is well > documented. And since the original vi didn't have > alternation, we don't need to worry about compatibility in > that regard.
An interesting twist. Can you clarify which behaviour POSIX specifies (your sentence above is ambiguous)? > > If so, please do tell me. For me, the removal of this > > 'feature' won't break anything. > > It won't break anything that I use regexps for. But... > I know Parsing Expression Grammars can make use of this > feature to give precedence to one match over another. You > might want to check whether any of the syntax files do > something similar. --Antony I'm not sure a syntax file itself should, though it possibly could, because it would be in the ordering of the commands and Vim internal implementation of syntax highlighting that it would be relevant. I imagine the most robust way to test this would be automated testing--get a Vim script to output the synID for each character in a complex source file in each language and compare the output of Vims compiled with each regex engine. Ben. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---