]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
* lily/include/my-lily-parser.hh: rename My_lily -> Lily
[lilypond.git] / lily / include / my-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 /*
28   TODO: this has a lot of SCM objects. Smobify me.
29  */
30 class Lily_lexer : public Includable_lexer 
31 {
32   DECLARE_SMOBS(Lily_lexer,);
33 public:
34   SCM scopes_;
35   SCM encoding_;
36   
37 private:
38   int lookup_keyword (String);
39   int scan_bare_word (String);
40   SCM scan_markup_word (String);
41   int scan_escaped_word (String);
42   int identifier_type (SCM);
43   char escaped_char (char) const;
44
45 public:
46   String main_input_name_;
47   void *lexval;
48   bool main_input_b_;
49   
50   Sources *sources_; 
51
52   /* Scheme hash tables with (oct name acc)  values, and symbol keys.  */
53   SCM chordmodifier_tab_;
54   SCM pitchname_tab_stack_;
55
56   Keyword_table *keytable_;
57   int error_level_;
58   Input last_input_;
59
60   Lily_lexer (Sources*);
61   Lily_lexer (Lily_lexer const&);
62   ~Lily_lexer ();
63
64   int yylex ();
65
66   void prepare_for_next_token ();
67   int try_special_identifiers (SCM* ,SCM);
68   Input here_input () const;
69   
70   void add_scope (SCM);
71   SCM remove_scope ();
72   
73   void start_main_input ();
74
75   SCM lookup_identifier (String s);
76   SCM lookup_identifier_symbol (SCM s);
77   void push_chord_state (SCM tab);
78   void push_figuredbass_state ();
79   void push_lyric_state ();
80   void push_initial_state ();
81   void push_markup_state ();
82   void push_note_state (SCM tab);
83   void pop_state ();
84   void LexerError (char const *);
85   void set_encoding (String);
86   SCM encoding () const;
87   void set_identifier (SCM name_string, SCM);
88   bool is_note_state () const;
89   bool is_chord_state () const;
90   bool is_lyric_state () const;
91   bool is_figure_state () const;
92 };
93
94 #endif /* MY_LILY_LEXER_HH */