Clarify parser error for load() statements RELNOTES: None PiperOrigin-RevId: 186693205
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Parser.java b/src/main/java/com/google/devtools/build/lib/syntax/Parser.java index b535030..3fcf76f 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/Parser.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/Parser.java
@@ -337,7 +337,7 @@ /** * Consume tokens past the first token that has a kind that is in the set of - * teminatingTokens. + * terminatingTokens. * @param terminatingTokens * @return the end offset of the terminating token. */ @@ -354,7 +354,7 @@ /** * Consume tokens until we reach the first token that has a kind that is in - * the set of teminatingTokens. + * the set of terminatingTokens. * @param terminatingTokens * @return the end offset of the terminating token. */ @@ -1047,7 +1047,7 @@ return list; } - // load '(' STRING (COMMA [IDENTIFIER EQUALS] STRING)* COMMA? ')' + // load '(' STRING (COMMA [IDENTIFIER EQUALS] STRING)+ COMMA? ')' private void parseLoad(List<Statement> list) { int start = token.left; expect(TokenKind.LOAD); @@ -1058,6 +1058,10 @@ } StringLiteral importString = parseStringLiteral(); + if (token.kind == TokenKind.RPAREN) { + syntaxError(token, "expected at least one symbol to load"); + return; + } expect(TokenKind.COMMA); Map<Identifier, String> symbols = new HashMap<>();