]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lexer.hh
release: 0.0.42.pre3
[lilypond.git] / lily / include / lexer.hh
1 /*
2   lexer.hh -- declare My_flex_lexer
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #ifndef LEXER_HH
10 #define LEXER_HH
11 #include <FlexLexer.h>
12 #include "proto.hh"
13 #include "fproto.hh"
14 #include "varray.hh"
15 #include "string.hh"
16
17 int yylex();
18 void yyerror(char const *s);
19 bool busy_parsing();
20 void kill_lexer();
21 void set_lexer();
22
23
24 struct Lexer_prefs {
25     int default_duration, default_dots, default_octave_i_;
26     int default_plet_type, default_plet_dur;
27     String textstyle_str_;
28     
29     bool last_duration_mode ;
30     
31     Lexer_prefs();
32     Moment plet_mom();
33     void set_default_duration(int *);
34     void set_last_duration(int n);
35     void set_duration_mode(String s);
36     void get_default_duration(int *);
37     void set_plet(int,int);
38 };
39
40 /// lexer with provisions for include files.
41 struct My_flex_lexer : yyFlexLexer {
42     Lexer_prefs prefs;
43     
44     Array<Input_file*> include_stack_;
45     Assoc<String, Identifier*> *identifier_assoc_p_;
46     Keyword_table * keytable_p_;
47     int errorlevel_i_;
48
49     /* *************** */
50
51     char const* here_ch_c_l();
52     int lookup_keyword(String);
53     void lookup_notename(int &large, int &small, String s);
54
55     void push_note_state();
56     void push_lyric_state();
57     void pop_state();
58     void LexerError(char const *);
59     String spot() const;
60     Identifier*lookup_identifier(String s);
61     My_flex_lexer();
62     void add_identifier(Identifier*i);
63     ~My_flex_lexer();
64     void new_input(String s);
65     bool  close_input();
66     int yylex();
67     void print_declarations() const;
68 };
69
70 extern My_flex_lexer *lexer;
71
72 #endif