[ https://issues.apache.org/jira/browse/GROOVY-7928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Juan Martín Sotuyo Dodero updated GROOVY-7928: ---------------------------------------------- Description: 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: {code:groovy} class BTree<K, V> extends BTreeNode<K> { def add(K key, V value) { throw new Exception("$key") } } {code} 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 was: 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: {{ class BTree<K, V> extends BTreeNode<K> { def add(K key, V value) { throw new Exception("$key") } } }} 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 > 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: > {code:groovy} > class BTree<K, V> extends BTreeNode<K> { > def add(K key, V value) { > throw new Exception("$key") > } > } > {code} > 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)