LEFT | RIGHT |
(no file at all) | |
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) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2005--2011 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 if (!parser->lexer_->is_clean ()) | 201 if (!parser->lexer_->is_clean ()) |
202 parser->parser_error (_ ("ly:parser-parse-string is only valid with a new pa
rser." | 202 parser->parser_error (_ ("ly:parser-parse-string is only valid with a new pa
rser." |
203 " Use ly:parser-include-string instead.")); | 203 " Use ly:parser-include-string instead.")); |
204 else | 204 else |
205 parser->parse_string (ly_scm2string (ly_code)); | 205 parser->parse_string (ly_scm2string (ly_code)); |
206 | 206 |
207 return SCM_UNSPECIFIED; | 207 return SCM_UNSPECIFIED; |
208 } | 208 } |
209 | 209 |
| 210 LY_DEFINE (ly_parse_string_expression, "ly:parse-string-expression", |
| 211 2, 0, 0, (SCM parser_smob, SCM ly_code), |
| 212 "Parse the string @var{ly-code} with @var{parser-smob}." |
| 213 " Return the contained music expression.") |
| 214 { |
| 215 LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); |
| 216 Lily_parser *parser = unsmob_lily_parser (parser_smob); |
| 217 LY_ASSERT_TYPE (scm_is_string, ly_code, 2); |
| 218 |
| 219 if (!parser->lexer_->is_clean ()) |
| 220 { |
| 221 parser->parser_error (_ ("ly:parse-string-expression is only valid with a
new parser." |
| 222 " Use ly:parser-include-string instead.")); |
| 223 return SCM_UNSPECIFIED; |
| 224 } |
| 225 |
| 226 return parser->parse_string_expression (ly_scm2string (ly_code)); |
| 227 } |
| 228 |
210 LY_DEFINE (ly_parser_include_string, "ly:parser-include-string", | 229 LY_DEFINE (ly_parser_include_string, "ly:parser-include-string", |
211 2, 0, 0, (SCM parser_smob, SCM ly_code), | 230 2, 0, 0, (SCM parser_smob, SCM ly_code), |
212 "Include the string @var{ly-code} into the input stream" | 231 "Include the string @var{ly-code} into the input stream" |
213 " for @var{parser-smob}.") | 232 " for @var{parser-smob}.") |
214 { | 233 { |
215 LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); | 234 LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); |
216 Lily_parser *parser = unsmob_lily_parser (parser_smob); | 235 Lily_parser *parser = unsmob_lily_parser (parser_smob); |
217 LY_ASSERT_TYPE (scm_is_string, ly_code, 2); | 236 LY_ASSERT_TYPE (scm_is_string, ly_code, 2); |
218 | 237 |
219 parser->include_string (ly_scm2string (ly_code)); | 238 parser->include_string (ly_scm2string (ly_code)); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 328 |
310 LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?", | 329 LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?", |
311 1, 0, 0, (SCM parser), | 330 1, 0, 0, (SCM parser), |
312 "Does @var{parser} have an error flag?") | 331 "Does @var{parser} have an error flag?") |
313 { | 332 { |
314 LY_ASSERT_SMOB (Lily_parser, parser, 1); | 333 LY_ASSERT_SMOB (Lily_parser, parser, 1); |
315 Lily_parser *p = unsmob_lily_parser (parser); | 334 Lily_parser *p = unsmob_lily_parser (parser); |
316 | 335 |
317 return scm_from_bool (p->error_level_ || p->lexer_->error_level_); | 336 return scm_from_bool (p->error_level_ || p->lexer_->error_level_); |
318 } | 337 } |
LEFT | RIGHT |