aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-08-29 16:23:53 +0900
committerAstatin <astatin@redacted>2024-08-29 16:23:53 +0900
commit17a9053286ac251546dca6cf475d0e9843cf9cc5 (patch)
treeca6525776a8ecfb62fb96eaa0af5bbd794cd2819
parentf86601054a141cf189e89528bcd2eda5521b2bb5 (diff)
Add errors on label already exists
-rwxr-xr-xgbasm5
1 files changed, 4 insertions, 1 deletions
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 != '':