* @param libraryFileContents the contents from the library file
* @return the library map read from the given source
*/
public LibraryMap readFromSource(Source source, String libraryFileContents) {
BooleanErrorListener errorListener = new BooleanErrorListener();
Scanner scanner = new Scanner(
source,
new CharSequenceReader(libraryFileContents),
errorListener);
Parser parser = new Parser(source, errorListener);
CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
LibraryBuilder libraryBuilder = new LibraryBuilder(useDart2jsPaths);
// If any syntactic errors were found then don't try to visit the AST structure.
if (!errorListener.getErrorReported()) {
unit.accept(libraryBuilder);
}