You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/08 21:11:00 UTC

[jira] [Created] (GROOVY-9630) Parrot Parser: split declaration and initialization of "def var" sets incorrect modifier "var"

Eric Milles created GROOVY-9630:
-----------------------------------

             Summary: Parrot Parser: split declaration and initialization of "def var" sets incorrect modifier "var"
                 Key: GROOVY-9630
                 URL: https://issues.apache.org/jira/browse/GROOVY-9630
             Project: Groovy
          Issue Type: Bug
          Components: parser-antlr4
            Reporter: Eric Milles
         Attachments: image-2020-07-08-16-07-22-846.png

Consider the following:
{code}
def var // optional comment
var = 'initial value'
{code}

 !image-2020-07-08-16-07-22-846.png!

Parrot Parser sees first "var" as modifier and not variable declaration.  Thus the split declaration and initialization is actually parsed like a declaration and initialization.  IDE colors the modifiers differently from variable names and so "def" and first "var" get the same coloration.

"def" can also be replaced by "final" and the same issue is observed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)