Fixed appending two variables

This commit is contained in:
Brychan Dempsey 2021-03-12 11:10:24 +13:00
parent 34ecfc0f46
commit 5ebdb9fc06

View File

@ -134,6 +134,13 @@ namespace Assignment_1
}
#region Function Handling
/// <summary>
/// Handles the append x y case.
///
/// </summary>
/// <param name="source"></param>
/// <param name="lineStart"></param>
/// <returns></returns>
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;