diff --git a/Assignment 1/Program.cs b/Assignment 1/Program.cs index 7109de1..4e5d8e8 100644 --- a/Assignment 1/Program.cs +++ b/Assignment 1/Program.cs @@ -134,6 +134,13 @@ namespace Assignment_1 } #region Function Handling + /// + /// Handles the append x y case. + /// + /// + /// + /// + /// bool Append(Stream source, long lineStart = -1) { // If it wasn't explicitly set, assume line starts the length of 'append ' before the current position @@ -390,7 +397,6 @@ namespace Assignment_1 { s.Position--; string keyValue; - long t = FindExistingIdentifier(s, out keyValue); if (!Symbols.ContainsKey(keyValue)) @@ -413,6 +419,12 @@ namespace Assignment_1 { string identifier; long wordEnd = FindNextWord(s, out identifier); + if (identifier.EndsWith(';') && identifier.Length > 1) + { + // Remove the trailing semicolon from the parse & backtrack the identifier length one spot + identifier = identifier.TrimEnd(';'); + wordEnd--; + } // Lookup the value in the symbol table returnedKey = identifier; return wordEnd;