Subject: Re: guix import hackage failures

From: [email-masked] (Ludovic Courtès)
Date: Thu, 12 Nov 2015 21:21:32 +0100

Federico Beffa <[email-masked]> skribis:

> On Thu, Nov 12, 2015 at 10:07 AM, Ludovic Courtès <[email-masked]> wrote:
>> Federico Beffa <[email-masked]> skribis:
>> I wonder if it wouldn’t be easier to change the lexer to recognize line
>> feeds are white space or newlines, maybe along these lines:
>
> What you suggest is not enough. You have to tweak a couple of other
> places as well.
>
> I don't like having to mess around in token recognition code to
> account for different eol styles. With my proposal I was trying to
> abstract this away and make the eol style problem orthogonal to
> parsing: first we convert to a "normal form" and then we operate on
> it.  Should we find some files in 'mac' eol-style (in Emacs parlance)
> then it would be trivial to adapt.
>
> Could you be more explicit about what you do not like about this?

I think the approach you suggest is fine, but I noticed that the places
I changed were too specific anyway (looking for #\space and #\tab
instead of the general char-set:whitespace class, for instance.)  So I
thought that it generalizing this would also fix the problem, that would
be nice, because the change is more general than just fixing the CRLF
issue.

But maybe I’m missing other places, which would make the change too
intrusive.  That’s why I was asking for your feedback.

Does that make sense?

If we go for the CRLF conversion port, we should avoid the pipe and
extra thread.  Instead, I would suggest something like:

  (define (canonical-newline-port port)
    "Return an input port that wraps PORT such that all newlines consist
  of a single carriage return."
    (make-custom-binary-input-port …))

WDYT?

Thanks,
Ludo’.