Skip to content

Commit

Permalink
Minor exception tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobMisirian committed Aug 16, 2017
1 parent 20f022c commit bd1eba2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Hassium/Compiler/Emit/HassiumCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class HassiumCompiler : IVisitor
{
public static HassiumModule CompileModuleFromFilePath(string abspath)
{
if (!File.Exists(abspath))
throw new CompilerException(new SourceLocation(abspath, 0, 0), "Could not find input file {0}!", abspath);
var tokens = new Scanner().Scan(abspath, File.ReadAllText(abspath));
var ast = new Parser.Parser().Parse(tokens);
var module = new HassiumCompiler().Compile(ast);
Expand Down
12 changes: 9 additions & 3 deletions src/Hassium/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public class Program

static void Main(string[] args)
{
if (args.Length <= 0)
{
Console.WriteLine("Please supply a file input!");
Environment.Exit(-1);
}

try
{
MasterPath = System.IO.Directory.GetCurrentDirectory();
Expand All @@ -27,17 +33,17 @@ static void Main(string[] args)
catch (CompilerException ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex);
//Console.WriteLine(ex);
}
catch (ParserException ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex);
//Console.WriteLine(ex);
}
catch (ScannerException ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex);
//Console.WriteLine(ex);
}
}
}
Expand Down

0 comments on commit bd1eba2

Please sign in to comment.