smelly code in input.c

Anthony Clayden anthony.d.clayden at gmail.com
Tue Jun 15 07:33:20 UTC 2021


Thanks Iavor, nothing ventured nothing gained I went ahead and made that
change.

I can't find any difference in behaviour for well-formed code. I can't find
any difference in whether code is accepted/rejected.

But there's a difference in error messages for ill-formed code,
specifically ill-formed qualified vars/constrs:

* standard-issue Hugs reports
    Undefined qualified variable "Mod1.Sub2.Subsub3.
    "
    -- that is, shows trailing spaces and newline after the trailing dot.

* modified Hugs reports
    Syntax error in expression (unexpected `;', possibly due to bad layout)
    -- or unexpected `}'  -- these are pseudo- semicolon/closing brace, not
actually in the file
    -- that is, it's 'munched' the trailing spaces and newline, then bumped
into start of next statement
    -- so layout-control inserts the pseudo-'s

Then perhaps that smelly code is deliberate, to give a more helpful
rejection message? hmm hmm

I still can't see why/how the parsing works for well-formed qualified
vars/constrs. But best to let sleeping dogs lie.

AntC

On Tue, 15 Jun 2021 at 03:13, Iavor Diatchki <iavor.diatchki at gmail.com>
wrote:

> I don't not know that code either, but looking at the comments and the
> surrounding code, my guess is that the 2nd `c0` should be `c1`,
> and it is checking for something like `.` followed by either a lower case
> or upper case or symbol operator.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/hugs-bugs/attachments/20210615/65ea79b3/attachment.html>


More information about the Hugs-Bugs mailing list