feat: Parser Combinator库和词法分析器 (#2)
All checks were successful
Run unit test / Unit-Test (push) Successful in 41s
All checks were successful
Run unit test / Unit-Test (push) Successful in 41s
Reviewed-on: https://git.bupt-hpc.cn/jackfiled/CanonSharp/pulls/2 Co-authored-by: jackfiled <xcrenchangjun@outlook.com> Co-committed-by: jackfiled <xcrenchangjun@outlook.com>
This commit is contained in:
23
CanonSharp.Combinator/Unit.cs
Normal file
23
CanonSharp.Combinator/Unit.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace CanonSharp.Combinator;
|
||||
|
||||
/// <summary>
|
||||
/// 单元类型Unit
|
||||
/// </summary>
|
||||
public readonly struct Unit : IComparable<Unit>, IEquatable<Unit>
|
||||
{
|
||||
public static Unit Instance => default;
|
||||
|
||||
public bool Equals(Unit other) => true;
|
||||
|
||||
public int CompareTo(Unit other) => 0;
|
||||
|
||||
public override bool Equals(object? obj) => obj is Unit;
|
||||
|
||||
public override int GetHashCode() => 0;
|
||||
|
||||
public override string ToString() => $"<{nameof(Unit)}>";
|
||||
|
||||
public static bool operator ==(Unit _0, Unit _1) => true;
|
||||
|
||||
public static bool operator !=(Unit _0, Unit _1) => false;
|
||||
}
|
||||
Reference in New Issue
Block a user