+
+LY_DEFINE (ly_parser_output_name, "ly:parser-output-name",
+ 1, 0, 0, (SCM parser),
+ "Return the base name of the output file.")
+{
+ LY_ASSERT_SMOB (Lily_parser, parser, 1);
+ Lily_parser *p = unsmob_lily_parser (parser);
+
+ return ly_string2scm (p->output_basename_);
+}
+
+LY_DEFINE (ly_parser_error, "ly:parser-error",
+ 2, 1, 0, (SCM parser, SCM msg, SCM input),
+ "Display an error message and make the parser fail.")
+{
+ LY_ASSERT_SMOB (Lily_parser, parser, 1);
+ Lily_parser *p = unsmob_lily_parser (parser);
+
+ LY_ASSERT_TYPE (scm_is_string, msg, 2);
+ string s = ly_scm2string (msg);
+
+ Input *i = unsmob_input (input);
+ if (i)
+ p->parser_error (*i, s);
+ else
+ p->parser_error (s);
+
+ return parser;
+}
+
+LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error",
+ 1, 0, 0, (SCM parser),
+ "Clear the error flag for the parser.")
+{
+ LY_ASSERT_SMOB (Lily_parser, parser, 1);
+ Lily_parser *p = unsmob_lily_parser (parser);
+
+
+ p->error_level_ = 0;
+ p->lexer_->error_level_ = 0;
+
+ return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?",
+ 1, 0, 0, (SCM parser),
+ "Does @var{parser} have an error flag?")
+{
+ LY_ASSERT_SMOB (Lily_parser, parser, 1);
+ Lily_parser *p = unsmob_lily_parser (parser);
+
+ return scm_from_bool (p->error_level_ || p->lexer_->error_level_);
+}