]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.49
authorfred <fred>
Sun, 24 Mar 2002 19:38:36 +0000 (19:38 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:38:36 +0000 (19:38 +0000)
lily/include/my-lily-lexer.hh
lily/include/my-lily-parser.hh
lily/my-lily-parser.cc

index 8dbc42e8614818a6307dbedf3259b764675aee44..f69b7e0fb4f2feeda5da61730a37e144afca04db 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <FlexLexer.h>
 
+#include "lily-proto.hh"
 #include "proto.hh"
 #include "fproto.hh"
 #include "varray.hh"
@@ -26,23 +27,23 @@ void set_lexer();
 /// lexer for Mudela
 class My_lily_lexer : public Includable_lexer {
     int lookup_keyword(String);
-    void lookup_notename(int &large, int &small, String s);
     int scan_bare_word(String);
     int scan_escaped_word(String);
 
     bool post_quotes_b_;
 public:
-   void * lexval_l;
-    
+    void * lexval_l;
     
+    Notename_table  *note_tab_p_;
     Assoc<String, Identifier*> *identifier_assoc_p_;
     Keyword_table * keytable_p_;
     int errorlevel_i_;
 
     /* *************** */
 
+    void clear_notenames();
     Identifier*lookup_identifier(String s);
+    Melodic_req* lookup_melodic_req_l(String s);
     void push_note_state();
     void push_lyric_state();
     void pop_state();
@@ -52,7 +53,7 @@ public:
     ~My_lily_lexer();
     int yylex();
     void print_declarations(bool init_b) const;
-
+    void add_notename(String, Melodic_req*);
     bool note_state_b() const;
     bool lyric_state_b() const;
 };
index 2eef0929a4cd508ec55d1bd0cbd11bcb39494b1f..1da7940b692ef945eed776b67a0858fff1d15e6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  my-lily-parser.hh -- declare 
+  my-lily-parser.hh -- declare My_lily_parser
 
   source file of the LilyPond music typesetter
 
@@ -32,15 +32,13 @@ class My_lily_parser {
     Voice_element* get_word_element(Text_def*, Duration*);
     void set_last_duration(Duration const *);
     void set_duration_mode(String s);
-public:
     friend int yyparse( void*);
-   
+public:
     int default_octave_i_;
     Duration default_duration_;
     String textstyle_str_;
     
     bool last_duration_mode ;
-
     Array<Request*> pre_reqs, post_reqs;
     int fatal_error_i_;
     Sources * source_l_;
@@ -49,6 +47,7 @@ public:
     My_lily_lexer * lexer_p_;
  
     Moment plet_mom();
+    void add_notename(String, Melodic_req* req_p);
     Input here_input()const;
     void remember_spot();
     Input pop_spot();
@@ -56,6 +55,7 @@ public:
     Paper_def*default_paper();
     void do_yyparse();
     void parser_error(String);
+    void clear_notenames();
 
     Request* get_parens_request(char c);
     
index 0463a9d07739e7d393a7a43f945bc805b25d5a32..b46d6dd1a0e943d405c09d3e83199b1bb15b3814 100644 (file)
 #include "voice-element.hh"
 #include "musical-request.hh"
 #include "command-request.hh"
+#include "parser.hh"
+
+void
+My_lily_parser::clear_notenames()
+{
+    lexer_p_->clear_notenames();
+}
 
 void
 My_lily_parser::set_debug()
@@ -81,8 +88,7 @@ My_lily_parser::here_ch_C()const
 void
 My_lily_parser::parser_error(String s)
 {
-    lexer_p_->LexerError(s);
-
+    here_input().error(s);
     if ( fatal_error_i_ )
        exit( fatal_error_i_ );
     error_level_i_ = 1;
@@ -162,9 +168,6 @@ My_lily_parser::get_parens_request(char c)
 {
     Request* req_p=0;
     switch (c) {
-    case '|':
-       req_p = new Barcheck_req;
-       break;
 
     case '[':
     case ']':
@@ -177,7 +180,12 @@ My_lily_parser::get_parens_request(char c)
     }
     break;
 
-
+    case '>':
+    case '!':
+    case '<':
+       req_p = new Span_dynamic_req;
+       break;
+    
     case ')':
     case '(':
        req_p = new Slur_req;
@@ -188,10 +196,13 @@ My_lily_parser::get_parens_request(char c)
     }
     
     switch (c) {
+    case '<':
+    case '>':
     case '(':
     case '[':
        req_p->span()->spantype = Span_req::START;
        break;
+    case '!':
     case ')':
     case ']':
        req_p->span()->spantype = Span_req::STOP;
@@ -201,6 +212,11 @@ My_lily_parser::get_parens_request(char c)
        break;
     }
 
+   if (req_p->musical()->span_dynamic()) {
+       Span_dynamic_req* s_l= (req_p->musical()->span_dynamic()) ;
+       s_l->dynamic_dir_i_ = (c == '<') ? 1:-1;
+    }
+
     req_p->set_spot( here_input());
     return req_p;
 }
@@ -242,3 +258,9 @@ My_lily_parser::here_input()const
     Source_file * f_l= lexer_p_->source_file_l();
     return Input(f_l, here_ch_C());
 }
+
+void
+My_lily_parser::add_notename(String s, Melodic_req * m_p)
+{
+    lexer_p_->add_notename(s, m_p);
+}