Better error message when scanning files

When a module is already declared in another file, the scanner will
report the offending file where the duplicate statement is.