Re: cannot run ../.ly file which includes another file

2018-04-14 Thread Malte Meyn



Am 13.04.2018 um 21:22 schrieb Federico Bruni:

I don't think this is the problem you think it is. It's actually

myMusic = \relative c' { c4 d e f | } \myMusic

where the definition of myMusic tries to eat itself.



Doh, I forgot the basics. Thanks David.
I've now moved \myMusic into a \score block and it works.


You don’t even need a score block but *something* that isn’t \myMusic. I 
use #'() for this:



myMusic = \relative c { c4 d e f | }
#'()
\myMusic

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: cannot run ../.ly file which includes another file

2018-04-13 Thread David Kastrup
David Wright  writes:

> I don't think this is the problem you think it is. It's actually
>
> myMusic = \relative c' { c4 d e f | } \myMusic
>
> where the definition of myMusic tries to eat itself.

Not really.  The parser wants to know from the lexer whether something
like \addlyrics is after the closing brace before committing to an
assignment.  And the lexer decides about what kind of token \myMusic is
after looking at the type of myMusic.  Which isn't defined yet.

It could just say "it's not \addlyrics, I can tell you as much as that"
but when splitting information into two such pieces, it becomes two
tokens, and the parser has a number of points where it needs one token
of lookahead to make decisions, and when that token is just "it's not
\addlyrics", this is not enough.

So no: the definition of myMusic would not need to eat itself, but
parser and lexer's information exchange somehow causes this hen-and-egg
problem that logic would not require.

In short: technical reasons.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: cannot run ../.ly file which includes another file

2018-04-13 Thread Federico Bruni



Il giorno ven 13 apr 2018 alle 20:28, David Wright 
 ha scritto:

On Fri 13 Apr 2018 at 19:01:27 (+0200), Federico Bruni wrote:

 Hi all

 Can anybody tell me what's wrong with this minimal example?
 I would expect the included file to be relative to the location of
 the file which includes it, not to the current working directory.
 What do you think?
 The only workaround is using the --include option?

 [build (master *+)]$ cat ../song.ily
 \version "2.19.0"

 myMusic = \relative c' {
  c4 d e f |
 }

 [build (master *+)]$
 [build (master *+)]$ cat ../song.ly
 \version "2.19.0"
 \include "./song.ily"

 \myMusic

 [build (master *+)]$ lilypond ../song.ly
 GNU LilyPond 2.19.81
 Processing `../song.ly'
 Parsing...
 ../song.ly:4:1: error: unknown escaped string: `\myMusic'

 \myMusic
 ../song.ly:4:9: error: syntax error, unexpected end of input,
 expecting '.' or '=' or ','
 \myMusic

 fatal error: failed files: "../song.ly"


I don't think this is the problem you think it is. It's actually

myMusic = \relative c' { c4 d e f | } \myMusic

where the definition of myMusic tries to eat itself.



Doh, I forgot the basics. Thanks David.
I've now moved \myMusic into a \score block and it works.





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: cannot run ../.ly file which includes another file

2018-04-13 Thread David Wright
On Fri 13 Apr 2018 at 19:01:27 (+0200), Federico Bruni wrote:
> Hi all
> 
> Can anybody tell me what's wrong with this minimal example?
> I would expect the included file to be relative to the location of
> the file which includes it, not to the current working directory.
> What do you think?
> The only workaround is using the --include option?
> 
> [build (master *+)]$ cat ../song.ily
> \version "2.19.0"
> 
> myMusic = \relative c' {
>  c4 d e f |
> }
> 
> [build (master *+)]$
> [build (master *+)]$ cat ../song.ly
> \version "2.19.0"
> \include "./song.ily"
> 
> \myMusic
> 
> [build (master *+)]$ lilypond ../song.ly
> GNU LilyPond 2.19.81
> Processing `../song.ly'
> Parsing...
> ../song.ly:4:1: error: unknown escaped string: `\myMusic'
> 
> \myMusic
> ../song.ly:4:9: error: syntax error, unexpected end of input,
> expecting '.' or '=' or ','
> \myMusic
> 
> fatal error: failed files: "../song.ly"

I don't think this is the problem you think it is. It's actually

myMusic = \relative c' { c4 d e f | } \myMusic

where the definition of myMusic tries to eat itself.

Cheers,
David.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user