X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=blobdiff_plain;f=scilab%2Fmodules%2Fast%2Fsrc%2Fcpp%2Fparse%2Fparser.cpp;h=9be6c35401fa6189ea5badabcd546dc7f8bfb736;hp=c0af39acf7401d473a86610a7e38d615c26a7274;hb=7c046db1323032a32d0a28809dd9777e61d0b6e2;hpb=4a0bce8837f92a9a4475c46145a8a4746a323e62 diff --git a/scilab/modules/ast/src/cpp/parse/parser.cpp b/scilab/modules/ast/src/cpp/parse/parser.cpp index c0af39a..9be6c35 100644 --- a/scilab/modules/ast/src/cpp/parse/parser.cpp +++ b/scilab/modules/ast/src/cpp/parse/parser.cpp @@ -176,6 +176,19 @@ void Parser::parse(const wchar_t *command) FREE(pstCommand); } +bool Parser::stopOnFirstError(void) +{ + return ParserSingleInstance::stopOnFirstError(); +} +void Parser::enableStopOnFirstError(void) +{ + ParserSingleInstance::enableStopOnFirstError(); +} +void Parser::disableStopOnFirstError(void) +{ + ParserSingleInstance::disableStopOnFirstError(); +} + /** \brief parse the given file command */ void ParserSingleInstance::parse(const char *command) { @@ -283,6 +296,11 @@ std::wstring& ParserSingleInstance::getErrorMessage(void) void ParserSingleInstance::appendErrorMessage(const std::wstring& message) { + if (ParserSingleInstance::stopOnFirstError() && _error_message.empty() == false) + { + return; + } + _error_message += message; } @@ -316,7 +334,7 @@ std::wstring ParserSingleInstance::_file_name; std::wstring ParserSingleInstance::_prog_name; std::wstring ParserSingleInstance::_error_message; bool ParserSingleInstance::_strict_mode = false; -bool ParserSingleInstance::_stop_on_first_error = false; +bool ParserSingleInstance::_stop_on_first_error = true; ast::Exp* ParserSingleInstance::_the_program = nullptr; Parser::ParserStatus ParserSingleInstance::_exit_status = Parser::Succeded; std::list ParserSingleInstance::_control_status;