Improve errors for missing ; and unexpected )

This commit is contained in:
Olly Betts 2015-01-08 15:27:57 +13:00
commit 62670e756e
4 changed files with 13 additions and 8 deletions

View file

@ -13,12 +13,8 @@ Version 3.0.4 (in progress)
problem.
2015-01-08: olly
Improve error message for extraneous '%}'.
2015-01-08: olly
Improve error message when an unknown SWIG directive is used - this
previously gave the cryptic "Error: Syntax error in input(1).", but
now gives "Error: Unknown directive '%foo'."
Improve error messages for a few cases which previously gave the
one of the cryptic catch-all errors "Syntax error in input".
2015-01-08: olly
Provide -cppext as a general command line option for setting the

View file

@ -1 +1 @@
c_missing_semi.i:3: Error: Syntax error in input(1).
c_missing_semi.i:3: Error: Syntax error - missing ';'?

View file

@ -1 +1 @@
cpp_extra_brackets.i:5: Error: Syntax error in input(3).
cpp_extra_brackets.i:5: Error: Unexpected ')'.

View file

@ -3024,6 +3024,15 @@ c_decl_tail : SEMI {
skip_balanced('{','}');
$$ = 0;
}
| error {
$$ = 0;
if (yychar == RPAREN) {
Swig_error(cparse_file, cparse_line, "Unexpected ')'.\n");
} else {
Swig_error(cparse_file, cparse_line, "Syntax error - missing ';'?\n");
}
exit(1);
}
;
initializer : def_args {