Set a basic loop for multiple runs of the program
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
f7203440a8
commit
60d81c6332
@ -44,6 +44,9 @@ namespace Assignment_1
|
||||
Console.WriteLine("│ Submitted by Brychan Dempsey, 14299890 │");
|
||||
Console.WriteLine("└──────────────────────────────────────────┘");
|
||||
// Parse the source from the memory stream
|
||||
bool exit = false;
|
||||
while (!exit)
|
||||
{
|
||||
MemoryStream sourceStream = new(1024);
|
||||
Parser parser = new();
|
||||
bool dynamicInput = false;
|
||||
@ -62,6 +65,8 @@ namespace Assignment_1
|
||||
// This is by far not the best way to do it; reading line-by-line would reduce memory space,
|
||||
// but it allows a simple read into the console
|
||||
sourceStream.Write(Encoding.UTF8.GetBytes(Console.In.ReadToEnd()));
|
||||
// Dispose will close a piped input, or piped file in further iterations of the program
|
||||
Console.In.Dispose();
|
||||
sourceStream.Position = 0;
|
||||
}
|
||||
else
|
||||
@ -71,6 +76,9 @@ namespace Assignment_1
|
||||
dynamicInput = true;
|
||||
}
|
||||
parser.StartParsing(sourceStream, dynamicInput);
|
||||
Console.WriteLine(Environment.NewLine + new string('─', 40));
|
||||
// Not strictly required, but could have problems if we try loading a large program immediately after unloading the last
|
||||
GC.Collect();
|
||||
Console.WriteLine("\nProgram parsing complete.");
|
||||
if (dynamicInput == false)
|
||||
{
|
||||
@ -86,6 +94,7 @@ namespace Assignment_1
|
||||
Console.WriteLine("Not yet implemented");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
public class Parser
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user