From 17a9053286ac251546dca6cf475d0e9843cf9cc5 Mon Sep 17 00:00:00 2001 From: Astatin Date: Thu, 29 Aug 2024 16:23:53 +0900 Subject: Add errors on label already exists --- gbasm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gbasm b/gbasm index 28b4f2f..2b01a3e 100755 --- a/gbasm +++ b/gbasm @@ -372,7 +372,10 @@ def preprocess(input_file, offset): if ':' in line_without_comment: splitted = line_without_comment.split(':') - labels[splitted[0].strip().upper()] = starting_address + labelName = splitted[0].strip().upper() + if labelName in labels: + raise ValueError("Label \"{}\" is already defined".format(labelName)) + labels[labelName] = starting_address line_without_comment = splitted[1].strip() if line_without_comment != '': -- cgit v1.2.3-70-g09d2