ANTLR provides reasonably good error messages most of the time, but sometimes you have to tweak error handling a bit (in this case, searching for some more meaningful context to report), and/or refactor the grammar in a way that causes error reports to be more accurate.
On Thu, 29 Apr 2021 at 17:56, OCsite <o...@ocs.cz> wrote: > Christopher, > > On 29 Apr 2021, at 16:57, Christopher Smith <chry...@gmail.com> wrote: > Parrot has reduced my frustration levels about 15% across the board > > > did it indeed? Weird. In my case, the very opposite is true; compare > please e.g. the problem outlined below (which applies in 3.0.8 just as > well) — it makes finding source problems *extremely* inconvenient :( > > All the best, > OC > > Begin forwarded message: > > *From: *"o...@ocs.cz" <o...@ocs.cz> > *Subject: **misplaced else inside a closure causes wrong (or at least > pretty weird) error placement with Parrot* > *Date: *19 May 2020 at 22:36:06 CEST > *To: *us...@groovy.apache.org > *Reply-To: *us...@groovy.apache.org > > Hi there, > > perhaps this is a known or well-understand issue, but worth reporting IMHO > (not sure whether worth a ticket; let me please know should I create one > for this): > > === > 281 ocs /tmp> <q.groovy > class q { > def foo(val) { > 10.times { > println "Essentially anything..." > > > > println "... can be here, the longer this code, the worse" > else println "This is wrong, but see the error report!" > } > } > } > 282 ocs /tmp> /usr/local/groovy-2.4.17/bin/groovyc q.groovy > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > q.groovy: 9: unexpected token: else @ line 9, column 7. > else println "This is wrong, but see the error report!" > ^ > 1 error > 283 ocs /tmp> /usr/local/groovy-3.0.3/bin/groovyc q.groovy > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > q.groovy: 3: Unexpected input: '{'; Expecting RBRACE @ line 3, column 14. > 10.times { > ^ > 1 error > 284 ocs /tmp> > === > > All the best, > OC > > >