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"
15 #include "file-results.hh"
18 My_lily_parser::My_lily_parser (Sources * source_l)
22 default_duration_.durlog_i_ = 2;
29 My_lily_parser::~My_lily_parser()
32 delete default_header_p_;
36 My_lily_parser::set_version_check (bool )
41 My_lily_parser::parse_file (String init, String s)
43 lexer_p_ = new My_lily_lexer;
45 lexer_p_->main_input_str_ = s;
47 progress_indication (_("Parsing..."));
49 set_yydebug (flower_dstream &&!flower_dstream->silent_b ("Parser"));
50 lexer_p_->new_input (init, source_l_);
53 if (!define_spot_array_.empty())
55 define_spot_array_.top ().warning (_ ("Braces don't match"));
59 inclusion_global_array = lexer_p_->filename_str_arr_;
61 error_level_i_ = error_level_i_ | lexer_p_->errorlevel_i_; // ugh naming.
65 My_lily_parser::remember_spot()
67 define_spot_array_.push (here_input());
71 My_lily_parser::here_ch_C() const
73 return lexer_p_->here_ch_C();
77 My_lily_parser::parser_error (String s)
79 here_input().error (s);
81 exit (fatal_error_i_);
87 My_lily_parser::set_last_duration (Duration const *d)
89 default_duration_ = *d;
94 My_lily_parser::pop_spot()
96 return define_spot_array_.pop();
100 My_lily_parser::here_input() const
102 return lexer_p_->here_input ();
106 #include "paper-def.hh"
107 #include "identifier.hh"
108 #include "translator-def.hh"
110 My_lily_parser * current_parser;
112 MAKE_SCHEME_CALLBACK(My_lily_parser,paper_description, 0);
115 My_lily_parser::paper_description ()
117 My_lily_parser * me = current_parser;
119 Identifier *id = unsmob_identifier (me->lexer_p_->lookup_identifier ("$defaultpaper"));
120 Paper_def *p = dynamic_cast<Paper_def*> (id->access_content_Music_output_def (false));
122 SCM al = p->translator_p_dict_p_->to_alist ();
124 for (SCM s = al ; gh_pair_p (s); s = gh_cdr (s))
126 Translator_def * td = unsmob_translator_def (gh_cdar (s));
127 l = gh_cons (td->to_alist (), l);