Use skylark-preferred quote char for string literal
We currently have no need to discern between strings quoted with ' or ". While it could be
nice for something one day (and may have been in the past), it's yagni now. Removing the
distinction simplifies string concatenation.
--
PiperOrigin-RevId: 148273400
MOS_MIGRATED_REVID=148273400
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 e499907..fd97117 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
@@ -606,9 +606,8 @@
private StringLiteral parseStringLiteral() {
Preconditions.checkState(token.kind == TokenKind.STRING);
int end = token.right;
- char quoteChar = lexer.charAt(token.left);
StringLiteral literal =
- setLocation(new StringLiteral((String) token.value, quoteChar), token.left, end);
+ setLocation(new StringLiteral((String) token.value), token.left, end);
nextToken();
if (token.kind == TokenKind.STRING) {
@@ -957,9 +956,7 @@
if (expr instanceof StringLiteral && secondary instanceof StringLiteral) {
StringLiteral left = (StringLiteral) expr;
StringLiteral right = (StringLiteral) secondary;
- if (left.getQuoteChar() == right.getQuoteChar()) {
- return new StringLiteral(left.getValue() + right.getValue(), left.getQuoteChar());
- }
+ return new StringLiteral(left.getValue() + right.getValue());
}
}
return new BinaryOperatorExpression(operator, expr, secondary);