]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
bcd6799b04cee280b9ec5a5cf3a3969ea4c7e072
[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--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef MY_LILY_LEXER_HH
10 #define MY_LILY_LEXER_HH
11
12 #include "includable-lexer.hh"
13
14 #include "input.hh"
15 #include "lily-proto.hh"
16 #include "flower-proto.hh"
17 #include "array.hh"
18 #include "string.hh"
19 #include "duration.hh"
20 #include "pitch.hh"
21 #include "protected-scm.hh"
22
23 bool busy_parsing ();
24 void kill_lexer ();
25 void set_lexer ();
26
27 /*
28   TODO: this has a lot of SCM objects. Smobify me.
29  */
30 class My_lily_lexer : public Includable_lexer 
31 {
32 public:
33   Protected_scm scopes_;
34   Protected_scm encoding_;
35   
36 private:
37   int lookup_keyword (String);
38   int scan_bare_word (String);
39   SCM scan_markup_word (String);
40   int scan_escaped_word (String);
41   int identifier_type (SCM);
42   char escaped_char (char) const;
43
44 public:
45   String main_input_name_;
46   void *lexval;
47   bool main_input_b_;
48   
49   Sources *sources_; 
50
51   /* Scheme hash tables with (oct name acc)  values, and symbol keys.  */
52   Protected_scm chordmodifier_tab_;
53   Protected_scm pitchname_tab_stack_;
54
55   Keyword_table *keytable_;
56   int error_level_;
57   Input last_input_;
58
59   My_lily_lexer (Sources*);
60   My_lily_lexer (My_lily_lexer const&);
61   ~My_lily_lexer ();
62
63   int yylex ();
64
65   void prepare_for_next_token ();
66   int try_special_identifiers (SCM* ,SCM);
67   Input here_input () const;
68   
69   void add_scope (SCM);
70   SCM remove_scope ();
71   
72   void start_main_input ();
73
74   SCM lookup_identifier (String s);
75   SCM lookup_identifier_symbol (SCM s);
76   void push_chord_state (SCM tab);
77   void push_figuredbass_state ();
78   void push_lyric_state ();
79   void push_initial_state ();
80   void push_markup_state ();
81   void push_note_state (SCM tab);
82   void pop_state ();
83   void LexerError (char const *);
84   void set_encoding (String);
85   SCM encoding () const;
86   void set_identifier (SCM name_string, SCM);
87   bool is_note_state () const;
88   bool is_chord_state () const;
89   bool is_lyric_state () const;
90   bool is_figure_state () const;
91 };
92
93 #endif /* MY_LILY_LEXER_HH */