]> git.donarmstrong.com Git - lilypond.git/blob - hdr/lexer.hh
release: 0.0.17
[lilypond.git] / hdr / lexer.hh
1 #ifndef LEXER_HH
2 #define LEXER_HH
3 #include <FlexLexer.h>
4 #include "proto.hh"
5 #include "fproto.hh"
6 #include "sstack.hh"
7 #include "string.hh"
8
9 int yylex();
10 void yyerror(const char *s);
11 bool busy_parsing();
12 void kill_lexer();
13 void set_lexer();
14
15 struct Input_file {
16         istream*is;
17         int line;
18         String name;
19
20         Input_file(String);
21         ~Input_file();
22 };
23
24
25 /// lexer with provisions for include files.
26 struct My_flex_lexer : yyFlexLexer {
27
28     sstack<Input_file*> include_stack;
29     Assoc<String, Identifier*> *the_id_tab;
30     Keyword_table * keytable;
31     Notename_tab * defaulttab;
32
33     /****************/
34     
35     void set(Notename_tab *n);
36     int     lookup_keyword(String);
37     void lookup_notename(int &large, int &small, String s);
38     void LexerError(const char *);
39     Identifier*lookup_identifier(String s);
40     My_flex_lexer();
41     void add_identifier(Identifier*i);
42     ~My_flex_lexer();
43     void new_input(String s);
44     bool  close_input();
45     int yylex();
46 };
47
48 extern My_flex_lexer *lexer;
49
50 #endif