]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lexer.hh
266ee22a56c385caa26c95952e37580add593d37
[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(const char *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     void LexerError(const char *);
55     String spot() const;
56     Identifier*lookup_identifier(String s);
57     My_flex_lexer();
58     void add_identifier(Identifier*i);
59     ~My_flex_lexer();
60     void new_input(String s);
61     bool  close_input();
62     int yylex();
63     void print_declarations() const;
64 };
65
66 extern My_flex_lexer *lexer;
67
68 #endif