OLD | NEW |
1 /* | 1 /* |
2 lexer.hh -- declare Lily_lexer | 2 lexer.hh -- declare Lily_lexer |
3 | 3 |
4 source file of the GNU LilyPond music typesetter | 4 source file of the GNU LilyPond music typesetter |
5 | 5 |
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl> | 6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl> |
7 */ | 7 */ |
8 | 8 |
9 #ifndef MY_LILY_LEXER_HH | 9 #ifndef MY_LILY_LEXER_HH |
10 #define MY_LILY_LEXER_HH | 10 #define MY_LILY_LEXER_HH |
11 | 11 |
12 #include "includable-lexer.hh" | 12 #include "includable-lexer.hh" |
13 | 13 |
14 #include "input.hh" | 14 #include "input.hh" |
15 #include "duration.hh" | 15 #include "duration.hh" |
16 #include "pitch.hh" | 16 #include "pitch.hh" |
17 | 17 |
18 bool busy_parsing (); | 18 bool busy_parsing (); |
19 void kill_lexer (); | 19 void kill_lexer (); |
20 void set_lexer (); | 20 void set_lexer (); |
21 | 21 |
| 22 struct Chord_repetition |
| 23 { |
| 24 Chord_repetition () |
| 25 { |
| 26 last_chord_ = SCM_EOL; |
| 27 repetition_function_ = SCM_EOL; |
| 28 repetition_symbol_ = SCM_EOL; |
| 29 } |
| 30 |
| 31 SCM repetition_symbol_; |
| 32 SCM repetition_function_; |
| 33 SCM last_chord_; |
| 34 }; |
| 35 |
22 class Lily_lexer : public Includable_lexer | 36 class Lily_lexer : public Includable_lexer |
23 { | 37 { |
24 DECLARE_SMOBS (Lily_lexer); | 38 DECLARE_SMOBS (Lily_lexer); |
25 | 39 |
26 private: | 40 private: |
27 int lookup_keyword (string); | 41 int lookup_keyword (string); |
28 int scan_bare_word (string); | 42 int scan_bare_word (string); |
29 SCM scan_markup_word (string); | 43 SCM scan_markup_word (string); |
30 int scan_escaped_word (string); | 44 int scan_escaped_word (string); |
31 int identifier_type (SCM); | 45 int identifier_type (SCM); |
32 char escaped_char (char) const; | 46 char escaped_char (char) const; |
33 | 47 |
34 Lily_parser *parser_; | 48 Lily_parser *parser_; |
35 Keyword_table *keytable_; | 49 Keyword_table *keytable_; |
36 SCM scopes_; | 50 SCM scopes_; |
37 SCM start_module_; | 51 SCM start_module_; |
38 int hidden_state_; | 52 int hidden_state_; |
39 public: | 53 public: |
40 vector<int> extra_token_types_; | 54 vector<int> extra_token_types_; |
41 void *lexval; | 55 void *lexval; |
42 Input *lexloc; | 56 Input *lexloc; |
43 bool is_main_input_; | 57 bool is_main_input_; |
44 ·· | 58 ·· |
45 Sources *sources_; | 59 Sources *sources_; |
46 | 60 |
47 /* Scheme hash tables with (oct name acc) values, and symbol keys. */ | 61 /* Scheme hash tables with (oct name acc) values, and symbol keys. */ |
48 SCM chordmodifier_tab_; | 62 SCM chordmodifier_tab_; |
49 SCM pitchname_tab_stack_; | 63 SCM pitchname_tab_stack_; |
50 | 64 |
| 65 Chord_repetition chord_repetition_; |
| 66 |
51 int error_level_; | 67 int error_level_; |
52 Input last_input_; | 68 Input last_input_; |
53 | 69 |
54 Lily_lexer (Sources *, Lily_parser *); | 70 Lily_lexer (Sources *, Lily_parser *); |
55 Lily_lexer (Lily_lexer const &, Lily_parser *); | 71 Lily_lexer (Lily_lexer const &, Lily_parser *); |
56 int yylex (); | 72 int yylex (); |
57 ·· | 73 ·· |
58 void add_lexed_char (int); | 74 void add_lexed_char (int); |
59 | 75 |
60 void prepare_for_next_token (); | 76 void prepare_for_next_token (); |
(...skipping 24 matching lines...) Expand all Loading... |
85 void LexerError (char const *); | 101 void LexerError (char const *); |
86 void set_identifier (SCM name_string, SCM); | 102 void set_identifier (SCM name_string, SCM); |
87 int get_state () const; | 103 int get_state () const; |
88 bool is_note_state () const; | 104 bool is_note_state () const; |
89 bool is_chord_state () const; | 105 bool is_chord_state () const; |
90 bool is_lyric_state () const; | 106 bool is_lyric_state () const; |
91 bool is_figure_state () const; | 107 bool is_figure_state () const; |
92 }; | 108 }; |
93 | 109 |
94 #endif /* MY_LILY_LEXER_HH */ | 110 #endif /* MY_LILY_LEXER_HH */ |
OLD | NEW |