Added the print function
This commit is contained in:
parent
3905b46e75
commit
3fc3a643de
@ -10,7 +10,8 @@ namespace Assignment_1
|
|||||||
enum VariableFlags
|
enum VariableFlags
|
||||||
{
|
{
|
||||||
Empty = 0,
|
Empty = 0,
|
||||||
Reserved = 1
|
Reserved = 1,
|
||||||
|
NoPrint = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -23,10 +24,10 @@ namespace Assignment_1
|
|||||||
|
|
||||||
static Dictionary<string, Tuple<string, VariableFlags>> Symbols = new Dictionary<string, Tuple<string, VariableFlags>>
|
static Dictionary<string, Tuple<string, VariableFlags>> Symbols = new Dictionary<string, Tuple<string, VariableFlags>>
|
||||||
{
|
{
|
||||||
{ "SPACE", new Tuple<string, VariableFlags>(" ", VariableFlags.Reserved) },
|
{ "SPACE", new Tuple<string, VariableFlags>(" ", VariableFlags.Reserved | VariableFlags.NoPrint) },
|
||||||
{ "TAB", new Tuple<string, VariableFlags>("\t", VariableFlags.Reserved) },
|
{ "TAB", new Tuple<string, VariableFlags>("\t", VariableFlags.Reserved | VariableFlags.NoPrint) },
|
||||||
{ "NEWLINE", new Tuple<string, VariableFlags>("\n", VariableFlags.Reserved) },
|
{ "NEWLINE", new Tuple<string, VariableFlags>("\n", VariableFlags.Reserved | VariableFlags.NoPrint) },
|
||||||
{ "CARRIAGE_RETURN", new Tuple<string, VariableFlags>("\r", VariableFlags.Reserved) }
|
{ "CARRIAGE_RETURN", new Tuple<string, VariableFlags>("\r", VariableFlags.Reserved | VariableFlags.NoPrint) }
|
||||||
};
|
};
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
@ -115,6 +116,29 @@ namespace Assignment_1
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Print()
|
||||||
|
{
|
||||||
|
Console.WriteLine("┌" + new string('─', 49) + "┐");
|
||||||
|
Console.WriteLine("│{0:-15}│{1:-25}│{2:9}│", "Symbol", "Value", "Flags");
|
||||||
|
Console.WriteLine("├" + new string('─', 15) + "┼" + new string('─', 25) + "┼" + new string('─', 9) + "┤");
|
||||||
|
int keyPos = Symbols.Count;
|
||||||
|
foreach (var item in Symbols)
|
||||||
|
{
|
||||||
|
Console.WriteLine("│{0:-15}│{1:-25}│{2:9}│", item.Key, item.Value.Item1, Convert.ToString((byte)item.Value.Item2,2).PadLeft(8,'0'));
|
||||||
|
if (keyPos == Symbols.Count-1)
|
||||||
|
{
|
||||||
|
Console.WriteLine("└" + new string('─', 15) + "┴" + new string('─', 25) + "┴" + new string('─', 9) + "┘");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("├" + new string('─', 15) + "┼" + new string('─', 25) + "┼" + new string('─', 9) + "┤");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Handling
|
#region Data Handling
|
||||||
// Data Handling
|
// Data Handling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user