Error Fixes
- Lexer discarding all newlines (now replaces it with spaces) - Cleanup of Type check and remove function in parser - Cleanup in Compiler.cs
This commit is contained in:
parent
4e4b31be3f
commit
d0c844972d
8 changed files with 198 additions and 146 deletions
15
Compiler/Parser/Exceptions/MissingTokenException.cs
Normal file
15
Compiler/Parser/Exceptions/MissingTokenException.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Compiler.Lexer;
|
||||
|
||||
namespace Compiler.Parser.Exceptions
|
||||
{
|
||||
public class MissingTokenException : Exception
|
||||
{
|
||||
public override string Message { get; }
|
||||
|
||||
public MissingTokenException(TokenType expected)
|
||||
{
|
||||
this.Message = "Expected Token " + expected + " missing.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,16 +5,11 @@ namespace Compiler.Parser.Exceptions
|
|||
{
|
||||
public class UnexpectedTokenException : Exception
|
||||
{
|
||||
public TokenType expected { get; set; }
|
||||
public TokenType got { get; set; }
|
||||
|
||||
public override string Message { get; }
|
||||
|
||||
public UnexpectedTokenException(TokenType expected, TokenType got)
|
||||
{
|
||||
this.expected = expected;
|
||||
this.got = got;
|
||||
this.Message = "Unexpected Token " + got + ". Expected: " + expected;
|
||||
this.Message = "Unexpected Token " + got + ", expected: " + expected + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue