From 39ea5c5f99f6e93519d2bf627e41ae495292c0f1 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 20 Aug 2020 23:24:01 +0200 Subject: [PATCH] fix parse error for <<= and >>= --- compiler/src/prog8/ast/antlr/Antr2Kotlin.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/src/prog8/ast/antlr/Antr2Kotlin.kt b/compiler/src/prog8/ast/antlr/Antr2Kotlin.kt index 5e690f74b..3b87e201a 100644 --- a/compiler/src/prog8/ast/antlr/Antr2Kotlin.kt +++ b/compiler/src/prog8/ast/antlr/Antr2Kotlin.kt @@ -167,7 +167,8 @@ private fun prog8Parser.StatementContext.toAst() : Statement { augassignment()?.let { // replace A += X with A = A + X val target = it.assign_target().toAst() - val expression = BinaryExpression(target.toExpression(), it.operator.text.substring(0, 1), it.expression().toAst(), it.expression().toPosition()) + val oper = it.operator.text.substringBefore('=') + val expression = BinaryExpression(target.toExpression(), oper, it.expression().toAst(), it.expression().toPosition()) return Assignment(it.assign_target().toAst(), expression, it.toPosition()) }