@GwtIncompatible(value="java.util.regex") public final class JsFileParser extends JsFileLineParser
JsFileLineParser.ParseException| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
BASE_JS_START
The first non-comment line of base.js
|
private boolean |
fileHasProvidesOrRequires |
private boolean |
fileIsModule |
private static Pattern |
GOOG_PROVIDE_REQUIRE_PATTERN
Pattern for matching goog.provide(*) and goog.require(*).
|
private Matcher |
googMatcher
Matchers used in the parsing.
|
private boolean |
includeGoogBase
Whether to provide/require the root namespace.
|
private static java.util.logging.Logger |
logger |
private java.util.List<java.lang.String> |
provides
The info for the file we are currently parsing.
|
private java.util.List<java.lang.String> |
requires |
errorManager, filePath, lineNum, PARSE_ERROR, PARSE_WARNING, parseSucceeded, shortcutMode| Constructor and Description |
|---|
JsFileParser(ErrorManager errorManager)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
DependencyInfo |
parseFile(java.lang.String filePath,
java.lang.String closureRelativePath,
java.lang.String fileContents)
Parses the given file and returns the dependency information that it
contained.
|
protected boolean |
parseLine(java.lang.String line)
Parses a line of JavaScript, extracting goog.provide and goog.require
information.
|
private DependencyInfo |
parseReader(java.lang.String filePath,
java.lang.String closureRelativePath,
java.io.Reader fileContents) |
JsFileParser |
setIncludeGoogBase(boolean include)
Sets whether we should create implicit provides and requires of the
root namespace.
|
didParseSucceed, doParse, parseJsString, parseJsStringArray, parseJsStringMap, setShortcutModeprivate static java.util.logging.Logger logger
private static final Pattern GOOG_PROVIDE_REQUIRE_PATTERN
private static final java.lang.String BASE_JS_START
private Matcher googMatcher
private java.util.List<java.lang.String> provides
private java.util.List<java.lang.String> requires
private boolean fileHasProvidesOrRequires
private boolean fileIsModule
private boolean includeGoogBase
public JsFileParser(ErrorManager errorManager)
errorManager - Handles parse errors.public JsFileParser setIncludeGoogBase(boolean include)
public DependencyInfo parseFile(java.lang.String filePath, java.lang.String closureRelativePath, java.lang.String fileContents)
filePath - Path to the file to parse.closureRelativePath - Path of the file relative to closure.fileContents - The contents to parse.private DependencyInfo parseReader(java.lang.String filePath, java.lang.String closureRelativePath, java.io.Reader fileContents)
protected boolean parseLine(java.lang.String line)
throws JsFileLineParser.ParseException
parseLine in class JsFileLineParserline - The line to parse.JsFileLineParser.ParseException - Should be thrown to signify a problem with the line.