From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Thu, 5 Feb 2004 23:29:27 +0000 (+0000)
Subject: (simple_toplevel_snippets): new
X-Git-Tag: release/2.1.23~82
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=67b894e5352976437c9db5d7b15fd51326bab56a;p=lilypond.git

(simple_toplevel_snippets): new
function.
---

diff --git a/ChangeLog b/ChangeLog
index 395bebdd31..2a4c33a2ef 100644
--- 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.
@@ -22,6 +31,16 @@
 
 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.
diff --git a/flower/include/array.hh b/flower/include/array.hh
index 5d3cd7dd30..9185cb8fa5 100644
--- a/flower/include/array.hh
+++ b/flower/include/array.hh
@@ -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);
diff --git a/flower/include/parray.hh b/flower/include/parray.hh
index decf7b6681..e37a316503 100644
--- a/flower/include/parray.hh
+++ b/flower/include/parray.hh
@@ -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
index 0000000000..f6a4d213c9
--- /dev/null
+++ b/input/regression/rest-polyphonic.ly
@@ -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   } >>
+  }
+
+}
diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc
index 8544305d2f..5f2f2d81f1 100644
--- a/lily/break-substitution.cc
+++ b/lily/break-substitution.cc
@@ -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_);
diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc
index 5bece2105c..0110973933 100644
--- a/lily/collision-engraver.cc
+++ b/lily/collision-engraver.cc
@@ -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_);
diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc
index a99a2f7595..aab8fd9fcd 100644
--- a/lily/includable-lexer.cc
+++ b/lily/includable-lexer.cc
@@ -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 ();
diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh
index b53948bb3c..b9d7d46770 100644
--- a/lily/include/note-column.hh
+++ b/lily/include/note-column.hh
@@ -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*);
diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc
index 2142812a64..06a91a352b 100644
--- a/lily/my-lily-lexer.cc
+++ b/lily/my-lily-lexer.cc
@@ -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"));
     }
diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc
index a04551bf45..a2e9bb48fb 100644
--- a/lily/my-lily-parser.cc
+++ b/lily/my-lily-parser.cc
@@ -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;
diff --git a/lily/note-column.cc b/lily/note-column.cc
index 8eb3ed0282..d92a3b19a4 100644
--- a/lily/note-column.cc
+++ b/lily/note-column.cc
@@ -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"));
 }
diff --git a/lily/parser.yy b/lily/parser.yy
index e9024a2e7e..15b37c1988 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -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
diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc
index 59d9ff7fe2..b3aa443e9a 100644
--- a/lily/phrasing-slur-engraver.cc
+++ b/lily/phrasing-slur-engraver.cc
@@ -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 ();
 }
 
diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc
index 572bbf3bc0..af3d0ecc89 100644
--- a/lily/rest-collision-engraver.cc
+++ b/lily/rest-collision-engraver.cc
@@ -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",
diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc
index ea072a3b1e..e80e0d9cd7 100644
--- a/lily/rest-collision.cc
+++ b/lily/rest-collision.cc
@@ -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 ()) 
     {
diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc
index 6bcd774ed8..aef4a23a66 100644
--- a/lily/separating-line-group-engraver.cc
+++ b/lily/separating-line-group-engraver.cc
@@ -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_;
     }
diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc
index cf43fc626b..172a9ff42e 100644
--- a/lily/slur-engraver.cc
+++ b/lily/slur-engraver.cc
@@ -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"));
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index 221d323a6c..81feea3240 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -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)
diff --git a/scm/define-translator-properties.scm b/scm/define-translator-properties.scm
index 047ef08d88..332901a40f 100644
--- a/scm/define-translator-properties.scm
+++ b/scm/define-translator-properties.scm
@@ -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}.
+")
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index dbc6965780..b575107eb5 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -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