skylark/syntax: Move flow statement check to the validation pass.

Mutiple other cleanups in the parser, update code documentation.

RELNOTES: None.
PiperOrigin-RevId: 167501136
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
index 49f5dbb..51ae154 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
@@ -45,7 +45,7 @@
 
   @Test
   public void testReturnOutsideFunction() throws Exception {
-    checkError("Return statements must be inside a function", "return 2\n");
+    checkError("return statements must be inside a function", "return 2\n");
   }
 
   @Test
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
index fc0780e..8ff4bf1 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
@@ -162,18 +162,6 @@
     return Parser.parseStatement(makeParserInputSource(input), getEventHandler(), parsingLevel);
   }
 
-  /** Parses a top-level statement, possibly followed by newlines. */
-  protected Statement parseTopLevelStatement(String... input) {
-    return Parser.parseStatement(
-        makeParserInputSource(input), getEventHandler(), Parser.ParsingLevel.TOP_LEVEL);
-  }
-
-  /** Parses a local statement, possibly followed by newlines. */
-  protected Statement parseLocalLevelStatement(String... input) {
-    return Parser.parseStatement(
-        makeParserInputSource(input), getEventHandler(), Parser.ParsingLevel.LOCAL_LEVEL);
-  }
-
   /** Parses an expression, possibly followed by newlines. */
   protected Expression parseExpression(String... input) {
     return Parser.parseExpression(makeParserInputSource(input), getEventHandler());