X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparse-scm.cc;h=3204dec58a3216116ec4d4cf2648272eeff6383d;hb=460f573a185f76f076b572b33368434a1548193d;hp=5780e7360edd338ee712f62206c5e17a2a73fcc0;hpb=899a5926b98860f3d5db399616d9211927fbfa3c;p=lilypond.git diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 5780e7360e..3204dec58a 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -76,7 +76,7 @@ parse_handler (void * data, SCM tag, SCM args) { Parse_start* ps = (Parse_start*) data; - ps->start_location_.error (_("GUILE signaled an error for the expression begining here")); + ps->start_location_.error (_("GUILE signaled an error for the expression beginning here")); if (scm_ilength (args) > 2) scm_display_error_message (gh_cadr (args), gh_caddr(args), scm_current_error_port()); @@ -87,7 +87,7 @@ parse_handler (void * data, SCM tag, SCM args) */ ps->nchars = 1; - return SCM_EOL; + return SCM_UNDEFINED; } /* @@ -109,21 +109,13 @@ protected_ly_parse_scm (Parse_start *ps) &catch_protected_parse_body, (void*)ps, &parse_handler, (void*)ps); - } +bool parse_protect_global = true; -static bool protect = true; - -LY_DEFINE(set_parse_protect, "ly:set-parse-protect", - 1,0,0, (SCM t), - "If protection is switched on, errors in inline scheme are caught. -If off, GUILE will halt on errors, and give a stack trace. Default is protected evaluation.") -{ - protect = (t == SCM_BOOL_T); - return SCM_UNSPECIFIED; -} - +/* + Try parsing. If failure, then return SCM_UNDEFINED. + */ SCM ly_parse_scm (char const* s, int *n, Input i) { @@ -132,9 +124,10 @@ ly_parse_scm (char const* s, int *n, Input i) ps.str = s; ps.start_location_ = i; - SCM ans = protect ? protected_ly_parse_scm (&ps) + SCM ans = parse_protect_global ? protected_ly_parse_scm (&ps) : internal_ly_parse_scm (&ps); *n = ps.nchars; + return ans; }