Removed curly braces from the start and end of the program (Closes #9)
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed
This commit is contained in:
parent
0fd02dd9ac
commit
65a7b0e497
@ -50,13 +50,13 @@ namespace Assignment_1
|
|||||||
MemoryStream sourceStream = new(1024);
|
MemoryStream sourceStream = new(1024);
|
||||||
Parser parser = new();
|
Parser parser = new();
|
||||||
bool dynamicInput = false;
|
bool dynamicInput = false;
|
||||||
foreach (var arg in args)
|
/*foreach (var arg in args)
|
||||||
{
|
{
|
||||||
if (arg == "-ns")
|
if (arg == "-ns")
|
||||||
{
|
{
|
||||||
nonStrict = true;
|
nonStrict = true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
// From https://stackoverflow.com/questions/3453220/how-to-detect-if-console-in-stdin-has-been-redirected
|
// From https://stackoverflow.com/questions/3453220/how-to-detect-if-console-in-stdin-has-been-redirected
|
||||||
// Reading from pipes is equivalent to reading user input, though the input is redirected
|
// Reading from pipes is equivalent to reading user input, though the input is redirected
|
||||||
if (Console.IsInputRedirected)
|
if (Console.IsInputRedirected)
|
||||||
@ -71,7 +71,7 @@ namespace Assignment_1
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sourceStream.Write(Encoding.UTF8.GetBytes("{ \r\n"));
|
//sourceStream.Write(Encoding.UTF8.GetBytes("{ \r\n"));
|
||||||
sourceStream.Position = 0;
|
sourceStream.Position = 0;
|
||||||
dynamicInput = true;
|
dynamicInput = true;
|
||||||
}
|
}
|
||||||
@ -157,12 +157,13 @@ namespace Assignment_1
|
|||||||
public void StartParsing(Stream source, bool dynamicInput = false)
|
public void StartParsing(Stream source, bool dynamicInput = false)
|
||||||
{
|
{
|
||||||
long initSourceLength = source.Length;
|
long initSourceLength = source.Length;
|
||||||
if (nonStrict || PeekChar(source) == '{')
|
//if (nonStrict || PeekChar(source) == '{')
|
||||||
|
if (true)
|
||||||
{
|
{
|
||||||
if (PeekChar(source) == '{')
|
/*if (PeekChar(source) == '{')
|
||||||
{
|
{
|
||||||
source.ReadByte();
|
source.ReadByte();
|
||||||
}
|
}*/
|
||||||
long lastLinePos = 0;
|
long lastLinePos = 0;
|
||||||
long initPos = 0;
|
long initPos = 0;
|
||||||
bool cont = false;
|
bool cont = false;
|
||||||
@ -416,7 +417,7 @@ namespace Assignment_1
|
|||||||
consoleOutput.Append(string.Format("┌" + new string('─', keyWidth) + "┬" + new string('─', valueWidth) + "┬" + new string('─', flagWidth) + "┐\n"));
|
consoleOutput.Append(string.Format("┌" + new string('─', keyWidth) + "┬" + new string('─', valueWidth) + "┬" + new string('─', flagWidth) + "┐\n"));
|
||||||
consoleOutput.Append(string.Format("│{0}│{1}│{2}│\n", CenterString("Symbol", keyWidth), CenterString("Value", valueWidth), CenterString("Flags", flagWidth)));
|
consoleOutput.Append(string.Format("│{0}│{1}│{2}│\n", CenterString("Symbol", keyWidth), CenterString("Value", valueWidth), CenterString("Flags", flagWidth)));
|
||||||
// Figure out how many symbols are eligible for printing
|
// Figure out how many symbols are eligible for printing
|
||||||
List<string> eligibleKeys = new List<string>(Symbols.Count);
|
List<string> eligibleKeys = new(Symbols.Count);
|
||||||
foreach (var item in Symbols.Keys)
|
foreach (var item in Symbols.Keys)
|
||||||
{
|
{
|
||||||
if (!Symbols[item].Item2.HasFlag(VariableFlags.NoPrint) || (Symbols[item].Item2.HasFlag(VariableFlags.NoPrint) && printUnprint))
|
if (!Symbols[item].Item2.HasFlag(VariableFlags.NoPrint) || (Symbols[item].Item2.HasFlag(VariableFlags.NoPrint) && printUnprint))
|
||||||
@ -464,7 +465,7 @@ namespace Assignment_1
|
|||||||
{
|
{
|
||||||
path = Path.Combine(Environment.CurrentDirectory, path);
|
path = Path.Combine(Environment.CurrentDirectory, path);
|
||||||
// insert the final closing bracket
|
// insert the final closing bracket
|
||||||
source.WriteByte((byte)'}');
|
//source.WriteByte((byte)'}');
|
||||||
source.Position = 0;
|
source.Position = 0;
|
||||||
using (FileStream fs = File.OpenWrite(path))
|
using (FileStream fs = File.OpenWrite(path))
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,26 @@
|
|||||||
"commandName": "Executable",
|
"commandName": "Executable",
|
||||||
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||||
"commandLineArgs": "-command \"& type .\\ExampleOutput.txt | & '.\\Assignment 1.exe'\""
|
"commandLineArgs": "-command \"& type .\\ExampleOutput.txt | & '.\\Assignment 1.exe'\""
|
||||||
|
},
|
||||||
|
"Example1": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||||
|
"commandLineArgs": "-command \"& type .\\Example1.txt | & '.\\Assignment 1.exe'\""
|
||||||
|
},
|
||||||
|
"Example2": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||||
|
"commandLineArgs": "-command \"& type .\\example2.txt | & '.\\Assignment 1.exe'\""
|
||||||
|
},
|
||||||
|
"Example3": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||||
|
"commandLineArgs": "-command \"& type .\\example3.txt | & '.\\Assignment 1.exe'\""
|
||||||
|
},
|
||||||
|
"Example4": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||||
|
"commandLineArgs": "-command \"& type .\\example4.txt | & '.\\Assignment 1.exe'\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user