]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
release: 1.5.29
[lilypond.git] / lily / include / my-lily-lexer.hh
1 /*
2   lexer.hh -- declare My_lily_lexer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef LEXER_HH
10 #define LEXER_HH
11
12 #include <FlexLexer.h>
13
14 #include "dictionary.hh"
15 #include "lily-proto.hh"
16 #include "flower-proto.hh"
17 #include "array.hh"
18 #include "string.hh"
19 #include "includable-lexer.hh"
20 #include "duration.hh"
21 #include "pitch.hh"
22 #include "protected-scm.hh"
23
24 bool busy_parsing ();
25 void kill_lexer ();
26 void set_lexer ();
27
28 /// lexer for Lilypond
29 class My_lily_lexer : public Includable_lexer 
30 {
31 public:
32   String main_input_str_;
33   void * lexval_l;
34   Scheme_hash_table * toplevel_variable_tab_;
35   Scope * scope_p_;
36   
37   bool main_input_b_;
38
39   /*
40     Scheme hash tables with (oct name acc)  values, and symbol keys
41    */
42   Protected_scm chordmodifier_tab_;
43   Protected_scm pitchname_tab_;
44   
45   Link_array<Scope> scope_l_arr_;
46   Keyword_table * keytable_p_;
47   int errorlevel_i_;
48
49   My_lily_lexer ();
50   ~My_lily_lexer ();
51   int yylex ();
52
53   Input here_input () const;
54
55   void start_main_input ();
56
57   SCM lookup_identifier (String s);
58   void push_note_state ();
59   void push_figuredbass_state ();
60   void push_chord_state ();
61   void push_lyric_state ();
62   void pop_state ();
63   void LexerError (char const *);
64   void set_identifier (String str, SCM);
65   bool note_state_b () const;
66   bool chord_state_b () const;
67   bool lyric_state_b () const;
68   bool figure_state_b () const;
69 private:
70   int lookup_keyword (String);
71   int scan_bare_word (String);
72   int scan_escaped_word (String);
73
74   char escaped_char (char) const;
75 };
76
77 #endif