]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/my-lily-lexer.hh
* lily/breathing-sign.cc (railtracks): another caesura.
[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 using namespace std;
13 #include <FlexLexer.h>
14
15 #include "input.hh"
16 #include "dictionary.hh"
17 #include "lily-proto.hh"
18 #include "flower-proto.hh"
19 #include "array.hh"
20 #include "string.hh"
21 #include "includable-lexer.hh"
22 #include "duration.hh"
23 #include "pitch.hh"
24 #include "protected-scm.hh"
25
26 bool busy_parsing ();
27 void kill_lexer ();
28 void set_lexer ();
29
30 /// lexer for Lilypond
31 class My_lily_lexer : public Includable_lexer 
32 {
33   Protected_scm scopes_;
34 public:
35   String main_input_string_;
36   void * lexval;
37   bool main_input_b_;
38
39   /*
40     Scheme hash tables with (oct name acc)  values, and symbol keys
41    */
42   Protected_scm chordmodifier_tab_;
43   Protected_scm pitchname_tab_;
44   Keyword_table * keytable_;
45   int errorlevel_;
46
47   My_lily_lexer ();
48   ~My_lily_lexer ();
49   int yylex ();
50
51   Input last_input_;
52   void prepare_for_next_token ();
53   int try_special_identifiers (SCM* ,SCM);
54   Input here_input () const;
55   
56   void add_scope (SCM);
57   SCM remove_scope ();
58   
59   void start_main_input ();
60
61   SCM lookup_identifier (String s);
62   void push_note_state ();
63   void push_markup_state ();
64   void push_figuredbass_state ();
65   void push_chord_state ();
66   void push_lyric_state ();
67   void pop_state ();
68   void LexerError (char const *);
69   void set_identifier (SCM name_string, SCM);
70   bool note_state_b () const;
71   bool chord_state_b () const;
72   bool lyric_state_b () const;
73   bool figure_state_b () const;
74 private:
75   int lookup_keyword (String);
76   int scan_bare_word (String);
77   SCM scan_markup_word (String);
78   int scan_escaped_word (String);
79   int identifier_type (SCM);
80   char escaped_char (char) const;
81 };
82
83 #endif