]> git.donarmstrong.com Git - lilypond.git/commitdiff
(simple_toplevel_snippets): new
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 5 Feb 2004 23:29:27 +0000 (23:29 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 5 Feb 2004 23:29:27 +0000 (23:29 +0000)
function.

20 files changed:
ChangeLog
flower/include/array.hh
flower/include/parray.hh
input/regression/rest-polyphonic.ly [new file with mode: 0644]
lily/break-substitution.cc
lily/collision-engraver.cc
lily/includable-lexer.cc
lily/include/note-column.hh
lily/my-lily-lexer.cc
lily/my-lily-parser.cc
lily/note-column.cc
lily/parser.yy
lily/phrasing-slur-engraver.cc
lily/rest-collision-engraver.cc
lily/rest-collision.cc
lily/separating-line-group-engraver.cc
lily/slur-engraver.cc
lily/tuplet-bracket.cc
scm/define-translator-properties.scm
scripts/lilypond-book.py

index 395bebdd314f6c6aee92d507ba4fa668a377d7ce..2a4c33a2ef2bcd9005bb740d0894b02523c289a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-02-06  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scripts/lilypond-book.py (simple_toplevel_snippets): new
+       function.
+
+2004-02-05  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scripts/lilypond-book.py (outname): fix typo
+
 2004-02-05  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Documentation/topdocs/NEWS.texi: Add item about lilypond-book.
 
 2004-02-05  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/rest-collision-engraver.cc (process_acknowledged_grobs):
+       make rest-collision only.
+
+       * lily/break-substitution.cc (substitute_one_mutable_property):
+       clear all-elements using scm_assq_remove_x(). 
+
+       * lily/rest-collision.cc (do_shift): shift single rests
+
+       * flower/include/array.hh (class Array): rename to is_empty ()
+
        * lily/drum-note-performer.cc: new file: perform drum notes.
 
        * VERSION (PACKAGE_NAME): release 2.1.19.
index 5d3cd7dd3075828b2c0d9de3a1234578ea59e866..9185cb8fa5f9afe7c875b261c001851897440f4b 100644 (file)
@@ -168,7 +168,7 @@ public:
   /// remove and return last entry 
   T pop () 
     {
-      assert (!empty ());
+      assert (!is_empty ());
       T l = top (0);
       set_size (size ()-1);
       return l;
@@ -206,7 +206,7 @@ public:
  (*this)[i]= (*this)[j];
  (*this)[j]=t;
     }
-  bool empty () const 
+  bool is_empty () const 
     { return !size_; }
 
   void insert (T k, int j);
index decf7b6681e16326d538333afce12a3b9c260cea..e37a316503cdf6ba5376e3c26f453439ce203f43 100644 (file)
@@ -130,7 +130,7 @@ public:
   Array<void*>::size;
   Array<void*>::clear;
   Array<void*>::set_size;
-  Array<void*>::empty;
+  Array<void*>::is_empty;
   Array<void*>::reverse;
   Array<void*>::tighten_maxsize;
 
diff --git a/input/regression/rest-polyphonic.ly b/input/regression/rest-polyphonic.ly
new file mode 100644 (file)
index 0000000..f6a4d21
--- /dev/null
@@ -0,0 +1,18 @@
+\header {
+
+    texidoc = "In polyphonic situations, rests are moved down
+even if there is no opposite note or rest. The amount is two
+staff-spaces. "
+
+    }
+
+
+\version "2.1.15"
+
+\score {
+  \new Staff \notes \relative c' {
+     << { r8 g''4 g8 r g4 g8 } \\
+            { d,4    r   d   r   } >>
+  }
+
+}
index 8544305d2f47795f3cdd24f03016df1fe3fc93df..5f2f2d81f168e77a80e118d3175de62eb90f18d4 100644 (file)
@@ -437,8 +437,10 @@ Spanner::fast_fubstitute_grob_list (SCM sym,
        see below.
        */
       if (sym == ly_symbol2scm ("all-elements"))
-       sc->set_grob_property ("all-elements", SCM_EOL);
-
+         sc->mutable_property_alist_
+           = scm_assq_remove_x (sc->mutable_property_alist_,
+                            ly_symbol2scm ("all-elements"));
+      
       sc->mutable_property_alist_ = scm_acons (sym, newval,
                                               sc->mutable_property_alist_);
     }
