@GwtIncompatible(value="java.util.regex") public final class DepsFileParser extends JsFileLineParser
See //javascript/closure/deps.js for an example file.
PARSE_ERROR
Constructor and Description |
---|
DepsFileParser(ErrorManager errorManager)
Constructor
|
DepsFileParser(com.google.common.base.Function<String,String> pathTranslator,
ErrorManager errorManager) |
Modifier and Type | Method and Description |
---|---|
List<DependencyInfo> |
parseFile(String filePath)
Parses the given file and returns a list of dependency information that it
contained.
|
List<DependencyInfo> |
parseFile(String filePath,
String fileContents)
Parses the given file and returns a list of dependency information that it
contained.
|
List<DependencyInfo> |
parseFileReader(String filePath,
Reader reader)
Parses the file from the given reader and returns a list of
dependency information that it contained.
|
protected boolean |
parseLine(String line)
Extracts dependency information from lines that look like
goog.addDependency('pathRelativeToClosure', ['provides'], ['requires']);
Adds the dependencies to depInfos.
|
didParseSucceed, setShortcutMode
public DepsFileParser(ErrorManager errorManager)
errorManager
- Handles parse errors.public DepsFileParser(com.google.common.base.Function<String,String> pathTranslator, ErrorManager errorManager)
pathTranslator
- Translates paths in different build systems.errorManager
- Handles parse errors.public List<DependencyInfo> parseFile(String filePath) throws IOException
filePath
- Path to the file to parse.IOException
- Thrown if the file could not be read.public List<DependencyInfo> parseFile(String filePath, String fileContents)
filePath
- Path to the file to parse.fileContents
- The contents to parse.public List<DependencyInfo> parseFileReader(String filePath, Reader reader)
filePath
- Path to the file to parse.reader
- A reader for the file.protected boolean parseLine(String line) throws com.google.javascript.jscomp.deps.JsFileLineParser.ParseException
line
- The line to parse.ParseException
- Thrown if the given line has a malformed
goog.addDependency().com.google.javascript.jscomp.deps.JsFileLineParser.ParseException
Copyright © 2009-2016 Google. All Rights Reserved.