+2006-08-07 Erik Sandberg <mandolaerik@gmail.com>
+
+ * lily/lexer.ll, lily/source-file.cc: Add \sourcefileline command
+
+ * scripts/lilypond-book.py: insert \sourcefileline command in
+ output, so lilypond error messages refer to the spot in the
+ original .lytex / .itely sourcefile.
+
2006-08-04 Han-Wen Nienhuys <hanwen@lilypond.org>
* lily/spacing-loose-columns.cc (set_loose_columns): oops: use
conversion of files older than 1.3.117.
Fix escape error in the description for 2.9.6.
-2006-08-02 Han-Wen Nienhuys <hanwen@lilypond.org>
+2006-08-02 Erik Sandberg <mandolaerik@gmail.com>
+
+ * lily/*-engraver.cc: convert all try_music functions to listen_*
+ functions.
- * lily/*-engraver.cc: convert all try_music functions in
- *-engraver.cc. (Patch by Erik S.; please elaborate)
+ * lily/piano-pedal-engraver.cc: some additional cleanups: use
+ enums to represent pedal types, and calculate more data statically.
+
+ * scm/part-combiner.scm (recording-group-emulate): create a
+ softcoded substitute for recording-group-engraver.cc.
+
+ * lily/music.cc: make a common transpose function for events and
+ music
+
+ * ly/declarations-init.ly: change melisma/melismaEnd. Eliminates
+ ManualMelismaEvent, and obsoletes Melisma_translator.
+
+2006-08-02 Han-Wen Nienhuys <hanwen@lilypond.org>
* input/test/instrument-name-align.ly: update version.
bool contains (char const *pos_str0) const;
int length () const;
virtual int get_line (char const *pos_str0) const;
+ void set_line (char const *pos_str0, int i);
string name_string () const;
string file_line_column_string (char const *str0) const;
SCM get_port () const;
string name_;
+protected:
+ int line_offset_;
+
private:
vector<char*> newline_locations_;
istream *istream_;
%x markup
%x notes
%x quote
+%x sourcefileline
%x sourcefilename
%x version
<INITIAL,chords,lyrics,notes,figures>\\sourcefilename{WHITE}* {
yy_push_state (sourcefilename);
}
+<INITIAL,chords,lyrics,notes,figures>\\sourcefileline{WHITE}* {
+ yy_push_state (sourcefileline);
+}
<version>\"[^"]*\" { /* got the version number */
string s (YYText () + 1);
s = s.substr (0, s.rfind ('\"'));
scm_makfrom0str (s.c_str ()));
}
+
+<sourcefileline>{INT} {
+ int i;
+ sscanf (YYText (), "%d", &i);
+
+ yy_pop_state ();
+ this->here_input ().get_source_file ()->set_line (here_input ().start (), i);
+}
+
<version>. {
LexerError (_ ("quoted string expected after \\version").c_str ());
yy_pop_state ();
LexerError (_ ("quoted string expected after \\sourcefilename").c_str ());
yy_pop_state ();
}
+<sourcefileline>. {
+ LexerError (_ ("integer expected after \\sourcefileline").c_str ());
+ yy_pop_state ();
+}
<longcomment>{
[^\%]* {
}
{
name_ = filename;
istream_ = 0;
+ line_offset_ = 0;
length_ = data.length ();
contents_str0_ = string_copy (data);
pos_str0_ = c_str ();
{
name_ = filename_string;
istream_ = 0;
+ line_offset_ = 0;
contents_str0_ = 0;
if (filename_string == "-")
if (*pos_str0 == '\n')
lo--;
- return lo + 2;
+ return lo + 2 + line_offset_;
+}
+
+void
+Source_file::set_line (char const *pos_str0, int line)
+{
+ int current_line = get_line (pos_str0);
+ line_offset_ += line - current_line;
+
+ assert (line == get_line (pos_str0));
}
int
self.do_options (os, self.type)
def ly (self):
- return self.substring ('code')
+ contents = self.substring ('code')
+ return ('\\sourcefileline %d\n%s'
+ % (self.line_number - 1, contents))
def full_ly (self):
s = self.ly ()
## strip version string to make automated regtest comparisons
## across versions easier.
contents = re.sub (r'\\version *"[^"]*"', '', contents)
-
- return ('\\sourcefilename \"%s\"\n%s'
+
+ return ('\\sourcefilename \"%s\"\n\\sourcefileline 0\n%s'
% (name, contents))
snippet_type_to_class = {
#(ly:add-file-name-alist '(
""")
for ly in lys:
- snippet_map.write ('("%s.ly" . "%s:%d (%s.ly)")\n'
+ snippet_map.write ('("%s.ly" . "%s")\n'
% (ly.basename (),
- name,
- ly.line_number,
- ly.basename ()))
+ name))
snippet_map.write ('))\n')