lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Offset in line numbers when report errors (lilypond 1.7.13) ?


From: David Boersma
Subject: Re: Offset in line numbers when report errors (lilypond 1.7.13) ?
Date: Tue, 25 Feb 2003 14:21:55 +0100 (CET)

Hi!

When you run a faulty perl script the line number you get is the line
number corresponding to the whole statement (which may be spread over
several lines of code). If you forget e.g. a semicolon after a statement,
the interpreter will complain about the NEXT line in the file (which you
intended to be the next statement). And there are many other reasons why a
compiler/interpreter/parser might not immediately stumber over your
'error', but keeps on trying and runs into trouble only later.

I suppose that when Lily code is parsed it is also grouped into smaller
and larger 'statements' or music fragments. A bar would be logical unit.
In your example the first c4 c c is a bar, then the next bar would be
"\gasp c4 c c" and only when the parser finished reading that it decides
that it can't make sense out of it. Just as in programming/scripting, I
always assume that the actual error is anywhere between the beginning of
the file and the quoted line number.

The parsers and compilers already need to be very very very intelligent to
deal with grammatically correct code. Imagine making a parser/compiler
which interprets 'incorrect' code... Although one might think of producing
humane error output based on a list of frequently made mistakes. For C and
other languages this is not implemented in the compiler but in code
analyzing programs like 'lint'. Maybe somebody would like to write a
'lynt'? (Although that would be a very hard job, as the lily 'language' is
still evolving and not fixed in standards).

Ciao,
David Boersma

On Tue, 25 Feb 2003, Alexandre Beneteau wrote:

> Hello,
>
> Considering this example with error a line number 6 :
>
> \header {tagline = ""}
> \score {
>    \notes \relative c {
>      \time 3/4
>        c4 c c
>        \gasp % error
>        c4 c c
>      }
> }
>
> When compiling lilypond 1.7.13 report error by printing line 5 :
>
> ly2dvi test.ly
> ly2dvi (GNU LilyPond) 1.7.13
> Running lilypond...GNU LilyPond 1.7.13
> Now processing: `test.ly'
> Parsing...
> /home/alex/documents/partitions/CNSM/Orchestration/Laboratoires/2003/test.ly:5:12:
> error: parse error, unexpected SCM_IDENTIFIER:
>        c4 c c
>
>
>
>
> ly2dvi: error: LilyPond failed on input file test (exit status 1)
> ly2dvi: warning: Running LilyPond failed. Rerun with --verbose for a trace.
> (6 of 13): 12: error: parse error, unexpected SCM_IDENTIFIER:
>
> Could someone explain how to fix it ? Thanks.
>
>       Alex.
>
>
>
> _______________________________________________
> Lilypond-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/lilypond-user
>

--
David Boersma

 /"\  ASCII ribbon campaign
 \ /  ---------------------
  X     against HTML mail
 / \      and postings





reply via email to

[Prev in Thread] Current Thread [Next in Thread]