Improve SyntaxTreeVisitor API.
RELNOTES: None.
PiperOrigin-RevId: 164481927
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
index 2d2b50e..2ba51d7 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
@@ -301,6 +301,11 @@
HashCode.fromBytes(file.getDigest()).toString(), eventHandler);
}
+ public static BuildFileAST parseSkylarkFile(ParserInputSource input, EventHandler eventHandler) {
+ Parser.ParseResult result = Parser.parseFile(input, eventHandler, SKYLARK);
+ return create(ImmutableList.<Statement>of(), result, /*contentHashCode=*/ null, eventHandler);
+ }
+
/**
* Parse the specified non-build Skylark file but avoid the validation of the imports, returning
* its AST. All errors during scanning or parsing will be reported to the reporter.