Issue#1547: Corrected get_index_of_line for when there is no previous line.

This commit is contained in:
JHertz5 2026-05-23 13:39:12 +01:00
parent 1cb53b68c4
commit f95e083590
1 changed files with 7 additions and 1 deletions

View File

@ -146,7 +146,13 @@ class New:
pp.pprint(self.dMap)
def get_index_of_line(self, iLine):
return self.dMap["parser"]["carriage_return"][iLine - 2] + 1
# This function works by getting the carriage return from the previous line and adding 1 to make it the start of
# the next line. If the input is the first line, then there is not previous line, so there is a special case is
# required.
if iLine == 1:
return 0
else:
return self.dMap["parser"]["carriage_return"][iLine - 2] + 1
def extract_unique_id(oToken):