]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/my-lily-parser.cc
release: 0.1.11
[lilypond.git] / lily / my-lily-parser.cc
index eb5d2f0d82c25cacedad75f8b05dd11698b1b440..0b1121190a80b5f57b14ad5d9076cd606c0c9d17 100644 (file)
@@ -33,7 +33,7 @@ My_lily_parser::set_debug()
 #ifndef NPRINT
   String s = "";
   if (init_parse_b_) 
-       s = "Init";
+    s = "Init";
   set_yydebug (!monitor->silence (s+"Parser") && check_debug);
   lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug);
 #endif
@@ -46,10 +46,10 @@ My_lily_parser::print_declarations()
   String s = "";
   
   if (init_parse_b_) 
-       s = "Init";
+    s = "Init";
   if (!monitor->silence (s+"Declarations") && check_debug) 
     {
-       lexer_p_->print_declarations (init_parse_b_);
+      lexer_p_->print_declarations (init_parse_b_);
     }
 #endif   
 }
@@ -69,14 +69,14 @@ My_lily_parser::parse_file (String init, String s)
   print_declarations();
 
   init_parse_b_ = false;
-    set_debug();
+  set_debug();
   lexer_p_->new_input (s , source_l_);
   do_yyparse();
   print_declarations();
 
   
   if (!define_spot_array_.empty())
-       warning ("Braces don't match.");
+    warning ("Braces don't match.");
 }
 
 My_lily_parser::~My_lily_parser()
@@ -92,7 +92,7 @@ My_lily_parser::remember_spot()
 }
 
 char const * 
-My_lily_parser::here_ch_C()const
+My_lily_parser::here_ch_C() const
 {
   return lexer_p_->here_ch_C();
 }
@@ -101,8 +101,8 @@ void
 My_lily_parser::parser_error (String s)
 {
   here_input().error (s);
-  if ( fatal_error_i_)
-       exit (fatal_error_i_);
+  if (fatal_error_i_)
+    exit (fatal_error_i_);
   error_level_i_ = 1;
 }
 
@@ -125,7 +125,7 @@ void
 My_lily_parser::set_last_duration (Duration const *d)
 {
   if (last_duration_mode_b_)
-       default_duration_ = *d;
+    default_duration_ = *d;
 }
 
 
@@ -151,25 +151,22 @@ My_lily_parser::get_rest_element (String s,  Duration * duration_p)
   Chord* velt_p = new Request_chord;
   velt_p->set_spot (here_input());
 
-  if (s=="s") { /* Space */
-       Skip_req * skip_p = new Skip_req;
-       skip_p->duration_ = *duration_p;
+  if (s=="s")
+    { /* Space */
+    Skip_req * skip_p = new Skip_req;
+    skip_p->duration_ = *duration_p;
 
-       skip_p->set_spot (here_input());
-       velt_p->add (skip_p);
+    skip_p->set_spot (here_input());
+    velt_p->add (skip_p);
     }
   else 
     {
-       Rest_req * rest_req_p = new Rest_req;
-       rest_req_p->duration_ = *duration_p;
-       rest_req_p->set_spot (here_input());
+      Rest_req * rest_req_p = new Rest_req;
+      rest_req_p->duration_ = *duration_p;
+      rest_req_p->set_spot (here_input());
        
-       velt_p->add (rest_req_p);
+      velt_p->add (rest_req_p);
     }
-  Stem_req * stem_p = new Stem_req;
-  stem_p->duration_ = *duration_p;
-  stem_p->set_spot ( here_input());
-  velt_p->add (stem_p);
 
   delete duration_p;
   return velt_p;
@@ -183,15 +180,6 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
 
   v->add (rq);
   
-  if (duration_p->durlog_i_ >= 1) 
-    {
-       Stem_req * stem_req_p = new Stem_req();
-       stem_req_p->duration_ = *duration_p;
-       
-       stem_req_p->set_spot (here_input());
-       v->add (stem_req_p);
-    }
-
   rq->set_duration (*duration_p);
   rq->set_spot (here_input());
   delete duration_p ;
@@ -205,57 +193,57 @@ My_lily_parser::get_parens_request (char c)
   switch (c) 
     {
 
-  case '~':
-       req_p = new Tie_req;
-       break;
-  case '[':
-  case ']':
-  {
+    case '~':
+      req_p = new Tie_req;
+      break;
+    case '[':
+    case ']':
+      {
        Beam_req*b = new Beam_req;
        int p_i=plet_.type_i_ ; // ugh . Should junk?
        if (p_i!= 1)
-           b->nplet = p_i;
+         b->nplet = p_i;
        req_p = b;
-    }
-  break;
-
-  case '>':
-  case '!':
-  case '<':
-       req_p = new Span_dynamic_req;
-       break;
+      }
+    break;
+
+    case '>':
+    case '!':
+    case '<':
+      req_p = new Span_dynamic_req;
+      break;
   
-  case ')':
-  case '(':
-       req_p = new Slur_req;
-       break;
-  default:
-       assert (false);
-       break;
+    case ')':
+    case '(':
+      req_p = new Slur_req;
+      break;
+    default:
+      assert (false);
+      break;
     }
   
   switch (c) 
     {
-  case '<':
-  case '>':
-  case '(':
-  case '[':
-       req_p->span()->spantype = Span_req::START;
-       break;
-  case '!':
-  case ')':
-  case ']':
-       req_p->span()->spantype = Span_req::STOP;
-       break;
+    case '<':
+    case '>':
+    case '(':
+    case '[':
+      req_p->span()->spantype = Span_req::START;
+      break;
+    case '!':
+    case ')':
+    case ']':
+      req_p->span()->spantype = Span_req::STOP;
+      break;
        
-  default:
-       break;
+    default:
+      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;
+  if (req_p->musical()->span_dynamic ()) 
+    {
+      Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ;
+      s_l->dynamic_dir_ = (c == '<') ? UP:DOWN;
     }
 
   req_p->set_spot (here_input());
@@ -281,12 +269,12 @@ My_lily_parser::add_requests (Chord*v)
 {
   for (int i = 0; i < pre_reqs.size(); i++) 
     {
-       v->add (pre_reqs[i]);
+      v->add (pre_reqs[i]);
     }
   pre_reqs.clear();
   for (int i = 0; i <post_reqs.size(); i++) 
     {
-       v->add (post_reqs[i]);
+      v->add (post_reqs[i]);
     }
   post_reqs.clear();
 }
@@ -298,7 +286,7 @@ My_lily_parser::pop_spot()
 }
 
 Input
-My_lily_parser::here_input()const
+My_lily_parser::here_input() const
 {
   Source_file * f_l= lexer_p_->source_file_l();
   return Input (f_l, here_ch_C());