[ 
https://issues.apache.org/jira/browse/GROOVY-11660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Saravanan updated GROOVY-11660:
-------------------------------
    Description: 
This code fails during antlr parsing, but is valid Java code because of the ;
{code:java}
// code placeholder
class Blah {

    // This errors out early in the ANTLR phase
    public String
              myMemberVariable;

    public fn() {
        // This also fails in the ANTLR phase
        String 
            somethingElse = "BLAH";
    }
}{code}
The member variable declaration in unambiguous even in groovy parlance. Can 
this be fixed in the antlr parser? Not so sure about the statement inside the 
function, it feels like its valid groovy code (type on the first line and a 
dynamic variable assignment on the next) but even that fails. The expectation 
though is that it is evaluated as String somethingElse = "BLAH". Is that 
expectation valid?

  was:
This code fails during antlr parsing, but is valid Java code because of the ;
{code:java}
// code placeholder
class Blah {

    // This errors out early in the ANTLR phase
    public String
              myMemberVariable;

    public fn() {
        // This fails during static compile and produces unexpected results 
        // in script mode
        String 
            somethingElse = "BLAH";
    }
}{code}
The member variable declaration in unambiguous even in groovy parlance. Can 
this be fixed in the antlr parser? I can understand and fix the static compile 
error in the function in other ways, the first compile error however is too 
early for me to intercept


> Variables declared on multiple lines cause an ANTLR error
> ---------------------------------------------------------
>
>                 Key: GROOVY-11660
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11660
>             Project: Groovy
>          Issue Type: Improvement
>          Components: parser-antlr4
>    Affects Versions: 5.0.0-alpha-12
>            Reporter: Saravanan
>            Priority: Minor
>
> This code fails during antlr parsing, but is valid Java code because of the ;
> {code:java}
> // code placeholder
> class Blah {
>     // This errors out early in the ANTLR phase
>     public String
>               myMemberVariable;
>     public fn() {
>         // This also fails in the ANTLR phase
>         String 
>             somethingElse = "BLAH";
>     }
> }{code}
> The member variable declaration in unambiguous even in groovy parlance. Can 
> this be fixed in the antlr parser? Not so sure about the statement inside the 
> function, it feels like its valid groovy code (type on the first line and a 
> dynamic variable assignment on the next) but even that fails. The expectation 
> though is that it is evaluated as String somethingElse = "BLAH". Is that 
> expectation valid?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to