#include <unistd.h>
+#include "lily-parser.hh"
+
#include "file-name-map.hh"
#include "file-name.hh"
#include "file-path.hh"
-#include "input.hh"
#include "international.hh"
#include "lily-lexer.hh"
-#include "lily-parser.hh"
#include "ly-module.hh"
#include "main.hh"
#include "program-option.hh"
if (dir != "" && dir != "." && dir != get_working_directory ())
{
global_path.prepend (get_working_directory ());
- message (_f ("Changing working directory to `%s'",
+ message (_f ("Changing working directory to: `%s'",
dir.c_str ()));
chdir (dir.c_str ());
}
if (init.length () && global_path.find (init).empty ())
{
- warning (_f ("can't find init file: `%s'", init));
+ warning (_f ("cannot find init file: `%s'", init));
warning (_f ("(search path: `%s')",
global_path.to_string ().c_str ()));
exit (2);
bool error = false;
if ((file_name != "-") && file_name.empty ())
{
- warning (_f ("can't find file: `%s'", file));
+ warning (_f ("cannot find file: `%s'", file));
error = true;
}
else
return SCM_UNSPECIFIED;
}
-LY_DEFINE (ly_clone_parser, "ly:clone-parser",
+LY_DEFINE (ly_parser_lexer, "ly:parser-lexer",
1, 0, 0, (SCM parser_smob),
- "Return a clone of PARSER_SMOB.")
+ "Return the lexer for @var{parser-smob}.")
+{
+ Lily_parser *parser = unsmob_lily_parser (parser_smob);
+ return parser->lexer_->self_scm ();
+}
+
+LY_DEFINE (ly_parser_clone, "ly:parser-clone",
+ 1, 0, 0, (SCM parser_smob),
+ "Return a clone of @var{parser-smob}.")
{
Lily_parser *parser = unsmob_lily_parser (parser_smob);
Lily_parser *clone = new Lily_parser (*parser);
LY_DEFINE (ly_parser_define, "ly:parser-define!",
3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
- "Bind SYMBOL to VAL in PARSER_SMOB's module.")
+ "Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.")
{
Lily_parser *parser = unsmob_lily_parser (parser_smob);
SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
LY_DEFINE (ly_parser_lookup, "ly:parser-lookup",
2, 0, 0, (SCM parser_smob, SCM symbol),
- "Lookup @var{symbol} in @var{parser_smob}'s module. "
+ "Lookup @var{symbol} in @var{parser-smob}'s module. "
"Undefined is '().")
{
Lily_parser *parser = unsmob_lily_parser (parser_smob);
LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string",
2, 0, 0, (SCM parser_smob, SCM ly_code),
- "Parse the string LY_CODE with PARSER_SMOB."
+ "Parse the string @code{ly-code} with @code{parser-smob}."
"Upon failure, throw @code{ly-file-failed} key.")
{
Lily_parser *parser = unsmob_lily_parser (parser_smob);
return parser;
}
+
+LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error",
+ 1, 0, 0, (SCM parser),
+ "Clear the error flag for the parser.")
+{
+ Lily_parser *p = unsmob_lily_parser (parser);
+ SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
+
+ p->error_level_ = 0;
+ p->lexer_->error_level_ = 0;
+
+ return SCM_UNSPECIFIED;
+}