]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/my-lily-parser.cc
* lily/font-select.cc: new file handle font selection routines.
[lilypond.git] / lily / my-lily-parser.cc
index f935f0f7780db69404034d2988509a1e462e4e2b..b912dc4b512d281a6dd95ac35ec116fee1ab3831 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
        Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -91,10 +91,27 @@ My_lily_parser::pop_spot ()
 Input
 My_lily_parser::here_input () const
 {
-  return  lexer_->here_input ();
+  /*
+    Parsing looks ahead , so we really want the previous location of the
+    lexer, not lexer_->here_input().
+   */
+  /*
+    Actually, that gets very icky when there are white space, because
+    the line-numbers are all wrong.  Let's try the character before
+    the current token. That gets the right result for
+    note/duration stuff, but doesn't mess up for errors in the 1st token of the line. 
+    
+   */
+  Input hi (lexer_->here_input ());
+
+  char const * bla = hi.defined_str0_;
+  if (hi.line_number () > 1
+      || hi.column_number () > 1)
+    bla --;
+  
+  return Input (hi.source_file_, bla);
 }
 
-// move me?
 #include "paper-def.hh"
 #include "translator-def.hh"