]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
123cf747049cd99eb1f3c0559cc3de526eb8a32a
[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 "includable-lexer.hh"
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 "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   Protected_scm scopes_;
32 public:
33   String main_input_string_;
34   void * lexval;
35   bool main_input_b_;
36
37   /*
38     Scheme hash tables with (oct name acc)  values, and symbol keys
39    */
40   Protected_scm chordmodifier_tab_;
41   Protected_scm pitchname_tab_;
42   Keyword_table * keytable_;
43   int errorlevel_;
44
45   My_lily_lexer ();
46   ~My_lily_lexer ();
47   int yylex ();
48
49   Input last_input_;
50   void prepare_for_next_token ();
51   int try_special_identifiers (SCM* ,SCM);
52   Input here_input () const;
53   
54   void add_scope (SCM);
55   SCM remove_scope ();
56   
57   void start_main_input ();
58
59   SCM lookup_identifier (String s);
60   void push_note_state ();
61   void push_markup_state ();
62   void push_figuredbass_state ();
63   void push_chord_state ();
64   void push_lyric_state ();
65   void pop_state ();
66   void LexerError (char const *);
67   void set_identifier (SCM name_string, SCM);
68   bool note_state_b () const;
69   bool chord_state_b () const;
70   bool lyric_state_b () const;
71   bool figure_state_b () const;
72 private:
73   int lookup_keyword (String);
74   int scan_bare_word (String);
75   SCM scan_markup_word (String);
76   int scan_escaped_word (String);
77   int identifier_type (SCM);
78   char escaped_char (char) const;
79 };
80
81 #endif