@@ -524,7 +526,9 @@ Spanner::substitute_one_mutable_property (SCM sym,
          (hwn 4/2/04)
        */
        if (sym == ly_symbol2scm ("all-elements"))
-         sc->set_grob_property ("all-elements", SCM_EOL);
+         sc->mutable_property_alist_
+           = scm_assq_remove_x (sc->mutable_property_alist_,
+                            ly_symbol2scm ("all-elements"));
        
        sc->mutable_property_alist_ = scm_cons (scm_cons (sym, newval),
                                                sc->mutable_property_alist_);
index 5bece2105c66ad22c8a4dfdc07bff633b01d7d71..0110973933c889ffddbe7b3653c5b500e6056444 100644 (file)
@@ -50,7 +50,7 @@ Collision_engraver::acknowledge_grob (Grob_info i)
   if (Note_column::has_interface (i.grob_))
     {
       /*should check Y axis? */
-      if (Note_column::rest_b (i.grob_) || i.grob_->get_parent (X_AXIS))
+      if (Note_column::has_rests (i.grob_) || i.grob_->get_parent (X_AXIS))
        return ;
 
       note_columns_.push (i.grob_);
index a99a2f7595672da936149dec3de6b82e1d6e6bf8..aab8fd9fcd850446fae03fb0f7f4469a12608e30 100644 (file)
@@ -117,7 +117,7 @@ Includable_lexer::close_input ()
 #ifdef HAVE_FLEXLEXER_YY_CURRENT_BUFFER  
   yy_current_buffer = 0;
 #endif  
-  if (state_stack_.empty ())
+  if (state_stack_.is_empty ())
     {
 #ifdef HAVE_FLEXLEXER_YY_CURRENT_BUFFER  
       yy_current_buffer = 0;
@@ -134,14 +134,14 @@ Includable_lexer::close_input ()
 char const*
 Includable_lexer::here_str0 () const
 {
-  if (include_stack_.empty ())
+  if (include_stack_.is_empty ())
     return 0;
   return include_stack_.top ()->to_str0 () + char_count_stack_.top ();
 }
 
 Includable_lexer::~Includable_lexer ()
 {
-  while (!include_stack_.empty ())
+  while (!include_stack_.is_empty ())
     {
       close_input ();
     }
@@ -159,7 +159,7 @@ Includable_lexer::add_lexed_char (int count)
 Source_file*
 Includable_lexer::get_source_file () const
 {
-  if (include_stack_.empty ())
+  if (include_stack_.is_empty ())
     return 0;
   else
     return include_stack_.top ();
index b53948bb3cd49932f73eed39086c68156abc8c6b..b9d7d467705fd4fd74f9ab0c44313b0cedda91e8 100644 (file)
@@ -38,7 +38,7 @@ public:
   static void set_stem (Grob*me,Grob*);
   static void set_dotcol (Grob*me,Grob*);
   static void add_head (Grob*me,Grob*);
-  static bool rest_b (Grob*me);
+  static bool has_rests (Grob*me);
   static bool has_interface (Grob*);
   
   static Item *get_stem (Grob*);
index 2142812a64455bddab434c71a08a7c4f9ae841e3..06a91a352b6d7ee605ad01b8ae28e1d026905faa 100644 (file)
@@ -200,7 +200,7 @@ My_lily_lexer::~My_lily_lexer ()
 void
 My_lily_lexer::LexerError (char const *s)
 {
-  if (include_stack_.empty ())
+  if (include_stack_.is_empty ())
     {
       progress_indication (_f ("error at EOF: %s", s)+ String ("\n"));
     }
index a04551bf45db759d2c28059b0a6fa5bcac93c48e..a2e9bb48fb11d64a5e49ec4654b10f99fa239bcf 100644 (file)
@@ -50,7 +50,7 @@ My_lily_parser::parse_file (String init, String in_file, String out_file)
 
   progress_indication ("\n");
   
-  if (!define_spots_.empty ())
+  if (!define_spots_.is_empty ())
     {
       define_spots_.top ().warning (_ ("Braces don't match"));
       error_level_ = 1;
index 8eb3ed0282c38e2e7397b79b12a75b5f5411f326..d92a3b19a46c6b18dca27337a090db796d2875d6 100644 (file)
@@ -19,7 +19,7 @@
 #include "accidental-placement.hh"
 
 bool
-Note_column::rest_b (Grob*me) 
+Note_column::has_rests (Grob*me) 
 {
   return unsmob_grob (me->get_grob_property ("rest"));
 }
index e9024a2e7e183fa890357935ade92c9da1f6b9ad..15b37c198892b0bad666200612c9250280916a69 100644 (file)
@@ -440,7 +440,7 @@ toplevel_expression:
                for (int i=0; i < sc->defs_.size (); i++)
                        default_rendering (sc->music_, sc->defs_[i]->self_scm(),head, outname);
 
-               if (sc->defs_.empty ())
+               if (sc->defs_.is_empty ())
                {
                   Music_output_def *id =
                        unsmob_music_output_def (THIS->lexer_->lookup_identifier
index 59d9ff7fe259ebf433d51675efbf6646aa808d50..b3aa443e9ad8d81ef341705f6b70aae106878059 100644 (file)
@@ -23,7 +23,7 @@ class Phrasing_slur_engraver : public Engraver
 {
   Link_array<Music> eventses_;
   Link_array<Music> new_phrasing_slur_evs_;
-  Link_array<Grob> phrasing_slur_l_stack_;
+  Link_array<Grob> phrasing_slurs_;
   Link_array<Grob> end_phrasing_slurs_;
   Moment last_start_;
 
@@ -80,8 +80,8 @@ Phrasing_slur_engraver::acknowledge_grob (Grob_info info)
   if (Note_column::has_interface (info.grob_))
     {
       Grob *e =info.grob_;
-      for (int i = 0; i < phrasing_slur_l_stack_.size (); i++)
-       Slur::add_column (phrasing_slur_l_stack_[i], e);
+      for (int i = 0; i < phrasing_slurs_.size (); i++)
+       Slur::add_column (phrasing_slurs_[i], e);
       for (int i = 0; i < end_phrasing_slurs_.size (); i++)
        Slur::add_column (end_phrasing_slurs_[i], e);
     }
@@ -90,14 +90,14 @@ Phrasing_slur_engraver::acknowledge_grob (Grob_info info)
 void
 Phrasing_slur_engraver::finalize ()
 {
-  for (int i = 0; i < phrasing_slur_l_stack_.size (); i++)
+  for (int i = 0; i < phrasing_slurs_.size (); i++)
     {
       /*
        Let's not typeset unterminated stuff
       */
-      phrasing_slur_l_stack_[i]->suicide ();
+      phrasing_slurs_[i]->suicide ();
     }
-  phrasing_slur_l_stack_.clear ();
+  phrasing_slurs_.clear ();
 
   for (int i=0; i < eventses_.size (); i++)
     {
@@ -118,11 +118,11 @@ Phrasing_slur_engraver::process_acknowledged_grobs ()
       
       if (d == STOP)
        {
-         if (phrasing_slur_l_stack_.empty ())
+         if (phrasing_slurs_.is_empty ())
            phrasing_slur_ev->origin ()->warning (_f ("can't find start of phrasing slur"));
          else
            {
-             Grob* phrasing_slur = phrasing_slur_l_stack_.pop ();
+             Grob* phrasing_slur = phrasing_slurs_.pop ();
              end_phrasing_slurs_.push (phrasing_slur);
              eventses_.pop ();
            }
@@ -146,7 +146,7 @@ Phrasing_slur_engraver::process_acknowledged_grobs ()
        }
     }
   for (int i=0; i < start_phrasing_slurs.size (); i++)
-    phrasing_slur_l_stack_.push (start_phrasing_slurs[i]);
+    phrasing_slurs_.push (start_phrasing_slurs[i]);
   new_phrasing_slur_evs_.clear ();
 }
 
index 572bbf3bc06c3eeb67a14aaed5148e5f9f5de105..af3d0ecc8903c03a8a1d5e05e7c009abe2981e5f 100644 (file)
@@ -15,7 +15,7 @@
 class Rest_collision_engraver : public Engraver
 {
   Item* rest_collision_;
-
+  int rest_count_; 
   Link_array<Grob> note_columns_;
 protected:
   virtual void acknowledge_grob (Grob_info);
@@ -30,18 +30,21 @@ public:
 Rest_collision_engraver::Rest_collision_engraver ()
 {
   rest_collision_ =0;
+  rest_count_ = 0;
 }
 
 void
 Rest_collision_engraver::process_acknowledged_grobs ()
 {
-  if (rest_collision_ || note_columns_.size () < 2)
+  if (rest_collision_
+      || note_columns_.is_empty ()
+      || !rest_count_)
     return;
 
   rest_collision_ = make_item ("RestCollision");
 
   announce_grob(rest_collision_, SCM_EOL);
-  for (int i=0; i< note_columns_.size (); i++)
+  for (int i=0; i < note_columns_.size (); i++)
     Rest_collision::add_column (rest_collision_,note_columns_[i]);
 }
 
@@ -49,7 +52,11 @@ void
 Rest_collision_engraver::acknowledge_grob (Grob_info i)
 {
   if (Note_column::has_interface (i.grob_))
-    note_columns_.push (i.grob_);
+    {
+      note_columns_.push (i.grob_);
+      if (Note_column::has_rests (i.grob_))
+       rest_count_ ++;
+    }
 }
 
 void
@@ -61,7 +68,9 @@ Rest_collision_engraver::stop_translation_timestep ()
       rest_collision_ = 0;
     }
   note_columns_.clear ();
+  rest_count_ = 0;
 }
+
 ENTER_DESCRIPTION(Rest_collision_engraver,
 /* descr */       "Handles collisions of rests.",
 /* creats*/       "RestCollision",
index ea072a3b1e05fd7cfc86bcda0512ba949450c6c7..e80e0d9cd751c57a7d59aa00d8b7a24191b8d436 100644 (file)
@@ -113,8 +113,14 @@ Rest_collision::do_shift (Grob *me)
 
   // no partners to collide with
   if (rests.size () + notes.size () < 2)
-    return SCM_UNSPECIFIED;
-
+    {
+      if (rests.size () == 1
+         && Note_column::dir (rests[0]))
+       {
+         Note_column::translate_rests (rests[0],
+                                       4 * Note_column::dir (rests[0]));
+       }
+    }
   // meisjes met meisjes
   if (!notes.size ()) 
     {
index 6bcd774ed87455cd057543db2b7660878e1d6834..aef4a23a66112f3c7a9a401a15e5ad891fea4280 100644 (file)
@@ -29,7 +29,7 @@ struct Spacings
     staff_spacing_ = 0;
   }
 
-  bool empty( )const
+  bool is_empty () const
   {
     return !staff_spacing_ && !note_spacings_.size (); 
   }
@@ -205,7 +205,7 @@ Separating_line_group_engraver::stop_translation_timestep ()
     }
 
   
-  if (!current_spacings_.empty ())
+  if (!current_spacings_.is_empty ())
     {
       last_spacings_ = current_spacings_;
     }
index cf43fc626b296c6e0146fe32bd2331fb44c8b0ae..172a9ff42e75c01dd659575b67effec00446a524 100644 (file)
@@ -132,7 +132,7 @@ Slur_engraver::process_music ()
       Direction d = to_dir (slur_ev->get_mus_property ("span-direction"));
       if (d== STOP)
        {
-         if (slur_stack_.empty ())
+         if (slur_stack_.is_empty ())
            /* How to shut up this warning, when Voice_devnull_engraver has
               eaten start event? */
            slur_ev->origin ()->warning (_f ("can't find start of slur"));
index 221d323a6cc2cb97b740a7a1f31f627cc134ba85..81feea3240da270ea5931fad555b20fe601dd807 100644 (file)
@@ -314,11 +314,11 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy)
     Use outer non-rest columns to determine slope
    */
   int l = 0;
-  while (l <columns.size () && Note_column::rest_b (columns[l]))
+  while (l <columns.size () && Note_column::has_rests (columns[l]))
     l ++;
 
   int r = columns.size ()- 1;
-  while (r >= l && Note_column::rest_b (columns[r]))
+  while (r >= l && Note_column::has_rests (columns[r]))
     r--;
   
   if (l < r)
index 047ef08d884d4a7a1e1b49ac0f0bfb520fd54986..332901a40f2740b4ee58751f61eb3279be69551d 100644 (file)
@@ -368,7 +368,6 @@ with other voices is preserved.
 @example
 @@lilypond[fragment,verbatim,center]
 r1 r1*3 R1*3  \\\\property Score.skipBars= ##t r1*3 R1*3
-
 @@end lilypond
 @end example
 
@@ -379,7 +378,7 @@ this moment, causing  the interpretation phase to go a lot faster. This can
 help with debugging large scores.")
 (translator-property-description 'slurMelismaBusy boolean? "Signal if a slur is present.")
 (translator-property-description 'solo boolean? "set if solo is detected by the part combiner.")
-(translator-property-description 'soloADue boolean? "set Solo/A due texts in the part combiner?.")
+(translator-property-description 'soloADue boolean? "set Solo/A due texts in the part combiner?")
 (translator-property-description 'soloIIText string? "text for begin of solo for voice ``two'' when part-combining.")
 (translator-property-description 'soloText string? "text for begin of solo when part-combining.")
 (translator-property-description 'sparseTies boolean? "only create one tie per chord.")
@@ -429,12 +428,12 @@ uses less memory and time.")
 
 (translator-property-description 'tupletSpannerDuration ly:moment? "
 Normally a tuplet bracket is as wide as the
-@code{ imes} expression that gave rise to it. By setting this
+@code{\\times} expression that gave rise to it. By setting this
 property, you can make brackets last shorter. Example
 
 @example
 @@lilypond[verbatim,fragment]
-context Voice  imes 2/3 @{
+context Voice \\times 2/3 @{
   property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
   c-[8 c c-] c-[ c c-]
 @}
@@ -450,7 +449,7 @@ coded vertical extent.  The format is a pair of dimensions, for
 example, this sets the sizes of a staff to 10 (5+5) staffspaces high.
 
 @example
-property Staff.verticalExtent = #(-5.0 . 5.0)
+property Staff.verticalExtent = #'(-5.0 . 5.0)
 @end example
 
 VerticalExtent, MinimumVerticalExtent and ExtraVerticalExtent are
@@ -495,9 +494,8 @@ If not set explicitly (by property or @code{\\bar}), this is set
 according to values of @code{defaultBarType}, @code{barAlways},
 @code{barNonAuto} and @code{measurePosition}.
 
-Valid values are described in @ref{(lilypond-internals)bar-line-interface}.
-
-.")
+Valid values are described in @ref{bar-line-interface}.
+")
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index dbc6965780191bbb1d82e3e8629b209330a5073b..b575107eb5381ba84502425edc010dcd27c20e0b 100644 (file)
@@ -131,10 +131,10 @@ snippet_res = {
        HTML: {
        'include':  no_match,
        'lilypond' : '(?m)(?P<match><lilypond((?P<options>[^:]*):)(?P<code>.*?)/>)',
-       'lilypond-block': r'''(?ms)(?P<match><lilypond(?P<options>[^>]+)?>(?P<code>.*?)</lilypond>)''',
-       'lilypond-file': r'(?m)(?P<match><lilypondfile(?P<options>[^>]+)?>\s*(?P<filename>[^<]+)\s*</lilypondfile>)',
-       'multiline-comment': r"(?sm)\s*(?!@c\s+)(?P<code><!--\s.*?!-->)\s",
-       'singleline-comment': no_match,
+       'lilypond_block': r'''(?ms)(?P<match><lilypond(?P<options>[^>]+)?>(?P<code>.*?)</lilypond>)''',
+       'lilypond_file': r'(?m)(?P<match><lilypondfile(?P<options>[^>]+)?>\s*(?P<filename>[^<]+)\s*</lilypondfile>)',
+       'multiline_comment': r"(?sm)\s*(?!@c\s+)(?P<code><!--\s.*?!-->)\s",
+       'singleline_comment': no_match,
        'verb': r'''(?P<code><pre>.*?</pre>)''',
        'verbatim': r'''(?s)(?P<code><pre>\s.*?</pre>\s)''',
        },
@@ -142,10 +142,10 @@ snippet_res = {
        LATEX: {
        'include': r'(?m)^[^%\n]*?(?P<match>\\input{(?P<filename>[^}]+)})',
        'lilypond' : r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
-       'lilypond-block': r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
-       'lilypond-file': r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
-       'multiline-comment': no_match,
-       'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
+       'lilypond_block': r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
+       'lilypond_file': r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
+       'multiline_comment': no_match,
+       'singleline_comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
        'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
        'verbatim': r"(?s)(?P<code>\\begin\s*{verbatim}.*?\\end{verbatim})",
        },
@@ -153,10 +153,10 @@ snippet_res = {
        TEXINFO: {
        'include':  '(?m)^[^%\n]*?(?P<match>@include\s+(?P<filename>\S*))',
        'lilypond' : '(?m)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?{(?P<code>.*?)})',
-       'lilypond-block': r'''(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*?)@end lilypond)\s''',
-       'lilypond-file': '(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})',
-       'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*?@end ignore)\s",
-       'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c([ \t][^\n]*|)\n))",
+       'lilypond_block': r'''(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*?)@end lilypond)\s''',
+       'lilypond_file': '(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})',
+       'multiline_comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*?@end ignore)\s",
+       'singleline_comment': r"(?m)^.*?(?P<match>(?P<code>@c([ \t][^\n]*|)\n))",
        'verb': r'''(?P<code>@code{.*?})''',
        'verbatim': r'''(?s)(?P<code>@example\s.*?@end example\s)''',
        },
@@ -368,6 +368,8 @@ def split_options (option_string):
 index = 0
 
 class Snippet:
+
+       ## huh? index is redundant? --hwn
        def __init__ (self, type, source, index, match):
                self.type = type
                self.source = source
@@ -386,9 +388,9 @@ class Snippet:
 
        def ly (self):
                s = ''
-               if self.type == 'lilypond-block' or self.type == 'lilypond':
+               if self.type == 'lilypond_block' or self.type == 'lilypond':
                        s = self.substring ('code')
-               elif self.type == 'lilypond-file':
+               elif self.type == 'lilypond_file':
                        name = self.substring ('filename')
                        s = open (find_file (name)).read ()
                return s
@@ -410,8 +412,8 @@ class Snippet:
                raise 'to be done'
 
        def write_ly (self):
-               if self.type == 'lilypond-block' or self.type == 'lilypond'\
-                      or self.type == 'lilypond-file':
+               if self.type == 'lilypond_block' or self.type == 'lilypond'\
+                      or self.type == 'lilypond_file':
                        h = open (self.basename () + '.ly', 'w')
                        h.write (self.full_ly ())
 
@@ -451,8 +453,8 @@ class Snippet:
                h.write ('\n@end html\n')
                        
        def outdated_p (self):
-               if self.type != 'lilypond-block' and self.type != 'lilypond'\
-                      and self.type != 'lilypond-file':
+               if self.type != 'lilypond_block' and self.type != 'lilypond'\
+                      and self.type != 'lilypond_file':
                        return None
                base = self.basename ()
                if os.path.exists (base + '.ly') \
@@ -469,7 +471,7 @@ class Snippet:
                # Hmm, why is verbatim's group called 'code'; rename to 'verb'?
                #if snippet.match.group ('code'):
                # urg
-               if self.type == 'lilypond' or self.type == 'lilypond-block':
+               if self.type == 'lilypond' or self.type == 'lilypond_block':
                        h.write (self.source[index:self.start ('code')])
                        h.write (run_filter (self.substring ('code')))
                        h.write (self.source[self.end ('code'):self.end (0)])
@@ -483,8 +485,8 @@ class Snippet:
                # if snippet.match.group ('code'):
                # urg
                if self.type == 'lilypond' \
-                      or self.type == 'lilypond-block'\
-                      or self.type == 'lilypond-file':
+                      or self.type == 'lilypond_block'\
+                      or self.type == 'lilypond_file':
                        h.write (self.source[index:self.start (0)])
                        snippet_output = eval ("Snippet.output_" + format)
                        snippet_output (self)
@@ -497,6 +499,53 @@ class Snippet:
                        h.write (self.source[index:self.end (0)])
                index = self.end (0)
 
+
+# this isn't working - <params> are doubly used.
+# a solution is to strip P<> from the regexes,
+# and redo the match with  the original in notice_snippet
+def other_toplevel_snippets (str, types):
+       res = ['(?P<regex%s>%s)' % (t, snippet_res[format][t])
+              for t in types]
+
+       big_re = re.compile (string.join (res, '|'))
+       snippets = []
+       
+       def notice_snippet (match, snips = snippets, types = types):
+               snip = None
+               for t in types:
+                       try:
+                               key = 'regex' + t
+                               gr = match.group (key)
+                               snip =Snippet (t, str, match.start (key), match)
+                               break
+                       except IndexError:
+                               pass
+               if snip:
+                       snips.append (snip)
+               else:
+                       raise "Huh?"
+               
+               return match.group (0)
+
+       str = big_re.sub (notice_snippet, str)
+
+       return snippets
+
+def simple_toplevel_snippets (str, types):
+       snippets  = []
+       for t in types:
+               regex = re.compile (snippet_res[format][t])
+
+               # ugh, this can be done nicer in python 2.x
+               def notice_snippet (match, snippets = snippets,
+                                   t = t, str = str):
+                       s = Snippet (t, str, 0, match)
+                       snippets.append (s)
+                       return ''
+
+               regex.sub (notice_snippet, str)
+       return snippets
+
 def find_toplevel_snippets (s, types):
        res = {}
        for i in types:
@@ -646,16 +695,16 @@ def do_file (input_filename):
        ly.progress (_ ("Dissecting..."))
        #snippets = find_toplevel_snippets (source, snippet_res[format].keys ())
        snippet_types = (
-               'lilypond-block',
+               'lilypond_block',
                'verb',
                'verbatim',
-               'singleline-comment',
-               'multiline-comment',
-               'lilypond-file',
+               'singleline_comment',
+               'multiline_comment',
+               'lilypond_file',
                'include',
                'lilypond', )
        
-       snippets = find_toplevel_snippets (source, snippet_types)
+       snippets = simple_toplevel_snippets (source, snippet_types)
        ly.progress ('\n')
 
        global h