summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2015-01-08 15:27:57 +1300
committerOlly Betts <olly@survex.com>2015-01-08 15:27:57 +1300
commit62670e756e188e03bb78cc5f371dfa88989783cc (patch)
treedba8afe1de3ef3ce3d2cca5241ccaa2da5efc080
parentd315187a1cd41fb62a18770d9e59469b49f509d2 (diff)
downloadswig-62670e756e188e03bb78cc5f371dfa88989783cc.tar.gz
Improve errors for missing ; and unexpected )
-rw-r--r--CHANGES.current8
-rw-r--r--Examples/test-suite/errors/c_missing_semi.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.stderr2
-rw-r--r--Source/CParse/parser.y9
4 files changed, 13 insertions, 8 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 515ad8f61..564135d08 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -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
diff --git a/Examples/test-suite/errors/c_missing_semi.stderr b/Examples/test-suite/errors/c_missing_semi.stderr
index 791b959ca..9f539e4ab 100644
--- a/Examples/test-suite/errors/c_missing_semi.stderr
+++ b/Examples/test-suite/errors/c_missing_semi.stderr
@@ -1 +1 @@
-c_missing_semi.i:3: Error: Syntax error in input(1).
+c_missing_semi.i:3: Error: Syntax error - missing ';'?
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.stderr b/Examples/test-suite/errors/cpp_extra_brackets.stderr
index 12bb1f327..f1fabc78d 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets.stderr
+++ b/Examples/test-suite/errors/cpp_extra_brackets.stderr
@@ -1 +1 @@
-cpp_extra_brackets.i:5: Error: Syntax error in input(3).
+cpp_extra_brackets.i:5: Error: Unexpected ')'.
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 4bee5f127..9de6a1b07 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -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 {