Mercurial > octave
diff libinterp/parse-tree/parse.h @ 21073:f7cc48f601d2
additional reworking of error handling in the parser (bug #46877)
* oct-parse.in.yy (ABORT_PARSE): Delete. Replace all uses with
YYABORT. Ensure that all uses of octave_base_parser::bison_error are
followed by YYABORT.
(octave_base_parser::make_for_command): Always delete unused parse
tree elements if an error is detected.
octave_base_parser::make_index_expression): Likewise.
(octave_base_parser::parse_error_msg): New data member.
(octave_base_parser::bison_error): Store error message for later use
instead of calling parse_error.
(octave_parser::run, octave_push_parser::run): Check return status of
Bison-generated parser and call parse_error here with stored message.
Handle exceptions generated while parsing.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 14 Jan 2016 16:40:12 -0500 |
parents | f25c14056b7c |
children | 538b57866b90 |
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h Thu Jan 14 13:30:22 2016 -0800 +++ b/libinterp/parse-tree/parse.h Thu Jan 14 16:40:12 2016 -0500 @@ -391,6 +391,10 @@ // Generic error messages. void bison_error (const std::string& s, int l = -1, int c = -1); + // Contains error message if Bison-generated parser returns non-zero + // status. + std::string parse_error_msg; + // Have we found an explicit end to a function? bool endfunction_found;