[darcs-users] darcs replace token complaint

Trent W. Buck trentbuck at gmail.com
Sun Aug 16 10:38:55 UTC 2009


On Sun, Aug 16, 2009 at 05:46:16AM -0400, Max Battcher wrote:
> (Plus such benefits as syntax highlighters are already designed to
> be fast, to be non-lossy, and to handle error states and partial
> documents well...)

IME syntax highlighting implementations are "best effort", not
lossless[0] -- they *do* sacrifice accuracy for speed.  I don't
consider that acceptable for a VCS, particularly in the presence of
commutation.  I guess that's the crux of our disagreement.

It's probably worth noting that while you can't PARSE most real-world
languages using regexps (as syntax highlighters[0] pretend to do), it
should be possible to TOKENIZE many real-world languages with regexps.
So for example the obscene hacks that Emacs ≥22.0 employs to highlight
nested sh quotation (as below) are not relevant.

    xs="$(echo "$(echo "echo")")"

Regarding partial documents, I tend to take the hard line that "if it
don't compile, don't commit it".  If darcs replace helps enforce that,
all the better :-)

(I just noticed my mismatching-parens example upthread is actually an
invalid parse, but a perfectly valid tokenization.)

Anyway, I'm not implementing this design anytime soon, so I'll leave
it to that hypothetical volunteer as to whether syntax highlighting
libraries can/should.

[0] There are exceptions.  For example, I believe Climacs' syntax
    highlighting utilizes conventional lexing and parsing.


More information about the darcs-users mailing list