add: exceptions(#7)
Reviewed-on: PostGuard/Canon#7 Co-authored-by: Lan_G <2911328695@qq.com> Co-committed-by: Lan_G <2911328695@qq.com>
This commit is contained in:
parent
35aec34a8e
commit
e191c1e077
12
Canon.Core/Exceptions/GrammarException.cs
Normal file
12
Canon.Core/Exceptions/GrammarException.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Canon.Core.Exceptions;
|
||||
/// <summary>
|
||||
/// 语法分析中引发的异常
|
||||
/// </summary>
|
||||
public class GrammarException : Exception
|
||||
{
|
||||
public GrammarException() { }
|
||||
|
||||
public GrammarException(string message) : base(message) { }
|
||||
|
||||
public GrammarException(string message, Exception innerException) : base(message, innerException) { }
|
||||
}
|
25
Canon.Core/Exceptions/LexemeException.cs
Normal file
25
Canon.Core/Exceptions/LexemeException.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
namespace Canon.Core.Exceptions;
|
||||
/// <summary>
|
||||
/// 词法分析中引发的异常
|
||||
/// </summary>
|
||||
public class LexemeException : Exception
|
||||
{
|
||||
public LexemeException() { }
|
||||
|
||||
public LexemeException(string message) : base(message) { }
|
||||
|
||||
public LexemeException(string message, Exception innerException) :
|
||||
base(message, innerException) { }
|
||||
|
||||
/// <param name="line">单词的行号</param>
|
||||
/// <param name="charPosition">单词的列号</param>
|
||||
/// <param name="message">错误信息</param>
|
||||
public LexemeException(uint line, uint charPosition, string message) :
|
||||
base("line:" + line + ", charPosition:" + charPosition + " :" + message) { }
|
||||
|
||||
public LexemeException(uint line, uint charPosition, Exception innerException) :
|
||||
base("line:" + line + ", charPosition:" + charPosition + " : ", innerException) { }
|
||||
|
||||
public LexemeException(uint line, uint charPosition, string message, Exception innerException) :
|
||||
base("line:" + line + ", charPosition:" + charPosition + " :" + message, innerException) { }
|
||||
}
|
12
Canon.Core/Exceptions/SemanticException.cs
Normal file
12
Canon.Core/Exceptions/SemanticException.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Canon.Core.Exceptions;
|
||||
/// <summary>
|
||||
/// 语义分析中引发的异常
|
||||
/// </summary>
|
||||
public class SemanticException : Exception
|
||||
{
|
||||
public SemanticException() : base() { }
|
||||
|
||||
public SemanticException(string message) : base(message) { }
|
||||
|
||||
public SemanticException(string message, Exception innerException) : base(message, innerException) { }
|
||||
}
|
Loading…
Reference in New Issue
Block a user