-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
52 lines (43 loc) · 1.7 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.IO;
namespace AllanMilne.PALCompiler
{
class Program
{
static void Main(string[] args)
{
List<ICompilerError> errors = new List<ICompilerError>();
if (args.Length > 0) //read a single test file
{
StreamReader source = new StreamReader(args[0]);
customParser parser = new customParser();
PALScanner scanner = new PALScanner();
parser.Parse(source);
foreach (CompilerError err in parser.Errors)
Console.WriteLine(err);
Console.WriteLine("\n");
}
else
{
Console.WriteLine("Provide the name of the folder containing test suite");
String folderName = Console.ReadLine();
Console.WriteLine("\n");
DirectoryInfo directory = new DirectoryInfo(@folderName);
FileInfo[] Files = directory.GetFiles("*.txt"); //Get files
foreach (FileInfo file in Files)
{
StreamReader source = new StreamReader(folderName + "/" + file.Name);
Console.WriteLine(file.Name);
customParser parser = new customParser();
PALScanner scanner = new PALScanner();
parser.Parse(source);
foreach (CompilerError err in parser.Errors)
Console.WriteLine(err);
Console.WriteLine("\n");
}
}
Console.ReadKey();
}
}
}