From: fred Date: Sun, 24 Mar 2002 19:54:21 +0000 (+0000) Subject: lilypond-0.1.9 X-Git-Tag: release/1.5.59~4084 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=fd0213b35e2a538c6dda7cd488c8ed7bc264d4f5;p=lilypond.git lilypond-0.1.9 --- diff --git a/init/symbol.ly b/init/symbol.ly index 8d84256d94..65bced4151 100644 --- a/init/symbol.ly +++ b/init/symbol.ly @@ -1,7 +1,12 @@ \version "0.1.1"; +breve = \duration { -1 0 } +longa = \duration { -2 0 } + \include "dynamic.ly" \include "dutch.ly" + + \include "script.ly" \include "paper16.ly" diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index 828796f9d0..4e75271f8f 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -1,22 +1,23 @@ -%{MudelaHeader +\header{ - filename: toccata-fuga-E.ly - title: toccata and fuga in E-major - opus: BWV 566 - toccata: 3 bar excerpt - 2nd fuga: transposed subject --- 4 bar excerpt +filename toccata-fuga-E.ly +title toccata and fuga in E-major +opus BWV 566 + toccata 3 bar excerpt + 2nd fuga transposed subject --- 4 bar excerpt - composers: Johann Sebastian Bach (1685-1750) - entered-by: JCN - copyright: public domain +composers Johann Sebastian Bach (1685-1750) +enteredby JCN +copyright public domain +} + +%{ Tested Features: purpose of this file is testing: * real-life collisions * multi-voice input --- splitting? * organ staff... - -EndMudelaHeader %} diff --git a/lily/lexer.l b/lily/lexer.l index 0372e75e98..8e702b7c79 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -22,6 +22,7 @@ #include +#include #include "string.hh" #include "string-convert.hh" @@ -32,6 +33,9 @@ #include "parseconstruct.hh" #include "main.hh" #include "identifier.hh" +void strip_trailing_white(String&); +void strip_leading_white(String&); + #define start_quote() \ yy_push_state(quote);\ @@ -52,6 +56,7 @@ %option warn %x incl +%x header %x lyrics %x notes %x quote @@ -73,6 +78,7 @@ INT -?{N}+ REAL ({INT}\.{N}*)|(-?\.{N}+) KEYWORD \\{WORD} WHITE [ \n\t\f] +HORIZONTALWHITE [ \t] BLACK [^ \n\t\f] RESTNAME [rs] NOTECOMMAND \\{A}+ @@ -94,7 +100,7 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* %[^{\n].* { } {WHITE}+ { - + } } @@ -107,13 +113,37 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* "%"+"}" { yy_pop_state(); } + <> { + LexerError("EOF found inside a comment"); + if (! close_input()) + yyterminate(); // can't move this, since it actually rets a YY_NULL + } } -<> { - LexerError("EOF found inside a comment"); - if (! close_input()) { - yyterminate(); // can't move this, since it actually rets a YY_NULL +
{ + [\{\}] { + return YYText()[0]; + } + ^{WORD} { + String s=YYText(); + yylval.string = new String(s); + return FIELDNAME; + } + {HORIZONTALWHITE}+{BLACK}.*\n { + String s=YYText(); + strip_leading_white(s); + strip_trailing_white(s); + yylval.string = new String(s); + return RECORDLINE; + } + {WHITE}* { + } + + . { + return YYText()[0]; } } + + \\include { yy_push_state(incl); } @@ -375,3 +405,29 @@ My_lily_lexer::lyric_state_b() const { return YY_START == lyrics; } + +void +My_lily_lexer::push_header_state() +{ + yy_push_state(header); +} + +void strip_trailing_white(String&s) +{ + int i=0; + for (; i < s.length_i(); i++) + if (!isspace(s[i])) + break; + + s = s.nomid_str(0, i); +} +void strip_leading_white(String&s) +{ + int i=s.length_i(); + while (i--) + if (!isspace(s[i])) + break; + + s = s.left_str(i+1); + +} diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 1160b86af1..857d364ede 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -21,120 +21,128 @@ #include "parseconstruct.hh" static Keyword_ent the_key_tab[]={ - {"accepts", ACCEPTS}, - {"alias", ALIAS}, - {"bar", BAR}, - {"cadenza", CADENZA}, - {"clear", CLEAR}, - {"clef", CLEF}, - {"cm", CM_T}, - {"consists", CONSISTS}, - {"contains", CONTAINS}, - {"duration", DURATIONCOMMAND}, - {"absdynamic", ABSDYNAMIC}, - {"group", GROUP}, - {"hshift", HSHIFT}, - {"id", ID}, - {"in", IN_T}, - {"requesttranslator", REQUESTTRANSLATOR}, - {"lyric", LYRIC}, - {"key", KEY}, - {"melodic" , MELODIC}, - {"melodic_request", MELODIC_REQUEST}, - {"meter", METER}, - {"midi", MIDI}, - {"mm", MM_T}, - {"multi", MULTI}, - {"notenames", NOTENAMES}, - {"octave", OCTAVECOMMAND}, - {"output", OUTPUT}, - {"partial", PARTIAL}, - {"paper", PAPER}, - {"plet", PLET}, - {"pt", PT_T}, - {"score", SCORE}, - {"script", SCRIPT}, - {"skip", SKIP}, - {"staff", STAFF}, - {"stem", STEM}, - {"table", TABLE}, - {"spandynamic", SPANDYNAMIC}, - {"symboltables", SYMBOLTABLES}, - {"tempo", TEMPO}, - {"texid", TEXID}, - {"textstyle", TEXTSTYLE}, - {"transpose", TRANSPOSE}, - {"version", VERSION}, - {"grouping", GROUPING}, - {0,0} + {"accepts", ACCEPTS}, + {"alias", ALIAS}, + {"bar", BAR}, + {"cadenza", CADENZA}, + {"clear", CLEAR}, + {"clef", CLEF}, + {"cm", CM_T}, + {"consists", CONSISTS}, + {"contains", CONTAINS}, + {"duration", DURATION}, + {"absdynamic", ABSDYNAMIC}, + {"group", GROUP}, + {"hshift", HSHIFT}, + {"id", ID}, + {"in", IN_T}, + {"requesttranslator", REQUESTTRANSLATOR}, + {"lyric", LYRIC}, + {"key", KEY}, + {"melodic" , MELODIC}, + {"melodic_request", MELODIC_REQUEST}, + {"meter", METER}, + {"midi", MIDI}, + {"mm", MM_T}, + {"multi", MULTI}, + {"header", HEADER}, + {"notenames", NOTENAMES}, + {"octave", OCTAVE}, + {"output", OUTPUT}, + {"partial", PARTIAL}, + {"paper", PAPER}, + {"plet", PLET}, + {"pt", PT_T}, + {"score", SCORE}, + {"script", SCRIPT}, + {"skip", SKIP}, + {"staff", STAFF}, + {"stem", STEM}, + {"table", TABLE}, + {"spandynamic", SPANDYNAMIC}, + {"symboltables", SYMBOLTABLES}, + {"tempo", TEMPO}, + {"texid", TEXID}, + {"textstyle", TEXTSTYLE}, + {"transpose", TRANSPOSE}, + {"version", VERSION}, + {"grouping", GROUPING}, + {0,0} }; My_lily_lexer::My_lily_lexer() { - keytable_p_ = new Keyword_table (the_key_tab); - identifier_assoc_p_ = new Assoc; - errorlevel_i_ = 0; - post_quotes_b_ = false; - note_tab_p_ = new Notename_table; + keytable_p_ = new Keyword_table (the_key_tab); + identifier_assoc_p_ = new Assoc; + errorlevel_i_ = 0; + post_quotes_b_ = false; + note_tab_p_ = new Notename_table; } int My_lily_lexer::lookup_keyword (String s) { - return keytable_p_->lookup (s); + return keytable_p_->lookup (s); } Identifier* My_lily_lexer::lookup_identifier (String s) { - if (!identifier_assoc_p_->elt_b (s)) + if (!identifier_assoc_p_->elt_b (s)) return 0; - - return (*identifier_assoc_p_)[s]; + + return (*identifier_assoc_p_)[s]; } void My_lily_lexer::set_identifier (String name_str, Identifier*i) { - Identifier *old = lookup_identifier (name_str); - if (old) { + Identifier *old = lookup_identifier (name_str); + if (old) + { old->warning( "redeclaration of \\" + name_str); delete old; } - (*identifier_assoc_p_)[name_str] = i; + (*identifier_assoc_p_)[name_str] = i; } My_lily_lexer::~My_lily_lexer() { - delete keytable_p_; + delete keytable_p_; - for (Assoc_iter - ai (*identifier_assoc_p_); ai.ok(); ai++) { + for (Assoc_iter + ai (*identifier_assoc_p_); ai.ok(); ai++) + { DOUT << "deleting: " << ai.key()<<'\n'; delete ai.val(); } - delete note_tab_p_; - delete identifier_assoc_p_; + delete note_tab_p_; + delete identifier_assoc_p_; } void My_lily_lexer::print_declarations (bool init_b)const { - for (Assoc_iter ai (*identifier_assoc_p_); ai.ok(); - ai++) { - if (ai.val()->init_b_ == init_b) { + for (Assoc_iter ai (*identifier_assoc_p_); ai.ok(); + ai++) + { + if (ai.val()->init_b_ == init_b) + { DOUT << ai.key() << '='; ai.val()->print (); - } + } } } void My_lily_lexer::LexerError (char const *s) { - if (include_stack_.empty()) { + if (include_stack_.empty()) + { *mlog << "error at EOF" << s << '\n'; - } else { + } + else + { errorlevel_i_ |= 1; Input spot (source_file_l(),here_ch_C()); @@ -146,18 +154,18 @@ My_lily_lexer::LexerError (char const *s) Melodic_req* My_lily_lexer::lookup_melodic_req_l (String s) { - return note_tab_p_->get_l (s); + return note_tab_p_->get_l (s); } void My_lily_lexer::add_notename (String s, Melodic_req *p) { - note_tab_p_->add (s,p); + note_tab_p_->add (s,p); } void My_lily_lexer::clear_notenames() { - delete note_tab_p_; - note_tab_p_ = new Notename_table; + delete note_tab_p_; + note_tab_p_ = new Notename_table; } diff --git a/lily/parser.y b/lily/parser.y index 8722ffb133..b72857d0d2 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,7 +1,7 @@ %{ // -*-Fundamental-*- /* - parser.y -- lily parser + parser.y -- YACC parser for mudela source file of the GNU LilyPond music typesetter @@ -34,6 +34,8 @@ #include "input-translator.hh" #include "score.hh" #include "music-list.hh" +#include "header.hh" +#include "duration-convert.hh" #ifndef NDEBUG #define YYDEBUG 1 @@ -62,6 +64,7 @@ Music *music; Music_list *musiclist; Score *score; + Header *header; Interval *interval; Lookup*lookup; Melodic_req * melreq; @@ -111,13 +114,14 @@ yylex(YYSTYPE *s, void * v_l) %token CONSISTS %token ACCEPTS %token CM_T -%token DURATIONCOMMAND +%token DURATION %token ABSDYNAMIC %token END %token GROUPING %token GROUP %token REQUESTTRANSLATOR %token HSHIFT +%token HEADER %token IN_T %token ID %token LYRIC @@ -129,7 +133,7 @@ yylex(YYSTYPE *s, void * v_l) %token MM_T %token MULTI %token NOTENAMES -%token OCTAVECOMMAND +%token OCTAVE %token OUTPUT %token PAPER %token PARTIAL @@ -157,6 +161,7 @@ yylex(YYSTYPE *s, void * v_l) %type dots %token INT %token NOTENAME_ID +%token DURATION_IDENTIFIER %token IDENTIFIER %token MELODIC_REQUEST_IDENTIFIER %token MUSIC_IDENTIFIER @@ -173,11 +178,13 @@ yylex(YYSTYPE *s, void * v_l) %token REQUEST_IDENTIFIER %token REAL %token DURATION RESTNAME -%token STRING +%token STRING +%token FIELDNAME RECORDLINE %token POST_QUOTES %token PRE_QUOTES +%type
mudela_header mudela_header_body %type box %type open_request_parens close_request_parens %type open_plet_parens close_plet_parens @@ -185,7 +192,8 @@ yylex(YYSTYPE *s, void * v_l) %type int %type script_dir %type identifier_init -%type explicit_duration notemode_duration entered_notemode_duration +%type explicit_steno_duration notemode_duration +%type entered_notemode_duration explicit_duration %type dinterval %type intastint_list %type symtables symtables_body @@ -201,7 +209,8 @@ yylex(YYSTYPE *s, void * v_l) %type paper_block paper_body %type dim real %type unit -%type post_request pre_request command_req verbose_command_req abbrev_command_req +%type post_request pre_request command_req verbose_command_req +%type abbrev_command_req %type script_req dynamic_req %type score_block score_body %type