groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Hadfield <m...@hadfield.org>
Subject Re: Negative relational operators for Groovy 3
Date Wed, 23 Nov 2016 21:51:20 GMT
-1 from me on all cases.



On Wed, Nov 23, 2016 at 4:47 PM, Guillaume Laforge <glaforge@gmail.com>
wrote:

> Is the "parrot" branch covering !in already?
>
> I fetched it today, but got issues with !in
>
> if (1 !in [0, 1, 2]) {}
>
> Nov 23, 2016 10:45:29 PM org.apache.groovy.parser.antlr4.AstBuilder
> buildAST
> SEVERE: Failed to build AST
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> ConsoleScript17: 11: Unexpected input: 'if'; Expecting RPAREN @ line 11,
> column 1.
>    if (1 !in [0, 1, 2]) {}
>    ^
>
> 1 error
>
> And
>
> assert 3 !in []
>
> Nov 23, 2016 10:45:50 PM org.apache.groovy.parser.antlr4.AstBuilder
> buildAST
> SEVERE: Failed to build AST
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> ConsoleScript18: 9: Unexpected input: 'assert'; Expecting RPAREN @ line 9,
> column 1.
>    assert 3 !in []
>    ^
>
> 1 error
>
> I did build with -PuseAntlr4=true though.
>
> Guillaume
>
>
> On Fri, Nov 18, 2016 at 1:45 PM, Daniel Sun <realbluesun@hotmail.com>
> wrote:
>
>> Hi all,
>>
>>       The new parser(Parrot) supports negative relational operators now,
>> which is proposed by Guillaume Laforge :)
>>
>>       Here are some example
>> codes(https://github.com/danielsun1106/groovy-parser/blob/ne
>> gativeRelationalOperators/src/test/resources/core/NegativeRe
>> lationalOperators_01x.groovy):
>>
>> assert 'a' instanceof String
>> assert 'a' !instanceof Integer
>> assert 1 <= 2
>> assert 2 !<= 1
>> assert 2 >= 1
>> assert 1 !>= 2
>> assert 1 < 2
>> assert 2 !< 1
>> assert 2 > 1
>> assert 1 !> 2
>> assert 1 in [1, 2]
>> assert 3 !in [1, 2]
>>
>>       The static compilation example codes can be found at
>> https://github.com/danielsun1106/groovy-parser/blob/negative
>> RelationalOperators/src/test/resources/core/NegativeRelatio
>> nalOperators_02x.groovy
>>
>>        Any thoughts?
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>> --
>> View this message in context: http://groovy.329449.n5.nabble
>> .com/Negative-relational-operators-for-Groovy-3-tp5736809.html
>> Sent from the Groovy Dev mailing list archive at Nabble.com.
>>
>
>
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>

Mime
View raw message