]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lily-parser-scheme.cc
rm line-spanner.hh include
[lilypond.git] / lily / lily-parser-scheme.cc
index bb08e3c01b4ef5849d866121f292bcc89739e0b2..ca1d224bd6ac7703f7d8f54b64434fe4102965ee 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include <unistd.h>
@@ -18,7 +18,7 @@
 #include "ly-module.hh"
 #include "main.hh"
 #include "program-option.hh"
-#include "source.hh"
+#include "sources.hh"
 #include "warn.hh"
 
 /* Do not append `!' suffix, since 1st argument is not modified. */
@@ -147,22 +147,6 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
   return SCM_UNSPECIFIED;
 }
 
-LY_DEFINE (ly_parse_string, "ly:parse-string",
-          1, 0, 0, (SCM ly_code),
-          "Parse the string LY_CODE.  "
-          "Upon failure, throw @code{ly-file-failed} key.")
-{
-  SCM_ASSERT_TYPE (scm_is_string (ly_code), ly_code, SCM_ARG1, __FUNCTION__, "string");
-
-  Sources sources;
-  sources.set_path (&global_path);
-  Lily_parser *parser = new Lily_parser (&sources);
-  parser->parse_string (ly_scm2string (ly_code));
-  parser->unprotect ();
-  parser = 0;
-
-  return SCM_UNSPECIFIED;
-}
 
 LY_DEFINE (ly_parser_lexer, "ly:parser-lexer",
           1, 0, 0, (SCM parser_smob),
@@ -284,3 +268,13 @@ LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error",
   
   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?")
+{
+  Lily_parser *p = unsmob_lily_parser (parser);
+  SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
+
+  return scm_from_bool (p->error_level_ || p->lexer_->error_level_);
+}