[m-rev.] for review: better diagnostics for unbalanced parentheses
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Jul 30 09:40:31 AEST 2025
On Tue, 29 Jul 2025 16:48:25 +0200 (CEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > I find all the punctuation and symbols and line numbers hard to follow
> > and distracting.
> >
> > Here is my suggestion:
> >
> > Syntax error at token ')': expected comma, `|', `]', or operator.
> > There is an unclosed `[' on line 37.
> >
> > I think it is enough to point out the location and identity of
> > the last unclosed bracket.
>
> I am following all your other suggestions, but I want to push back on this one.
> Most of the time, it does not matter whether you print all unclosed brackets
> or just the last one, because you rarely have more than one. But when you do,
> you don't really want to have do a recompile to get the locations of the earlier ones.
> I *could* make the compiler print the location of just the last one and then add
> "and there are other unclosed brackets earlier as well", but to me, that would
> sound like the compiler going "nya-nya, those locations are for me to know
> and for you to find out", like on a kindergarten playground.
>
> To make things easier to read, I intend to generate output like this,
> with an nl piece between the sentences to make things line up:
>
> Syntax error at token ')': expected comma, `|', `]', or operator.
> There is an unclosed `[' on line 37.
> There is an unclosed `(' on line 42.
>
> Would that satisfy you?
The attached modified diff, which I have committed, generates the above
kind of output; see the new invalid_nodepend/unbalanced.err_exp.
Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.bal2
Type: application/octet-stream
Size: 5167 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20250730/281a7b85/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.bal2
Type: application/octet-stream
Size: 157203 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20250730/281a7b85/attachment-0003.obj>
More information about the reviews
mailing list