Fixed two bugs in scanner.dart

First, we want to stop the scanning if the file contains "part of"
because it is not possible to have include statements if the file is
part of some library.

Second, it is possible to have a file there ends with a newline.