From 611172e15ffd70ad83b90cc7727fb36671afb708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Ro=C3=9Fkopf?= <140627753+markusrosskopf@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:55:04 +0100 Subject: [PATCH] Adjusted method get_end_location to handle additional edge cases (#71) End location is computed wrong with the old method, e.g. for ``` T objectName { a = 1. } ``` --- trlc/lexer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trlc/lexer.py b/trlc/lexer.py index 26b2b8d6..6ece300e 100644 --- a/trlc/lexer.py +++ b/trlc/lexer.py @@ -116,9 +116,9 @@ def get_end_location(self): end_line = self.line_no + lines_in_between end_col = self.end_pos + 1 - for n in range(self.end_pos, self.col_no, -1): + for n in range(self.end_pos, 1, -1): if self.lexer.content[n] == "\n": - end_col = self.end_pos - n + end_col = max(self.end_pos - n, 1) break return Location(self.file_name, end_line, end_col)