]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lily-lexer.hh
Run `make grand-replace'.
[lilypond.git] / lily / include / lily-lexer.hh
1 /*
2   lexer.hh -- declare Lily_lexer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.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 "duration.hh"
16 #include "pitch.hh"
17
18 bool busy_parsing ();
19 void kill_lexer ();
20 void set_lexer ();
21
22 class Lily_lexer : public Includable_lexer
23 {
24   DECLARE_SMOBS (Lily_lexer);
25
26 private:
27   int lookup_keyword (string);
28   int scan_bare_word (string);
29   SCM scan_markup_word (string);
30   int scan_escaped_word (string);
31   int identifier_type (SCM);
32   char escaped_char (char) const;
33
34   Lily_parser *parser_;
35   Keyword_table *keytable_;
36   SCM scopes_;
37   SCM start_module_;
38   int hidden_state_;
39 public:
40   vector<int> extra_token_types_;
41   string main_input_name_;
42   void *lexval;
43   Input *lexloc;
44   bool is_main_input_;
45   
46   Sources *sources_;
47
48   /* Scheme hash tables with (oct name acc)  values, and symbol keys.  */
49   SCM chordmodifier_tab_;
50   SCM pitchname_tab_stack_;
51
52   int error_level_;
53   Input last_input_;
54
55   Lily_lexer (Sources *, Lily_parser *);
56   Lily_lexer (Lily_lexer const &, Lily_parser *);
57   int yylex ();
58   
59   void add_lexed_char (int);
60
61   void prepare_for_next_token ();
62   int try_special_identifiers (SCM *, SCM);
63   Input here_input () const;
64
65   void add_scope (SCM);
66   SCM set_current_scope ();
67   bool has_scope () const;
68   SCM remove_scope ();
69
70   void start_main_input ();
71
72   virtual void new_input (string s, Sources *);
73   virtual void new_input (string s, string d, Sources *);
74
75   SCM keyword_list () const;
76   SCM lookup_identifier (string s);
77   SCM lookup_identifier_symbol (SCM s);
78   void push_extra_token (int token_type);
79   void push_chord_state (SCM tab);
80   void push_figuredbass_state ();
81   void push_lyric_state ();
82   void push_initial_state ();
83   void push_markup_state ();
84   void push_note_state (SCM tab);
85   void pop_state ();
86   void LexerError (char const *);
87   void set_identifier (SCM name_string, SCM);
88   int get_state () const;
89   bool is_note_state () const;
90   bool is_chord_state () const;
91   bool is_lyric_state () const;
92   bool is_figure_state () const;
93 };
94
95 #endif /* MY_LILY_LEXER_HH */