2 my-lily-parser.cc -- implement My_lily_parser
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 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"
16 #include "scm-hash.hh"
18 My_lily_parser::My_lily_parser (Sources * source)
22 default_duration_ = Duration (2,0);
24 last_beam_start_ = SCM_EOL;
29 My_lily_parser::~My_lily_parser ()
33 scm_gc_unprotect_object (default_header_->self_scm());
37 My_lily_parser::set_version_check (bool)
42 My_lily_parser::parse_file (String init, String s)
44 lexer_ = new My_lily_lexer;
46 lexer_->main_input_string_ = s;
48 progress_indication (_ ("Parsing..."));
51 lexer_->new_input (init, source_);
54 progress_indication ("\n");
56 if (!define_spots_.empty ())
58 define_spots_.top ().warning (_ ("Braces don't match"));
62 inclusion_globals = lexer_->filename_strings_;
64 error_level_ = error_level_ | lexer_->errorlevel_; // ugh naming.
68 My_lily_parser::push_spot ()
70 define_spots_.push (here_input ());
74 My_lily_parser::here_str0 () const
76 return lexer_->here_str0 ();
80 My_lily_parser::parser_error (String s)
82 here_input ().error (s);
84 exit_status_global = 1;
90 My_lily_parser::pop_spot ()
92 return define_spots_.pop ();
96 My_lily_parser::here_input () const
98 return lexer_->here_input ();
102 #include "paper-def.hh"
103 #include "translator-def.hh"
105 My_lily_parser * current_parser;
107 MAKE_SCHEME_CALLBACK (My_lily_parser,paper_description, 0);
110 My_lily_parser::paper_description ()
112 My_lily_parser * me = current_parser;
114 Music_output_def *id = unsmob_music_output_def (me->lexer_->lookup_identifier ("$defaultpaper"));
115 Paper_def *p = dynamic_cast<Paper_def*> (id->clone ());
117 SCM al = p->translator_tab_->to_alist ();
119 for (SCM s = al ; gh_pair_p (s); s = ly_cdr (s))
121 Translator_def * td = unsmob_translator_def (ly_cdar (s));
122 l = gh_cons (gh_cons (ly_caar (s), td->to_alist ()), l);