groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: Parsing slashy string as method argument
Date Fri, 20 Oct 2017 01:31:53 GMT
Historically, there were conflicts with parsing the grammar.
Basically, examples like:
foo / bar /
getting mixed up with division:
foo / bar
and this one being tricky also:
println /* I'd like a comment here */

I don't know if we can do any better in the new parser. In theory, with
enough lookahead, you can sometimes work out such cases but there are often
tricky edge cases that get in the way. Daniel might have more thoughts.
Perhaps though permitting the dollar slashy string might be an improvement.
It might have a much smaller impact.

Cheers, Paul.

On Fri, Oct 20, 2017 at 2:34 AM, Brian Stewart <>

> Hello, all,
> I do a fair amount of work in Groovy DSLs, and one thing I consistently
> run into is trying to call a method with a slashy string as an argument,
> without parentheses around the method call. Example:
> // this does not work:
> println /foo/
> // this does work, as expected:
> println 'foo'
> Is there a historical reason slashy strings cannot be handled this way? I
> am wondering if this is something that might be handled with the new parser.
> Thanks,
> Brian

View raw message