]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lily-parser.hh
*** empty log message ***
[lilypond.git] / lily / include / lily-parser.hh
1 /*
2   lily-parser.hh -- declare Lily_parser
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef MY_LILY_PARSER_HH
10 #define MY_LILY_PARSER_HH
11
12 #include "duration.hh"
13 #include "input.hh"
14 #include "parray.hh"
15 #include "pitch.hh"
16
17 /**
18    State for the parser.  Do not ever add any variables to parse
19    musical content here.  We still have to remove default_duration_.
20
21    TODO: interface is too complicated
22 */
23 class Lily_parser 
24 {
25   DECLARE_SMOBS (Lily_parser, );
26   friend int yyparse (void*);
27
28   Array<Input> define_spots_;
29
30   char const* here_str0 () const;
31   Simultaneous_music *get_chord (Pitch tonic,
32                                  Array<Pitch> *adds, Array<Pitch> *subs,
33                                  Pitch *inversion, Pitch* bass, Duration d);
34   void set_chord_tremolo (int type_i);
35   void set_last_duration (Duration const *);
36   void set_last_pitch (Pitch const *);
37
38 public:
39   Lily_lexer *lexer_;
40   Sources *sources_;
41   Duration default_duration_;
42   String output_basename_;
43
44   int score_count_;
45   int book_count_;
46
47   int fatal_error_;
48   int error_level_;
49   bool ignore_version_b_;
50   SCM last_beam_start_;
51
52   Lily_parser (Sources *sources);
53   Lily_parser (Lily_parser const&);
54
55   DECLARE_SCHEME_CALLBACK (layout_description, ());
56
57   void beam_check (SCM); 
58   void do_init_file ();
59   void do_yyparse ();
60   void parse_file (String init, String name, String out_name);
61   void parse_string (String ly_code);
62   void parser_error (String);
63   void parser_error (Input const&, String);
64   void set_yydebug (bool);
65 };
66
67 DECLARE_UNSMOB (Lily_parser, my_lily_parser);
68
69 SCM ly_parse_file (SCM);
70 SCM ly_parse_string (SCM);
71 // SCM ly_parser_add_book_and_score (SCM, SCM);
72 SCM ly_parser_print_book (SCM, SCM);
73 SCM ly_parser_print_score (SCM, SCM);
74 SCM ly_parser_bookify (SCM, SCM);
75 SCM ly_parser_scorify (SCM, SCM);
76
77 Output_def *get_layout (Lily_parser *parser);
78 Output_def *get_midi (Lily_parser *parser);
79 Output_def *get_paper (Lily_parser *parser);
80
81 #endif /* MY_LILY_PARSER_HH */