From: Han-Wen Nienhuys Date: Fri, 5 Jan 2007 11:48:46 +0000 (+0100) Subject: better expect-error handling. Thinko for is_main_input_ reset. X-Git-Tag: release/2.11.9-1~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d4e40a82e55eae5d6c0ad5dda1af230663ab5bec;p=lilypond.git better expect-error handling. Thinko for is_main_input_ reset. --- diff --git a/THANKS b/THANKS index f1f333c0ab..c15d646d2b 100644 --- a/THANKS +++ b/THANKS @@ -30,6 +30,7 @@ Carl Sorensen Christian Hitz David Bobroff Eduardo Vieira +Georg Dummer Jay Anderson Jean-Marie Mouchel Kazuhiro Suzuki diff --git a/lily/lexer.ll b/lily/lexer.ll index 6e34777e26..9ce0da012d 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -570,8 +570,11 @@ BOM_UTF8 \357\273\277 <*><> { if (is_main_input_) { - /* 2 = init.ly + current file. */ - is_main_input_ = include_stack_.size () >= 2; + /* 2 = init.ly + current file. + > because we're before closing, but is_main_input_ should + reflect after. + */ + is_main_input_ = include_stack_.size () > 2; if (!close_input ()) /* Returns YY_NULL */ yyterminate (); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index cd46e9774b..47a0095a44 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -268,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_); +} diff --git a/ly/init.ly b/ly/init.ly index da97ded0e6..f6c928e301 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -42,5 +42,6 @@ (apply ly:make-book $defaultpaper $defaultheader toplevel-scores))) -#(if expect-error - (ly:parser-clear-error parser)) +#(if (eq? expect-error (ly:parser-has-error? parser)) + (ly:parser-clear-error parser) + (ly:parser-error parser (_ "expected error, but none found")))