On Tue, Apr 19, 2005 at 06:11:43PM -0700, Ray Lee wrote: > > second patch: > > replace ./hello.c [A-Za-z_0-9] world universe > > Aha! Okay, I now see at least part of issue: we're using different > definitions of 'token.' Yours is quite sensible, in that it matches the > darcs syntax. However, I'm claiming a token is defined by the file's > language, and that a replace patch on anything but a token as per those > language standards is a silly thing.
The trouble is that a token based on language standards is also wrong, unless your file at all times is syntactically correct. It also means (for C in particular) that the result of the token replace isn't uniquely determined by the combination of the token replace patch and the file it applies to, since you need parse any header files in order to tokenize the C file. In the case of header files, it may not be possible to tokenize them uniquely, since they may tokenize differently depending on what other header files are included before them. And of course, none of this may be possible if you haven't run autoconf and configure, since you may not actually *have* the header files in the first place... In a (reasonably) general-purpose tool like darcs, I think it's better to stick with a simpler definition of token that doesn't require a complete integrated development environment. It's also true that often you want to modify headers and string contents simultaneously with the change of the code itself. When I replace get_pseudowavefunction with get_atomic_orbital, I also want to modify // We call get_pseudowavefunction to get the atomic orbital... and printf("Error in get_pseudowavefunction!\n"); -- David Roundy http://www.darcs.net - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html