diff options
author | Olly Betts <olly@survex.com> | 2015-01-08 12:47:12 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2015-01-08 12:47:12 +1300 |
commit | 51487c1acc7d269019d115d8eb5ad686f83de321 (patch) | |
tree | 79b016e7676701815580856bb50a31a6358690b5 | |
parent | 19961d7135181926e764cfdbacf5e0ba0388e02a (diff) | |
download | swig-51487c1acc7d269019d115d8eb5ad686f83de321.tar.gz |
Improve error message for extraneous '%}'.
-rw-r--r-- | CHANGES.current | 3 | ||||
-rw-r--r-- | Examples/test-suite/errors/c_extra_rblock.stderr | 2 | ||||
-rw-r--r-- | Source/Swig/scanner.c | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGES.current b/CHANGES.current index 115a1b511..d875740a5 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -6,6 +6,9 @@ Version 3.0.4 (in progress) =========================== 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'." diff --git a/Examples/test-suite/errors/c_extra_rblock.stderr b/Examples/test-suite/errors/c_extra_rblock.stderr index 82877023a..be14eee4c 100644 --- a/Examples/test-suite/errors/c_extra_rblock.stderr +++ b/Examples/test-suite/errors/c_extra_rblock.stderr @@ -1 +1 @@ -c_extra_rblock.i:5: Error: Syntax error in input(1). +c_extra_rblock.i:5: Error: Syntax error. Extraneous '%}' diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c index d8c3f7f3f..b0d608c9e 100644 --- a/Source/Swig/scanner.c +++ b/Source/Swig/scanner.c @@ -824,6 +824,9 @@ static int look(Scanner *s) { state = 7; } else if (c == '=') { return SWIG_TOKEN_MODEQUAL; + } else if (c == '}') { + Swig_error(cparse_file, cparse_line, "Syntax error. Extraneous '%%}'\n"); + exit(1); } else { retract(s, 1); return SWIG_TOKEN_PERCENT; |