2 input.cc -- implement Input
4 source file of the LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 #include "source-file.hh"
17 Input::Input (Input const &i)
19 source_file_ = i.source_file_;
38 Input::set_spot (Input const &i)
44 Input::step_forward ()
52 Input::set_location (Input const &i_start, Input const &i_end)
54 source_file_ = i_start.source_file_;
55 start_ = i_start.start_;
60 Produce GNU-compliant error message. Correcting lilypond source is
61 such a breeze if you ('re edidor) know (s) the error column too
65 [file:line:column:][warning:]message
68 Input::message (String s) const
71 s = location_string () + ": " + s + "\n"
72 + source_file_->error_string (start_);
77 Input::warning (String s) const
79 message (_f ("warning: %s", s));
83 Input::error (String s) const
85 message (_f ("error: %s", s));
86 // UGH, fix naming or usage
91 Input::non_fatal_error (String s) const
93 message (_f ("error: %s", s));
97 Input::location_string () const
100 return source_file_->file_line_column_string (start_);
101 return " (" + _ ("position unknown") + ")";
105 Input::line_number_string () const
108 return to_string (source_file_->get_line (start_));
113 Input::file_string () const
116 return source_file_->name_string ();
121 Input::line_number () const
124 return source_file_->get_line (start_);
129 Input::column_number () const
132 return source_file_->get_column (start_);
137 Input::end_line_number () const
140 return source_file_->get_line (end_);
145 Input::end_column_number () const
148 return source_file_->get_column (end_);