Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X c9d6c4cd8 -> d4b678686


Minor refactoring

(cherry picked from commit 004be82)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d4b67868
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d4b67868
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d4b67868

Branch: refs/heads/GROOVY_2_6_X
Commit: d4b678686f5a80aca5198ff2082140f5c2609a2d
Parents: c9d6c4c
Author: sunlan <[email protected]>
Authored: Sat Sep 2 06:49:48 2017 +0800
Committer: sunlan <[email protected]>
Committed: Sat Sep 2 06:51:08 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/groovy/parser/antlr4/AstBuilder.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/d4b67868/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 533366e..2766c02 100644
--- 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2345,19 +2345,19 @@ public class AstBuilder extends 
GroovyParserBaseVisitor<Object> implements Groov
         throw createParsingFailedException("Unsupported enhanced argument list 
element: " + ctx.getText(), ctx);
     }
 
-
     @Override
     public ConstantExpression visitStringLiteral(StringLiteralContext ctx) {
         String text = ctx.StringLiteral().getText();
 
         int slashyType = getSlashyType(text);
+        boolean startsWithSlash = false;
 
         if (text.startsWith("'''") || text.startsWith("\"\"\"")) {
             text = StringUtils.removeCR(text); // remove CR in the multiline 
string
 
             text = StringUtils.trimQuotations(text, 3);
-        } else if (text.startsWith("'") || text.startsWith("/") || 
text.startsWith("\"")) {
-            if (text.startsWith("/")) { // the slashy string can span rows, so 
we have to remove CR for it
+        } else if (text.startsWith("'") || text.startsWith("\"") || 
(startsWithSlash = text.startsWith("/"))) {
+            if (startsWithSlash) { // the slashy string can span rows, so we 
have to remove CR for it
                 text = StringUtils.removeCR(text); // remove CR in the 
multiline string
             }
 

Reply via email to