Mercurial > hg > octave-nkf
changeset 20285:8aa424ffc076
handle all end token types when reporting parse errors (bug #44824)
* oct-parse.in.yy (octave_base_parser::end_error,
octave_base_parser::end_token_ok): Handle all end token types in
switch statement. Alphabetize list of cases (after simple_end).
* token.h (end_tok_type): Alphabetize list of token types (after
simple_end).
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 13 Apr 2015 23:41:08 -0400 |
parents | ad1a2c03992b |
children | a00d545c95df |
files | libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/token.h |
diffstat | 2 files changed, 50 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy +++ b/libinterp/parse-tree/oct-parse.in.yy @@ -2059,6 +2059,18 @@ error (fmt, type, "end", l, c); break; + case token::classdef_end: + error (fmt, type, "endclassdef", l, c); + break; + + case token::enumeration_end: + error (fmt, type, "endenumeration", l, c); + break; + + case token::events_end: + error (fmt, type, "endevents", l, c); + break; + case token::for_end: error (fmt, type, "endfor", l, c); break; @@ -2067,22 +2079,26 @@ error (fmt, type, "endfunction", l, c); break; - case token::classdef_end: - error (fmt, type, "endclassdef", l, c); - break; - case token::if_end: error (fmt, type, "endif", l, c); break; + case token::methods_end: + error (fmt, type, "endmethods", l, c); + break; + + case token::parfor_end: + error (fmt, type, "endparfor", l, c); + break; + + case token::properties_end: + error (fmt, type, "endproperties", l, c); + break; + case token::switch_end: error (fmt, type, "endswitch", l, c); break; - case token::while_end: - error (fmt, type, "endwhile", l, c); - break; - case token::try_catch_end: error (fmt, type, "end_try_catch", l, c); break; @@ -2091,6 +2107,10 @@ error (fmt, type, "end_unwind_protect", l, c); break; + case token::while_end: + error (fmt, type, "endwhile", l, c); + break; + default: panic_impossible (); break; @@ -2121,14 +2141,18 @@ end_error ("classdef", ettype, l, c); break; + case token::enumeration_end: + end_error ("enumeration", ettype, l, c); + break; + + case token::events_end: + end_error ("events", ettype, l, c); + break; + case token::for_end: end_error ("for", ettype, l, c); break; - case token::enumeration_end: - end_error ("enumeration", ettype, l, c); - break; - case token::function_end: end_error ("function", ettype, l, c); break; @@ -2137,18 +2161,26 @@ end_error ("if", ettype, l, c); break; + case token::methods_end: + end_error ("methods", ettype, l, c); + break; + case token::parfor_end: end_error ("parfor", ettype, l, c); break; + case token::properties_end: + end_error ("properties", ettype, l, c); + break; + + case token::switch_end: + end_error ("switch", ettype, l, c); + break; + case token::try_catch_end: end_error ("try", ettype, l, c); break; - case token::switch_end: - end_error ("switch", ettype, l, c); - break; - case token::unwind_protect_end: end_error ("unwind_protect", ettype, l, c); break;