On Wednesday, 29 September 1999, "Shamus" writes:
> I was looking at the parser.yy code and I still can't figure out how things
> like the 'maj' string in a given input (as a part of 'c-maj' e.g.) get
> translated into the parameter list for the Chord::Chord constructor (with
Not so hard if you know how it works: A chord modifier is a string that
appears in the \chordmodifiers block (ly/chord-modifiers.ly). It
translates to a pitch; m and min translate to e-flat.
When building the chord, the pitch that results from a modifier is simply
added to the list of additions. Then, in the Chord::Chord constructor,
some magic goes on, eg:
* if there are no additions, add third and fifth: c -> c e g
* if a third is added, be it e, e-sharp, or e-flat, don't add an
extra third: c-min -> c es g
etc.
> the parameter list Musical_pitch, Array<Musical_pitch>,
> Array<Musical_pitch>, Musical_pitch). I was thinking that for now, I could
> get chord labels into the constructor by using all text names (although
> having numbers in there would be a shorter, and more useful). For example,
> Cmaj7 could be written (as mudela) as c-majseven, Cmaj6 as c-majsix, Cm as
> c-min, Caug as c-aug, etc... Whaddya think? Is there any way to get those
Why? The maj may be a problem (what is maysix?). But c-aug is really
the same as c-5+, so why not have aug mean 5+?
> text labels (or, barring that, tokens) into the constructor?
>
> BTW, I like the idea of using a colon as a separator, if a separator has to
> be there...
We *must* have a separator. Look at the lexer: it looks for strings, and
then checks whether it's a note name (c, cis, Cisis, ..), or a modifier.
If not, it returns a string to the parser. 'Cmaj6' looks as the string
'Cmaj' and the digit 6.
Jan.
--
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien/ | http://www.lilypond.org/