]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/lily-lexer.hh
release commit
[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--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 "smobs.hh"
22
23 bool busy_parsing ();
24 void kill_lexer ();
25 void set_lexer ();
26
27 class Lily_lexer : public Includable_lexer 
28 {
29   DECLARE_SMOBS(Lily_lexer,);
30 public:
31   SCM scopes_;
32   SCM encoding_;
33   
34 private:
35   int lookup_keyword (String);
36   int scan_bare_word (String);
37   SCM scan_markup_word (String);
38   int scan_escaped_word (String);
39   int identifier_type (SCM);
40   char escaped_char (char) const;
41
42   Keyword_table *keytable_;
43 public:
44   String main_input_name_;
45   void *lexval;
46   bool main_input_b_;
47   
48   Sources *sources_; 
49
50   /* Scheme hash tables with (oct name acc)  values, and symbol keys.  */
51   SCM chordmodifier_tab_;
52   SCM pitchname_tab_stack_;
53
54   int error_level_;
55   Input last_input_;
56
57   Lily_lexer (Sources*);
58   Lily_lexer (Lily_lexer const&);
59   int yylex ();
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 remove_scope ();
67   
68   void start_main_input ();
69
70   SCM lookup_identifier (String s);
71   SCM lookup_identifier_symbol (SCM s);
72   void push_chord_state (SCM tab);
73   void push_figuredbass_state ();
74   void push_lyric_state ();
75   void push_initial_state ();
76   void push_markup_state ();
77   void push_note_state (SCM tab);
78   void pop_state ();
79   void LexerError (char const *);
80   void set_encoding (String);
81   SCM encoding () const;
82   void set_identifier (SCM name_string, SCM);
83   bool is_note_state () const;
84   bool is_chord_state () const;
85   bool is_lyric_state () const;
86   bool is_figure_state () const;
87 };
88
89 #endif /* MY_LILY_LEXER_HH */