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