fix parse error for <<= and >>=

This commit is contained in:
Irmen de Jong 2020-08-20 23:24:01 +02:00
parent b03597ac13
commit 39ea5c5f99

View File

@ -167,7 +167,8 @@ private fun prog8Parser.StatementContext.toAst() : Statement {
augassignment()?.let { augassignment()?.let {
// replace A += X with A = A + X // replace A += X with A = A + X
val target = it.assign_target().toAst() 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()) return Assignment(it.assign_target().toAst(), expression, it.toPosition())
} }