]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
* lily/font-interface.cc (get-font): take alist chain i.s.o. alist
[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 "input.hh"
15 #include "dictionary.hh"
16 #include "lily-proto.hh"
17 #include "flower-proto.hh"
18 #include "array.hh"
19 #include "string.hh"
20 #include "includable-lexer.hh"
21 #include "duration.hh"
22 #include "pitch.hh"
23 #include "protected-scm.hh"
24
25 bool busy_parsing ();
26 void kill_lexer ();
27 void set_lexer ();
28
29 /// lexer for Lilypond
30 class My_lily_lexer : public Includable_lexer 
31 {
32   Protected_scm scopes_;
33 public:
34   String main_input_string_;
35   void * lexval;
36   bool main_input_b_;
37
38   /*
39     Scheme hash tables with (oct name acc)  values, and symbol keys
40    */
41   Protected_scm chordmodifier_tab_;
42   Protected_scm pitchname_tab_;
43   Keyword_table * keytable_;
44   int errorlevel_;
45
46   My_lily_lexer ();
47   ~My_lily_lexer ();
48   int yylex ();
49
50   Input last_input_;
51   void prepare_for_next_token ();
52   int try_special_identifiers (SCM* ,SCM);
53   Input here_input () const;
54   
55   void add_scope (SCM);
56   SCM remove_scope ();
57   
58   void start_main_input ();
59
60   SCM lookup_identifier (String s);
61   void push_note_state ();
62   void push_markup_state ();
63   void push_figuredbass_state ();
64   void push_chord_state ();
65   void push_lyric_state ();
66   void pop_state ();
67   void LexerError (char const *);
68   void set_identifier (SCM name_string, SCM);
69   bool note_state_b () const;
70   bool chord_state_b () const;
71   bool lyric_state_b () const;
72   bool figure_state_b () const;
73 private:
74   int lookup_keyword (String);
75   int scan_bare_word (String);
76   SCM scan_markup_word (String);
77   int scan_escaped_word (String);
78   int identifier_type (SCM);
79   char escaped_char (char) const;
80 };
81
82 #endif