Added a check if the current value already exists (Closes #5)
This commit is contained in:
parent
f7b7fc1b36
commit
b371be43d6
@ -233,6 +233,11 @@ namespace Assignment_1
|
||||
{
|
||||
throw new ParserException("Cannot assign a value to a reserved constant", 0, keyEndPos - (key.Length + 1));
|
||||
}
|
||||
else if (Symbols.ContainsKey(key) && !checkExist)
|
||||
{
|
||||
// key already exists, remove it
|
||||
Symbols.Remove(key);
|
||||
}
|
||||
source.Position = keyEndPos;
|
||||
}
|
||||
return key;
|
||||
|
Loading…
x
Reference in New Issue
Block a user