Juan Martín Sotuyo Dodero created GROOVY-7928:
-------------------------------------------------

             Summary: Groovy antlr syntax does not parse GStrings with variables
                 Key: GROOVY-7928
                 URL: https://issues.apache.org/jira/browse/GROOVY-7928
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.7
            Reporter: Juan Martín Sotuyo Dodero


I'm trying to add Groovy support to PMD's CPD (copy paste detector, see 
https://pmd.github.io/pmd-5.5.1/usage/cpd-usage.html). To do so, I'm attempting 
to use the GroovyTokenizer shipped in org.codehaus.groovy:groovy:2.4.7, which 
is generated from the groovy.g ANTLR syntax file.

When parsing this simple snippet:

{{monospaced}}
class BTree<K, V> extends BTreeNode<K> {

        def add(K key, V value) {

                        throw new Exception("$key")
        }
}
{{monospaced}}

I get:

{quote}
Lexical error at line 11, column 34.  Expecting anything but ''\n''; got it 
anyway
{quote}

Changing *$key* for any constant string works just fine, the problem is with 
GStrings actually interpolating variables.

Thanks in advance



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to