You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/08/01 08:29:53 UTC

[groovy] branch danielsun/tweak-gstring-verbatimText created (now 69acb3a)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch danielsun/tweak-gstring-verbatimText
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 69acb3a  Tweak verbatim text of `GStringExpression`

This branch includes the following new commits:

     new 69acb3a  Tweak verbatim text of `GStringExpression`

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[groovy] 01/01: Tweak verbatim text of `GStringExpression`

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/tweak-gstring-verbatimText
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 69acb3af6dc145079e1c50ac61339f10622ded89
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Aug 1 16:29:25 2021 +0800

    Tweak verbatim text of `GStringExpression`
---
 src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 621bc0c..fa6bd54 100644
--- a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -3826,8 +3826,11 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> {
                 continue;
             }
 
+            boolean isVariableExpression = value instanceof VariableExpression;
             verbatimText.append(DOLLAR_STR);
+            if (!isVariableExpression) verbatimText.append("{");
             verbatimText.append(value.getText());
+            if (!isVariableExpression) verbatimText.append("}");
         }
 
         return configureAST(new GStringExpression(verbatimText.toString(), stringLiteralList, values), ctx);