X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flily-parser.cc;h=5c1a3d358d61f390212f14915fa60e1d5c3536ce;hb=b92ea16ef75d8aaa7bdb9f492b58d7af906e7945;hp=ba3bd0f99be8c0f5a503d5dffe50d7cb007f047a;hpb=4a401ca1c60f428daa242dbdd102fdb3f327ebfb;p=lilypond.git diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index ba3bd0f99b..5c1a3d358d 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -163,6 +163,36 @@ Lily_parser::parse_string (string ly_code) error_level_ = error_level_ | lexer_->error_level_; } +SCM +Lily_parser::parse_string_expression (string ly_code) +{ + // TODO: use $parser + lexer_->set_identifier (ly_symbol2scm ("parser"), + self_scm ()); + + lexer_->main_input_name_ = ""; + lexer_->is_main_input_ = true; + lexer_->new_input (lexer_->main_input_name_, ly_code, sources_); + + SCM mod = lexer_->set_current_scope (); + lexer_->push_embedded_token (); + do_yyparse (); + SCM result = lexer_->lookup_identifier_symbol (ly_symbol2scm ("$parseStringResult")); + // $parseStringResult is set in the grammar rule for embedded_lilypond + + scm_set_current_module (mod); + + if (!define_spots_.empty ()) + { + if (define_spots_.empty () + && !error_level_) + programming_error ("define_spots_ don't match, but error_level_ not set."); + } + + error_level_ = error_level_ | lexer_->error_level_; + return result; +} + void Lily_parser::include_string (string ly_code) {