Re: smelly code in input.c

Anthony Clayden <[email protected]> Tue, 15 Jun 2021 19:33:20 +1200
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <CABU_mxjtZL0c4GAr9Z8et5KSV-ExY=0KedAquknYf5vS0amA6w@mail.gmail.com>
--===============6775800108795779136==
Content-Type: multipart/alternative; boundary="00000000000098a36f05c4c8fd80"

--00000000000098a36f05c4c8fd80
Content-Type: text/plain; charset="UTF-8"

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 <[email protected]>
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.
>
>
>

--00000000000098a36f05c4c8fd80
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Thanks Iavor, nothing ventured nothing gained I went =
ahead and made that change.</div><div><br></div><div>I can&#39;t find any d=
ifference in behaviour for well-formed code. I can&#39;t find any differenc=
e in whether code is accepted/rejected.</div><div><br></div><div>But there&=
#39;s a difference in error messages for ill-formed code, specifically ill-=
formed qualified vars/constrs:</div><div><br></div><div>* standard-issue Hu=
gs reports=C2=A0</div><div><span style=3D"font-family:Arial,Helvetica,sans-=
serif">=C2=A0 =C2=A0 Undefined qualified variable &quot;Mod1.Sub2.Subsub3.<=
/span></div>=C2=A0 =C2=A0 &quot;<br><div>=C2=A0 =C2=A0 -- that is, shows tr=
ailing spaces and newline after the trailing dot.</div><div><br></div><div>=
* modified Hugs reports</div><div>=C2=A0 =C2=A0=C2=A0Syntax error in expres=
sion <span style=3D"font-family:Arial,Helvetica,sans-serif">(unexpected `;&=
#39;, possibly due to bad layout)</span></div><div><span style=3D"font-fami=
ly:Arial,Helvetica,sans-serif">=C2=A0 =C2=A0 -- or unexpected `}&#39;=C2=A0=
 -- these are pseudo- semicolon/closing brace, not actually in the file</sp=
an></div><div><span style=3D"font-family:Arial,Helvetica,sans-serif">=C2=A0=
 =C2=A0 -- that is, it&#39;s &#39;munched&#39; the trailing spaces and newl=
ine, then bumped into start of next statement</span></div><div><span style=
=3D"font-family:Arial,Helvetica,sans-serif">=C2=A0 =C2=A0 -- so layout-cont=
rol inserts the pseudo-&#39;s</span></div><div><span style=3D"font-family:A=
rial,Helvetica,sans-serif"><br></span></div><div><span style=3D"font-family=
:Arial,Helvetica,sans-serif">Then perhaps that smelly code is deliberate, t=
o give a more helpful rejection message? hmm hmm</span></div><div><span sty=
le=3D"font-family:Arial,Helvetica,sans-serif"><br></span></div><div><span s=
tyle=3D"font-family:Arial,Helvetica,sans-serif">I still can&#39;t see why/h=
ow the parsing works for well-formed qualified vars/constrs. But best to le=
t sleeping dogs lie.</span></div><div><span style=3D"font-family:Arial,Helv=
etica,sans-serif"><br></span></div><div><span style=3D"font-family:Arial,He=
lvetica,sans-serif">AntC</span></div><br><div class=3D"gmail_quote"><div di=
r=3D"ltr" class=3D"gmail_attr">On Tue, 15 Jun 2021 at 03:13, Iavor Diatchki=
 &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><d=
iv dir=3D"ltr"><div>I don&#39;t not know that code either, but looking at t=
he comments and the surrounding code, my guess is that the 2nd `c0` should =
be `c1`,</div><div>and it is checking for something like `.` followed by ei=
ther a lower case or upper case or symbol=C2=A0operator.<br></div><div><br>=
</div></div><div class=3D"gmail_quote"><br></div>
</blockquote></div></div>

--00000000000098a36f05c4c8fd80--

--===============6775800108795779136==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSHVncy1CdWdz
IG1haWxpbmcgbGlzdApIdWdzLUJ1Z3NAaGFza2VsbC5vcmcKaHR0cDovL21haWwuaGFza2VsbC5v
cmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL2h1Z3MtYnVncw==

--===============6775800108795779136==--