diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-08 18:26:47 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-08 22:45:17 +0100 |
commit | f9a873a0881e189a2d20e4904d40bb0c5cbf0d94 (patch) | |
tree | 71b78f9ddc8cc45198ce560acded84da90b094cb /giscanner/scannermain.py | |
parent | 0f4dd5e39a86e9ae749b3b4627488e19d18dd8a5 (diff) | |
download | gobject-introspection-f9a873a0881e189a2d20e4904d40bb0c5cbf0d94.tar.gz |
sourcescanner: collect error messages and expose them
It just printed errors to stderr and always returns success even if parsing
fails. This prevents us to write any tests for it.
As a first step collect all lexing/parsing error messages and print them to stderr after
the scanner is done. This allows us to add some regression tests for !78.
In the future we probably want to raise an exception with those errors if parsing
fails.
Diffstat (limited to 'giscanner/scannermain.py')
-rw-r--r-- | giscanner/scannermain.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index ceca66f4..c2c1ac3d 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -444,8 +444,12 @@ def create_source_scanner(options, args): options.cpp_defines, options.cpp_undefines, cflags=options.cflags) - ss.parse_files(filenames) - ss.parse_macros(filenames) + try: + ss.parse_files(filenames) + ss.parse_macros(filenames) + finally: + for error in ss.get_errors(): + print(error, file=sys.stderr) return ss, filenames |