''!c8.-"text"_v
+and in lyricmode, eg,
+
+ Twink- le, twink- le litt- le star,2
+
a lot of characters parse differently
than in "command" mode, eg,
identifier = score { .. }
So you have to signal that to the tokenizer. This is done with
-'$'. '$' is a delimiter, which used by the tokenizer only.
+'$'. '$' is a delimiter, which used by the tokenizer only. The same
+goes for lyrics, it has a '@' delimiter.
=item *
musicmode: The brace still is used to group grammatical groups.
--- /dev/null
+//
+// lyricitem.hh -- part of LilyPond
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+
+#ifndef LYRIC_ITEM_HH
+#define LYRIC_ITEM_HH
+
+#include "textitem.hh"
+
+struct Lyric_item : Text_item {
+ /****************/
+ Lyric_item(Lyric_req* lreq_l, int voice_count_i);
+ virtual void do_pre_processing();
+};
+
+
+#endif // LYRICITEM_HH
+
Staff * get_new_rhythmstaff();
Voice_element * get_note_element(String,int * ,int *);
Voice_element* get_rest_element(String,int *);
+Voice_element* get_word_element(Text_def*, int*);
Staff * get_new_melodicstaff();
+Staff * get_new_lyricstaff();
void add_requests( Voice_element*v, Array<Request*>&req);
Request* get_request(char);
void set_text_style(String);
Text_def*get_text(String s);
Request*get_script_req(int d , Script_def*def);
Request*get_text_req(int d , Text_def*def);
-
-
+Voice_element*get_command_element(Input_command*);
+Voice_element*get_barcheck_element();
#endif // PARSECONSTRUCT_HH
*/
#include "compare.hh"
-instantiate_compare(const PCol &, PCol::compare);
+instantiate_compare(PCol &, PCol::compare);
#endif
}
Symbol
-Lookup::text( String style, String text , int dir)
+Lookup::text(String style, String text, int dir)
{
Array<String> a;
{
return (*symtables_)("rests")->lookup(String(j));
}
+
Symbol
Lookup::fill(Box b)
{
s.dim = b;
return s;
}
+
Symbol
Lookup::accidental(int j)
{
{
Symbol s;
s.dim.x = Interval(0,wid);
- Real dy=(lines-1)*internote()*2;
+ Real dy = (lines >0) ? (lines-1)*internote()*2 : 0;
s.dim.y = Interval(0,dy);
Array<String> a;
s.tex = (*symtables_)("param")->lookup("linestaf").tex;
s.tex = substitute_args(s.tex, a);
-
+
return s;
}
--- /dev/null
+#include "request.hh"
+#include "paper.hh"
+#include "lyricitem.hh"
+#include "stem.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+#include "textdef.hh"
+
+Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i)
+ : Text_item(lreq_l,0)
+{
+ pos_i_ = voice_count_i * -4 ; // fontsize dependant. TODO
+ dir_i_ = -1;
+}
+
+void
+Lyric_item::do_pre_processing()
+{
+ // override Text_item
+}
}
%token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT
-%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
+%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
%token KEY CLEF VIOLIN BASS MULTI TABLE CHORD VOICES
-%token PARTIAL RHYTHMIC MELODIC MUSIC GROUPING CADENZA
+%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA
%token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
%token MARK GOTO
%type <real> dim
%type <ii> duration
%type <moment> duration_length
-%type <el> voice_elt full_element
-%type <command> score_command staff_command skipcommand
+%type <el> voice_elt full_element lyrics_elt
+%type <command> score_command staff_command position_command
%type <score> score_block score_body
%type <staff> staff_block staff_init staff_body
%type <i> int
%type <music> music
%type <chord> music_chord music_chord_body
-%type <mvoice> music_voice_body music_voice
+%type <mvoice> music_voice_body music_voice
%type <interval> dinterval
%type <box> box
| score_commands_body score_command {
$$->add($2);
}
+ | score_commands_body position_command {
+ $$->add($2);
+ }
;
staff_commands_block: COMMANDS '{' staff_commands_body '}' {
| staff_commands_body staff_command {
$$->add($2);
}
+ | staff_commands_body position_command {
+ $$->add($2);
+ }
;
staff_command:
- skipcommand
- | KEY pitch_list {/*UGH*/
+ KEY pitch_list {/*UGH*/
$$ = get_key_interpret_command(*$2);
delete $2;
}
}
;
-skipcommand:
+position_command:
SKIP int ':' duration_length {
$$ = get_skip_command($2, *$4);
delete $4;
$$ = get_goto_command(*$2);
delete $2;
}
+ ;
score_command:
- skipcommand
- | BAR STRING {
+ BAR STRING {
$$ = get_bar_command(*$2);
delete $2;
}
| MELODIC {
$$ = new Input_staff( "melodic");
}
+ | LYRIC {
+ $$ = new Input_staff( "lyric");
+ }
;
staff_body:
}
;
-
music_chord: '{' music_chord_body '}' { $$ = $2; }
;
add_requests($2, post_reqs);
$$ = $2;
}
+ | MARK STRING {
+ $$ = get_mark_element(*$2);
+ delete $2;
+ }
+ | COMMAND '{' staff_command '}' { $$=get_command_element($3); }
+ | COMMAND '{' score_command '}' { $$=get_command_element($3); }
+ | '|' { $$ = get_barcheck_element(); }
+ | lyrics_elt
;
-
+
post_requests:
{
assert(post_reqs.empty());
;
open_request_parens:
- '|' {$$='|'}
- |')' {$$=')'}
+ ')' {$$=')'}
|'[' {$$='['}
;
delete $1;
}
- | MARK STRING {
- $$ = get_mark_element(*$2);
- delete $2;
- }
;
+lyrics_elt:
+ mudela_text duration {
+ $$ = get_word_element($1, $2);
+ };
+
/*
UTILITIES
*/
*mlog << "Parsing ... ";
#ifdef YYDEBUG
- yydebug = !monitor.silence("Parser") && check_debug;
+ yydebug = !monitor.silence("InitParser") && check_debug;
#endif
set_lexer();
lexer->new_input("symbol.ini");
yyparse();
+
+#ifdef YYDEBUG
+ yydebug = !monitor.silence("Parser") && check_debug;
+#endif
+
lexer->new_input(s);
yyparse();
kill_lexer();
return new Paperdef(
lexer->lookup_identifier("default_table")->lookup(true));
}
+
+
}
Molecule*
-Slur::brew_molecule() const
+Slur::brew_molecule_p() const
{
Molecule*output = new Molecule;
if (!rnote_p->extremal)
right_off+= Offset(-0.5, -dir);
- int dy = right_off.y - left_off.y;
+ int dy = int(right_off.y - left_off.y);
Real nw_f = paper()->note_width();
Real nh_f = paper()->internote();
Text_def::Text_def()
{
- align = 1; // right
- style = "roman";
+ align_i_ = 1; // right
+ style_str_ = "roman";
}
Atom
-Text_def::create(Paperdef*p) const
+Text_def::create_atom(Paperdef*p) const
{
- return p->lookup_p_->text(style, text, -align);
+ return p->lookup_p_->text(style_str_, text_str_, -align_i_);
}
void
Text_def::print() const
{
- mtor << "Text `" << text << "\', style " <<
- style << "align " <<align<<'\n';
+ mtor << "Text `" << text_str_ << "\', style " <<
+ style_str_ << "align " << align_i_ << '\n';
}