+1. I think making it customizable (with a --cascade-level parameter) wouldn't add much value considering developing effort, though. Lilypond, like Python f. ex., should simply report the first error (and ideally immediately abort compilation).
—Martín. www.martinrinconbotero.com > > On Mar 29, 2022 at 2:36 AM, <Christopher Heckman > (mailto:[email protected])> wrote: > > > > On Mon, Mar 28, 2022 at 4:58 PM David Kastrup <[email protected]> wrote: > > > Christopher Heckman <[email protected]> writes: > > > I > have a request concerning Lilypond that has bothered me for a while, > > > but which I haven't seen any one else complain about. It is the > > > cascade of error messages you get when you leave out a right-brace or > > > some other symbol. > > > > Maybe this could be added as an option to > lilypond? > > > > lilypond --cascade-level=N file.ly > > > > > which, for any given line, prints the first N error messages, and > > > after that a message saying that further error messages have been > > > suppressed. A default value for N might be 3 or 4. > > > > What does > everyone think? > > The problems from followup errors do not magically > disappear because > they are not reported. The only thing that would make > sense is better > error recovery (which is pretty hard but can partly be > achieved by > inserting "error" productions matching typical error > scenarios into the > grammar: that causes a more targeted recovery and is > arguably > underutilised in LilyPond's grammar) but not pretending to be > fine. > I'm not saying that LilyPond should say that everything is fine, > just that it not report every single error for a line. If you have 8 or 9 > errors on one line, there's something wrong a basic level. For instance, > suppose I misspell markuplist on line 94. The next few errors look like > SyntacticStructuresInMusic.ly:94:1: error: unknown escaped string: > `\markuplst' \markuplst { SyntacticStructuresInMusic.ly:94:12: error: syntax > error, unexpected '{', expecting '.' or '=' \markuplst { > SyntacticStructuresInMusic.ly:100:1: error: unknown escaped string: > `\new-chapter' \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:1: error: string outside of text script or > \lyricmode \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:16: error: not a note name: Chapter > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:27: error: not a note name: The > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:31: error: not a note name: Basic > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:37: error: not a note name: Syntactic > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:47: error: not a note name: Structure > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:102:1: error: unknown escaped string: > `\flushpar' \flushpar { SyntacticStructuresInMusic.ly:102:1: error: string > outside of text script or \lyricmode --- (If you're upset that this is looks > illegible in an email, then you understand my point; it doesn't look much > nicer in a Terminal set to 108 characters wide.) What I'm saying is that the > errors for line 100 should look like the following instead (when N = 4) --- > SyntacticStructuresInMusic.ly:100:1: error: unknown escaped string: > `\new-chapter' \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:1: error: string outside of text script or > \lyricmode \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:16: error: not a note name: Chapter > \new-chapter { Chapter 1. The Basic Syntactic Structure } > SyntacticStructuresInMusic.ly:100:27: error: not a note name: The > \new-chapter { Chapter 1. The Basic Syntactic Structure } Warning: Lilypond > has possibly suppressed further error messages for line 100. > SyntacticStructuresInMusic.ly:102:1: error: unknown escaped string: > `\flushpar' \flushpar { --- and so on. > The problem with the followup > errors is that there is no way that > LilyPond can actually be sure that > they are followup errors. > True, but if you have a cascade of errors on a > particular line, you definitely need to fix what's causing the cascade. Once > you've done this, and you re-run Lilypond, it will now report only the errors > that aren't followups. --- Christopher Heckman > Good heuristics for error > recovery productions in the grammar are tricky > to do, and since they are > only relevant for erroneous input, they tend > not to be assigned a high > priority. > > On the other hand, I found excellent error recovery to be > of high > importance when the normal workflow was sucking a stack of punch > cards > through the reader and then checking your output shelf hours later > for a > stack of line printer paper with the results of your compilation > (and > hopefully execution, possibly accompanied by a post mortem dump > listing > the COMPASS assembly instructions running into problems). > > > I rarely find myself working an error log off sequentially these days > > rather than just restarting compilation after fixing a limited set of > > problems. > > -- > David Kastrup > >
