lilypond-user
[Top][All Lists]
Advanced

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

Re: warning for duplicate definitions


From: David Kastrup
Subject: Re: warning for duplicate definitions
Date: Fri, 08 Jan 2016 16:09:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Mike Solomon <address@hidden> writes:

> Hey all,
>
> I’m combining several documents into a large book tonight and I am
> positive that I have:
>
> legato = \markup \italic “legato”
>
> in at least 10 documents.  I’d like to consolidate these into a style
> sheet but I’m worried that I’ll miss some, so it’d be useful to issue
> a warning for duplicate definitions in case I miss some.  Is this
> possible?

Not really.  In lily/parser.yy I see

assignment:
        assignment_id '=' identifier_init  {
                parser->lexer_->set_identifier ($1, $3);
                $$ = SCM_UNSPECIFIED;
        }
        | assignment_id property_path '=' identifier_init {
                SCM path = scm_cons (scm_string_to_symbol ($1), $2);
                parser->lexer_->set_identifier (path, $4);
                $$ = SCM_UNSPECIFIED;
        }
        | assignment_id '.' property_path '=' identifier_init {
                SCM path = scm_cons (scm_string_to_symbol ($1), $3);
                parser->lexer_->set_identifier (path, $5);
                $$ = SCM_UNSPECIFIED;
        }
        ;

Either hook into the first of those syntax rules, checking for the
existence of the identifier before setting it, or hook into
Lily_lexer::set_identifier itself.

Expect lots of false positives from LilyPond itself...

-- 
David Kastrup



reply via email to

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