OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 Input | 340 Input |
341 Lily_lexer::here_input () const | 341 Lily_lexer::here_input () const |
342 { | 342 { |
343 return Input (*lexloc_); | 343 return Input (*lexloc_); |
344 } | 344 } |
345 | 345 |
346 Input const & | 346 Input const & |
347 Lily_lexer::override_input (Input const &in) const | 347 Lily_lexer::override_input (Input const &in) const |
348 { | 348 { |
349 return override_input_.get_source_file () | 349 return override_input_.get_source_file () |
350 ? override_input_ : in; | 350 ? override_input_ : in; |
351 } | 351 } |
352 | 352 |
353 void | 353 void |
354 Lily_lexer::prepare_for_next_token () | 354 Lily_lexer::prepare_for_next_token () |
355 { | 355 { |
356 last_input_ = here_input (); | 356 last_input_ = here_input (); |
357 } | 357 } |
358 | 358 |
359 /** | 359 /** |
360 Since we don't create the buffer state from the bytes directly, we | 360 Since we don't create the buffer state from the bytes directly, we |
361 don't know about the location of the lexer. Add this as a | 361 don't know about the location of the lexer. Add this as a |
362 YY_USER_ACTION */ | 362 YY_USER_ACTION */ |
363 void | 363 void |
364 Lily_lexer::add_lexed_char (int count) | 364 Lily_lexer::add_lexed_char (int count) |
365 { | 365 { |
366 char const *start = here_str0 (); | 366 char const *start = here_str0 (); |
367 lexloc_->set (get_source_file (), | 367 lexloc_->set (get_source_file (), |
368 start, start + count); | 368 start, start + count); |
369 char_count_stack_.back () += count; | 369 char_count_stack_.back () += count; |
370 } | 370 } |
371 | 371 |
372 | 372 const char *const Lily_lexer::type_p_name_ = "ly:lily-lexer?"; |
373 const char * const Lily_lexer::type_p_name_ = "ly:lily-lexer?"; | |
374 | 373 |
375 SCM | 374 SCM |
376 Lily_lexer::mark_smob () const | 375 Lily_lexer::mark_smob () const |
377 { | 376 { |
378 ASSERT_LIVE_IS_ALLOWED (self_scm ()); | 377 ASSERT_LIVE_IS_ALLOWED (self_scm ()); |
379 | 378 |
380 scm_gc_mark (chordmodifier_tab_); | 379 scm_gc_mark (chordmodifier_tab_); |
381 if (parser_) | 380 if (parser_) |
382 scm_gc_mark (parser_->self_scm ()); | 381 scm_gc_mark (parser_->self_scm ()); |
383 scm_gc_mark (pitchname_tab_stack_); | 382 scm_gc_mark (pitchname_tab_stack_); |
384 scm_gc_mark (start_module_); | 383 scm_gc_mark (start_module_); |
385 scm_gc_mark (extra_tokens_); | 384 scm_gc_mark (extra_tokens_); |
386 return scopes_; | 385 return scopes_; |
387 } | 386 } |
388 | 387 |
389 int | 388 int |
390 Lily_lexer::print_smob (SCM port, scm_print_state *) const | 389 Lily_lexer::print_smob (SCM port, scm_print_state *) const |
391 { | 390 { |
392 scm_puts ("#<Lily_lexer ", port); | 391 scm_puts ("#<Lily_lexer ", port); |
393 scm_display (scopes_, port); | 392 scm_display (scopes_, port); |
394 scm_puts (" >", port); | 393 scm_puts (" >", port); |
395 return 1; | 394 return 1; |
396 } | 395 } |
397 | 396 |
398 bool | 397 bool |
399 Lily_lexer::is_clean () const | 398 Lily_lexer::is_clean () const |
400 { | 399 { |
401 return include_stack_.empty (); | 400 return include_stack_.empty (); |
402 } | 401 } |
OLD | NEW |