source file of the GNU LilyPond music typesetter
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "config.hh"
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-
+#include <cctype>
+#include <cstdlib>
+#include <cstdio>
+using namespace std;
#include "book.hh"
#include "context-def.hh"
deleting them. Let's hope that a stack overflow doesnt trigger a move
of the parse stack onto the heap. */
+%left PREC_TOP
%left ADDLYRICS
+%left PREC_BOT
%union {
Book *book;
%token E_OPEN "\\("
%token E_BRACKET_CLOSE "\\]"
%token E_ANGLE_OPEN "\\<"
+%token E_PLUS "\\+"
%token E_TILDE "\\~"
%token EXTENDER "__"
-/* These used at all?
- %token FIGURE_BRACKET_CLOSE
- %token FIGURE_BRACKET_OPEN
-
-parser.yy:348.8-25: warning: symbol `"\\>"' used more than once as a literal string
-parser.yy:352.8-24: warning: symbol `"\\<"' used more than once as a literal string
+/*
+If we give names, Bison complains.
*/
%token FIGURE_CLOSE /* "\\>" */
%token FIGURE_OPEN /* "\\<" */
%token <i> E_UNSIGNED
%token <i> UNSIGNED
-%token <id> IDENTIFIER
-
+%token <scm> BOOK_IDENTIFIER
%token <scm> CHORDMODIFIER_PITCH
%token <scm> CHORD_MODIFIER
%token <scm> CONTEXT_DEF_IDENTIFIER
%token <scm> MUSIC_FUNCTION_SCM_MUSIC_MUSIC
%token <scm> MUSIC_FUNCTION_SCM_SCM
%token <scm> MUSIC_FUNCTION_SCM_SCM_MUSIC
+%token <scm> MUSIC_FUNCTION_SCM_SCM_SCM
%token <scm> MUSIC_IDENTIFIER
%token <scm> NOTENAME_PITCH
%token <scm> NUMBER_IDENTIFIER
%type <book> book_body
%type <i> bare_unsigned
-%type <i> bass_mod
+%type <i> figured_bass_alteration
%type <i> dots
%type <i> exclamations
%type <i> optional_rest
%type <scm> assignment_id
%type <scm> bare_number
%type <scm> bass_figure
-%type <scm> bass_number
+%type <scm> figured_bass_modification
%type <scm> br_bass_figure
+%type <scm> bass_number
%type <scm> chord_body_elements
%type <scm> chord_item
%type <scm> chord_items
$$ = $1->self_scm ();
$1->unprotect ();
}
+ | book_block {
+ $$ = $1->self_scm ();
+ $1->unprotect ();
+ }
| output_def {
$$ = $1->self_scm ();
$1->unprotect ();
$$->paper_->unprotect ();
$$->header_ = THIS->lexer_->lookup_identifier ("$defaultheader");
}
+ | BOOK_IDENTIFIER {
+ $$ = unsmob_book ($1);
+ $$->set_spot (@$);
+ }
| book_body paper_block {
$$->paper_ = $2;
$2->unprotect ();
| MUSIC_FUNCTION_SCM_SCM embedded_scm embedded_scm {
$$ = scm_list_4 ($1, make_input (@$), $2, $3);
}
+ | MUSIC_FUNCTION_SCM_SCM_SCM embedded_scm embedded_scm embedded_scm {
+ $$ = scm_list_5 ($1, make_input (@$), $2, $3, $4);
+ }
| MUSIC_FUNCTION_SCM_SCM_MUSIC embedded_scm embedded_scm Music {
$$ = scm_list_5 ($1, make_input (@$), $2, $3, $4->self_scm ());
}
}
| OVERRIDE simple_string embedded_scm '=' embedded_scm {
$$ = scm_list_4 (ly_symbol2scm ("push"),
- scm_string_to_symbol ($2), $3, $5);
+ scm_string_to_symbol ($2), $5, $3);
+ }
+ | OVERRIDE simple_string embedded_scm embedded_scm '=' embedded_scm {
+ $$ = scm_list_5 (ly_symbol2scm ("push"),
+ scm_string_to_symbol ($2), $6, $4, $3);
}
| REVERT simple_string embedded_scm {
$$ = scm_list_3 (ly_symbol2scm ("pop"),
music_property_def:
OVERRIDE context_prop_spec embedded_scm '=' scalar {
$$ = property_op_to_music (scm_list_4 (
- ly_symbol2scm ("poppush"),
+ ly_symbol2scm ("push"),
scm_cadr ($2),
- $3, $5));
- $$= context_spec_music (scm_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+ $5, $3));
+ $$ = context_spec_music (scm_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+ }
+ | OVERRIDE context_prop_spec embedded_scm embedded_scm '=' scalar {
+ $$ = property_op_to_music (scm_list_5 (
+ ly_symbol2scm ("push"),
+ scm_cadr ($2),
+ $6, $4, $3));
+ $$ = context_spec_music (scm_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
}
| REVERT context_prop_spec embedded_scm {
$$ = property_op_to_music (scm_list_3 (
bass_number:
DIGIT {
- $$ = scm_number_to_string (scm_from_int ($1), scm_from_int (10));
- $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
- $$);
+ $$ = scm_from_int ($1);
}
| UNSIGNED {
- $$ = scm_number_to_string (scm_from_int ($1), scm_from_int (10));
- $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
- $$);
+ $$ = scm_from_int ($1);
}
| STRING { $$ = $1; }
| full_markup { $$ = $1; }
;
-bass_mod:
+figured_bass_alteration:
'-' { $$ = -2; }
| '+' { $$ = 2; }
| '!' { $$ = 0; }
Music *bfr = MY_MAKE_MUSIC ("BassFigureEvent");
$$ = bfr->self_scm ();
- bfr->set_property ("figure", $1);
+ if (scm_is_number ($1))
+ bfr->set_property ("figure", $1);
+ else if (Text_interface::is_markup ($1))
+ bfr->set_property ("text", $1);
+
bfr->unprotect ();
}
- | bass_figure bass_mod {
+ | bass_figure ']' {
+ $$ = $1;
+ unsmob_music ($1)->set_property ("bracket-stop", SCM_BOOL_T);
+ }
+ | bass_figure figured_bass_alteration {
Music *m = unsmob_music ($1);
if ($2) {
SCM salter = m->get_property ("alteration");
m->set_property ("alteration", scm_from_int (0));
}
}
+ | bass_figure figured_bass_modification {
+ Music *m = unsmob_music ($1);
+ if ($2 == ly_symbol2scm ("plus"))
+ {
+ m->set_property ("augmented", SCM_BOOL_T);
+ }
+ else if ($2 == ly_symbol2scm ("slash"))
+ {
+ m->set_property ("diminished", SCM_BOOL_T);
+ }
+ else if ($2 == ly_symbol2scm ("exclamation"))
+ {
+ m->set_property ("no-continuation", SCM_BOOL_T);
+ }
+ }
;
-br_bass_figure:
- '[' bass_figure {
- $$ = $2;
- unsmob_music ($$)->set_property ("bracket-start", SCM_BOOL_T);
+
+figured_bass_modification:
+ E_PLUS {
+ $$ = ly_symbol2scm ("plus");
}
- | bass_figure {
- $$ = $1;
+ | E_EXCLAMATION {
+ $$ = ly_symbol2scm ("exclamation");
}
- | br_bass_figure ']' {
+ | '/' {
+ $$ = ly_symbol2scm ("slash");
+ }
+ ;
+
+br_bass_figure:
+ bass_figure {
$$ = $1;
- unsmob_music ($1)->set_property ("bracket-stop", SCM_BOOL_T);
+ }
+ | '[' bass_figure {
+ $$ = $2;
+ unsmob_music ($$)->set_property ("bracket-start", SCM_BOOL_T);
}
;
if (scm_is_string (sid)) {
*destination = sid;
return STRING_IDENTIFIER;
+ } else if (unsmob_book (sid)) {
+ *destination = unsmob_book (sid)->clone ()->self_scm ();
+ return BOOK_IDENTIFIER;
} else if (scm_is_number (sid)) {
*destination = sid;
return NUMBER_IDENTIFIER;
SCM symbol = scm_cadr (op);
SCM args = scm_cddr (op);
SCM grob_val = SCM_UNDEFINED;
- SCM grob_sym = SCM_UNDEFINED;
+ SCM grob_path = SCM_UNDEFINED;
SCM val = SCM_UNDEFINED;
if (tag == ly_symbol2scm ("assign"))
}
else if (tag == ly_symbol2scm ("unset"))
m = MY_MAKE_MUSIC ("PropertyUnset");
- else if (tag == ly_symbol2scm ("poppush")
- || tag == ly_symbol2scm ("push"))
+ else if (tag == ly_symbol2scm ("push"))
{
m = MY_MAKE_MUSIC ("OverrideProperty");
- grob_sym = scm_car (args);
- grob_val = scm_cadr (args);
+ grob_val = scm_car (args);
+ grob_path = scm_cdr (args);
+ m->set_property ("pop-first", SCM_BOOL_T);
}
else if (tag == ly_symbol2scm ("pop")) {
m = MY_MAKE_MUSIC ("RevertProperty");
- grob_sym = scm_car (args);
+ grob_path = args;
}
m->set_property ("symbol", symbol);
m->set_property ("value", val);
if (grob_val != SCM_UNDEFINED)
m->set_property ("grob-value", grob_val);
-
- if (grob_sym != SCM_UNDEFINED)
- {
- bool itc = do_internal_type_checking_global;
- /* UGH.
- */
- bool autobeam = ly_is_equal (symbol, ly_symbol2scm ("autoBeamSettings"));
- if (autobeam)
- do_internal_type_checking_global = false;
- m->set_property ("grob-property", grob_sym);
- if (autobeam)
- do_internal_type_checking_global = itc;
- }
-
- if (tag == ly_symbol2scm ("poppush"))
- m->set_property ("pop-first", SCM_BOOL_T);
-
+ if (grob_path != SCM_UNDEFINED)
+ m->set_property ("grob-property-path", grob_path);
return m;
}