Closed ondrej closed 3 years ago
Hi,
@arkadiuszpalka found the same problem in https://github.com/kotlinx/ast/issues/31. The fix is to add NL* inside of lineStringExpression:
https://github.com/kotlinx/ast/commit/e574d67170c34b451680b49241429855593eda47
Just for the record: KT-26077 is not planned to be fixed in ANTLR grammar at all because it comes from basic inconsistency of Kotlin lexical structure with traditional lexer/parser dichotomy. This issue, though, is not related and seems to be fixed by #77.
@drieks I have a question for you, can you tell me? Is it only ANTLR grammar file kotlinParser.g4 bug? kotlinc compiler always process NL* inside of lineStringExpression, right?
Hi @lbtrace, yes, it's related to the antlr grammar here: https://kotlinlang.org/docs/reference/grammar.html. The Kotlin Compile is not using this grammar and is therefore not affected.
Hi team,
I noticed a problem when parsing files using the official Kotlin ANTLR grammar from https://kotlinlang.org/docs/reference/grammar.html.
This parses OK:
This fails (but compiles without issue in e.g. Android Studio):
This issue is possibly related to https://youtrack.jetbrains.com/issue/KT-26077. When adding parentheses around the expression, ANTRL does parse the statement just fine. Assuming this is the same issue, and since KT-26077 hasn't been touched in over a year, is there anything I might be able to do in the short term to work around this?
Many thanks!