]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
* lily/parser.yy (relative_music): whoops. All \relative were off
[lilypond.git] / lily / parser.yy
index 9059bd8700ce312129d2b93e6df81d4ba47f62e3..33ac19f461abfb623b859717d43b08ef99c45ff9 100644 (file)
@@ -50,7 +50,7 @@ TODO:
 #include <stdlib.h>
 
 
-
+#include "scm-option.hh"
 #include "translator-def.hh"
 #include "lily-guile.hh"
 #include "misc.hh"
@@ -210,72 +210,73 @@ yylex (YYSTYPE *s,  void * v)
 
 %pure_parser
 
-/* tokens which are not keywords */
-%token AUTOCHANGE
+
+%token ACCEPTS
+%token ADDLYRICS
 %token ALIAS
+%token ALTERNATIVE
+%token APPLY
 %token APPLYCONTEXT
 %token APPLYOUTPUT
-%token APPLY
-%token ACCEPTS
-%token ALTERNATIVE
+%token AUTOCHANGE
 %token BAR
 %token BREATHE
 %token CHORDMODIFIERS  
 %token CHORDS
+%token CHORD_CLOSE
+%token CHORD_OPEN
 %token CLEF
+%token COMMANDSPANREQUEST
 %token CONSISTS
-%token DURATION
-%token SEQUENTIAL
-%token GROBDESCRIPTIONS
-%token SIMULTANEOUS
 %token CONSISTSEND
+%token CONTEXT
+%token DEFAULT
 %token DENIES
 %token DESCRIPTION
+%token DURATION
 %token EXTENDER
 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
 %token GRACE 
+%token GROBDESCRIPTIONS
 %token HEADER
 %token HYPHEN
 %token INVALID
 %token KEY
 %token LYRICS
 %token MARK
-%token MULTI_MEASURE_REST
 %token MIDI
-%token PITCH
-%token DEFAULT
+%token MULTI_MEASURE_REST
 %token NAME
-%token PITCHNAMES
+%token NEWCONTEXT
 %token NOTES
+%token OCTAVE
 %token ONCE
+%token OUTPUTPROPERTY
+%token OVERRIDE SET REVERT 
 %token PAPER
+%token PARTCOMBINE
 %token PARTIAL
+%token PITCH
+%token PITCHNAMES
 %token PROPERTY
-%token OVERRIDE SET REVERT 
 %token RELATIVE
 %token REMOVE
 %token REPEAT
-%token ADDLYRICS
-%token PARTCOMBINE
+%token REST
 %token SCM_T
 %token SCORE
+%token SEQUENTIAL
+%token SIMULTANEOUS
 %token SKIP
 %token SPANREQUEST
-%token COMMANDSPANREQUEST
 %token TEMPO
-%token OUTPUTPROPERTY
-%token TIME_T
 %token TIMES
+%token TIME_T
 %token TRANSLATOR
 %token TRANSPOSE
 %token TYPE
 %token UNSET
-%token CONTEXT
-%token REST
-
-%token CHORD_OPEN
-%token CHORD_CLOSE
 
 
 /* escaped */
@@ -966,6 +967,21 @@ Composite_music:
 
                $$ = csm;
        }
+       | NEWCONTEXT string Music {
+               static int new_context_count;
+
+               Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
+
+               csm->set_mus_property ("element", $3->self_scm ());
+               scm_gc_unprotect_object ($3->self_scm ());
+
+               csm->set_mus_property ("context-type", $2);
+
+               SCM new_id = scm_number_to_string (gh_int2scm (new_context_count ++),
+                                       gh_int2scm (10));
+               csm->set_mus_property ("context-id", new_id);
+               $$ = csm;
+       }
        | TIMES {
                THIS->push_spot ();
        }
@@ -1061,9 +1077,9 @@ relative_music:
                scm_gc_unprotect_object (p->self_scm ());
 
 
+               Pitch retpitch = p->to_relative_octave (pit);
                if (lily_1_8_relative)
-                       $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
-
+                       $$->set_mus_property ("last-pitch", retpitch.smobbed_copy ());
        }
        ;
 
@@ -1314,11 +1330,18 @@ command_element:
        command_req {
                $$ = MY_MAKE_MUSIC("EventChord");
                $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
-         scm_gc_unprotect_object ($1->self_scm());
+               scm_gc_unprotect_object ($1->self_scm());
 
                $$-> set_spot (THIS->here_input ());
                $1-> set_spot (THIS->here_input ());
        }
+       | OCTAVE { THIS->push_spot (); }
+         pitch {
+               Music *l = MY_MAKE_MUSIC("RelativeOctaveCheck");
+               $$ = l;
+               $$->set_spot (THIS->pop_spot ());
+               $$->set_mus_property ("pitch", $3);
+       }
        | E_LEFTSQUARE {
                Music *l = MY_MAKE_MUSIC("LigatureEvent");
                l->set_mus_property ("span-direction", gh_int2scm (START));
@@ -1501,19 +1524,19 @@ configurable, i.e.
 (set-articulation '~ "trill")
 
 */
-               Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
+               Music * m = MY_MAKE_MUSIC ("BeamEvent");
                m->set_spot (THIS->here_input());
                m->set_mus_property ("span-direction" , gh_int2scm (START));
                $$ = m;
        }
        | ']'  {
-               Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
+               Music * m = MY_MAKE_MUSIC ("BeamEvent");
                m->set_spot (THIS->here_input());
                m->set_mus_property ("span-direction" , gh_int2scm (STOP));
                $$ = m;
        }
        | '~' {
-               Music * m = MY_MAKE_MUSIC ("NewTieEvent");
+               Music * m = MY_MAKE_MUSIC ("TieEvent");
                m->set_spot (THIS->here_input());
                $$ = m;
        }
@@ -2320,13 +2343,6 @@ My_lily_parser::beam_check (SCM dur)
 
 
 
-bool
-markup_p (SCM x)
-{
-       return gh_pair_p (x)
-               && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"));
-}
-
 
 /*
 
@@ -2365,7 +2381,7 @@ My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
 
                *destination = p->self_scm();
                return MUSIC_OUTPUT_DEF_IDENTIFIER;
-       } else if (new_markup_p (sid)) {
+       } else if (Text_item::markup_p (sid)) {
                *destination = sid;
                return MARKUP_IDENTIFIER;
        }