2 my-lily-parser.cc -- implement My_lily_parser
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "my-lily-parser.hh"
11 #include "my-lily-lexer.hh"
14 #include "music-list.hh"
15 #include "musical-request.hh"
16 #include "command-request.hh"
17 #include "lily-guile.hh"
20 #include "file-results.hh"
21 #include "midi-def.hh"
22 #include "paper-def.hh"
23 #include "identifier.hh"
26 My_lily_parser::My_lily_parser (Sources * source_l)
30 chord_tremolo_type_i_ = 0;
31 default_duration_.durlog_i_ = 2;
38 My_lily_parser::~My_lily_parser()
41 delete default_header_p_;
45 My_lily_parser::set_version_check (bool ig)
47 ignore_version_b_ = ig;
51 My_lily_parser::parse_file (String init, String s)
53 lexer_p_ = new My_lily_lexer;
55 lexer_p_->main_input_str_ = s;
57 progress_indication (_("Parsing..."));
59 set_yydebug (flower_dstream &&!flower_dstream->silent_b ("Parser"));
60 lexer_p_->new_input (init, source_l_);
63 if (!define_spot_array_.empty())
65 warning (_ ("Braces don't match"));
69 inclusion_global_array = lexer_p_->filename_str_arr_;
71 error_level_i_ = error_level_i_ | lexer_p_->errorlevel_i_; // ugh naming.
75 My_lily_parser::remember_spot()
77 define_spot_array_.push (here_input());
81 My_lily_parser::here_ch_C() const
83 return lexer_p_->here_ch_C();
87 My_lily_parser::parser_error (String s)
89 here_input().error (s);
91 exit (fatal_error_i_);
97 My_lily_parser::set_last_duration (Duration const *d)
99 default_duration_ = *d;
103 My_lily_parser::set_chord_tremolo (int type_i)
105 chord_tremolo_type_i_ = type_i;
113 My_lily_parser::get_chord (Musical_pitch tonic,
114 Array<Musical_pitch>* add_arr_p,
115 Array<Musical_pitch>* sub_arr_p,
116 Musical_pitch* inversion_p,
117 Musical_pitch* bass_p,
120 Simultaneous_music*v = new Request_chord;
121 v->set_spot (here_input ());
124 UARGAUGRAGRUAUGRUINAGRAUGIRNA
128 Chord chord = to_chord (tonic, add_arr_p, sub_arr_p, inversion_p, bass_p);
130 Tonic_req* t = new Tonic_req;
136 && Chord::find_notename_i (&chord.pitch_arr_, *inversion_p) > 0)
138 Inversion_req* i = new Inversion_req;
139 i->pitch_ = *inversion_p;
145 Bass_req* b = new Bass_req;
150 Array<Musical_pitch> pitch_arr = chord.to_pitch_arr ();
151 for (int i = 0; i < pitch_arr.size (); i++)
153 Musical_pitch p = pitch_arr[i];
154 Note_req* n = new Note_req;
166 My_lily_parser::pop_spot()
168 return define_spot_array_.pop();
172 My_lily_parser::here_input() const
174 return lexer_p_->here_input ();