Added some comments, removed an unused function
This commit is contained in:
parent
1bc3727ce8
commit
f7b7fc1b36
@ -49,10 +49,8 @@ namespace Assignment_1
|
||||
Console.WriteLine("│ 159.341 2021 Semester 1, Assignment 1 │");
|
||||
Console.WriteLine("│ Submitted by Brychan Dempsey, 14299890 │");
|
||||
Console.WriteLine("└──────────────────────────────────────────┘");
|
||||
MemoryStream sourceStream = new MemoryStream(1024); // Creates a memory stream to retain source while being interpreted.
|
||||
|
||||
|
||||
|
||||
// Parse the source from the memory stream
|
||||
MemoryStream sourceStream = new MemoryStream(1024);
|
||||
Parser parser = new Parser();
|
||||
bool dynamicInput = false;
|
||||
// From https://stackoverflow.com/questions/3453220/how-to-detect-if-console-in-stdin-has-been-redirected
|
||||
@ -150,6 +148,7 @@ namespace Assignment_1
|
||||
case statements.reverse:
|
||||
result = Reverse(source);
|
||||
break;
|
||||
// These are additional helper functions. Thier input gets excluded from the MemoryStream
|
||||
case statements.h:
|
||||
Console.WriteLine("Commands are: ");
|
||||
foreach (var item in Enum.GetValues(typeof(statements)))
|
||||
@ -384,25 +383,6 @@ namespace Assignment_1
|
||||
Console.WriteLine(errorMSG);
|
||||
source.SetLength(source.Position);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the starting point of the expression at expected line.
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="word"></param>
|
||||
/// <returns></returns>
|
||||
long GetLineStart(Stream source, string word)
|
||||
{
|
||||
// Decrement and check the previous value is 32 (space), before incrementing back to our current pos
|
||||
// Don't need to guard against oob - implied it's within bounds by the set command being at least 3 bytes long
|
||||
source.Position--;
|
||||
if (source.ReadByte() == 32)
|
||||
{
|
||||
source.Position--;
|
||||
}
|
||||
//source.Position++;
|
||||
return source.Position - word.Length;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Data Handling
|
||||
// Data Handling
|
||||
|
Loading…
x
Reference in New Issue
Block a user