kotlinx / ast

Generic AST parsing library for kotlin multiplatform
Apache License 2.0
316 stars 22 forks source link

Record syntax error messages #75

Open atollk opened 2 years ago

atollk commented 2 years ago

Right now, the Kotlin parser uses AntlrKotlinErrorListener to deal with errors while parsing. That class throws ParseCancellationException on syntax error, which seems to be a dummy class that doesn't hold any information. Basically, the information on which token the error occurred is completely lost. Also, the parser explicitly removes all other listeners from the ANTLR parser, so you can't even inject one yourself to get that error information.

I think at least one, if not both, of these are issues that should be fixed. Otherwise, the user only gets a "something is wrong" error.