2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LILY_PARSER_HH
21 #define LILY_PARSER_HH
23 #include "duration.hh"
28 State for the parser. Do not ever add any variables to parse
29 musical content here. We still have to remove default_duration_.
31 TODO: interface is too complicated
35 DECLARE_SMOBS (Lily_parser);
37 char const *here_str0 () const;
38 Simultaneous_music *get_chord (Pitch tonic,
39 vector<Pitch> *adds, vector<Pitch> *subs,
40 Pitch *inversion, Pitch *bass, Duration d);
41 void set_chord_tremolo (int type);
42 void set_last_duration (Duration const *);
43 void set_last_pitch (Pitch const *);
48 Duration default_duration_;
49 string output_basename_;
54 bool ignore_version_b_;
56 Lily_parser (Sources *sources);
57 Lily_parser (Lily_parser const &, SCM closures = SCM_EOL,
58 SCM location = SCM_BOOL_F);
60 DECLARE_SCHEME_CALLBACK (layout_description, ());
65 void include_string (const string &ly_code);
66 void parse_file (const string &init, const string &name, const string &out_name);
67 void parse_string (const string &ly_code);
68 SCM parse_string_expression (const string &ly_code, const string &filename, int line);
69 void parser_error (const string&);
70 void parser_error (Input const &, const string&);
71 // The following is called as yyerror
72 static void parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s);
73 void set_yydebug (bool);
75 SCM make_scope () const;
78 DECLARE_UNSMOB (Lily_parser, lily_parser);
80 Output_def *get_layout (Lily_parser *parser);
81 Output_def *get_midi (Lily_parser *parser);
82 Output_def *get_paper (Lily_parser *parser);
83 void init_papers (Lily_parser *parser);
84 void push_paper (Lily_parser *parser, Output_def *paper);
85 void pop_paper (Lily_parser *parser);
86 void set_paper (Lily_parser *parser, Output_def *paper);
87 SCM get_header (Lily_parser *parser);
89 #endif /* LILY_PARSER_HH */