aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax
diff options
context:
space:
mode:
authorGravatar brandjon <brandjon@google.com>2018-02-22 16:24:24 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-22 16:26:08 -0800
commitfe29c724742662ca41d66450cd70e42fd9e58fa2 (patch)
tree0a1b0f51fa4f1093cf37a176fafbd87658236261 /src/main/java/com/google/devtools/build/lib/syntax
parent93beba12298937b4b5d4d2273f7489d0ead7a68f (diff)
Clarify parser error for load() statements
RELNOTES: None PiperOrigin-RevId: 186693205
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/Parser.java10
1 files changed, 7 insertions, 3 deletions
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 b5350300d7..3fcf76f3c3 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 @@ public class Parser {
/**
* 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 @@ public class Parser {
/**
* 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 @@ public class Parser {
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 @@ public class Parser {
}
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<>();