-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
156 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,47 @@ | ||
namespace vein.syntax | ||
namespace vein.syntax; | ||
|
||
using System; | ||
using runtime; | ||
using Sprache; | ||
|
||
public sealed class IdentifierExpression : ExpressionSyntax, IPositionAware<IdentifierExpression>, IEquatable<IdentifierExpression> | ||
{ | ||
using System; | ||
using runtime; | ||
using Sprache; | ||
public IdentifierExpression(string name) : base(name) | ||
=> this.ExpressionString = name; | ||
|
||
public class IdentifierExpression : ExpressionSyntax, IPositionAware<IdentifierExpression>, IEquatable<IdentifierExpression> | ||
public new IdentifierExpression SetPos(Position startPos, int length) | ||
{ | ||
public IdentifierExpression(string name) : base(name) | ||
=> this.ExpressionString = name; | ||
|
||
public new IdentifierExpression SetPos(Position startPos, int length) | ||
{ | ||
base.SetPos(startPos, length); | ||
return this; | ||
} | ||
|
||
public bool Equals(IdentifierExpression other) | ||
{ | ||
if (other is null) | ||
return false; | ||
return this.ExpressionString == other.ExpressionString; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((IdentifierExpression)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
=> this.ExpressionString.GetHashCode(); | ||
|
||
public static bool operator ==(IdentifierExpression left, IdentifierExpression right) | ||
=> Equals(left, right); | ||
|
||
public static bool operator !=(IdentifierExpression left, IdentifierExpression right) | ||
=> !Equals(left, right); | ||
|
||
public override string ToString() => | ||
ExpressionString; | ||
|
||
public static implicit operator string(IdentifierExpression i) => i.ToString(); | ||
public static implicit operator IdentifierExpression(NameSymbol s) => new(s.name); | ||
base.SetPos(startPos, length); | ||
return this; | ||
} | ||
|
||
public bool Equals(IdentifierExpression? other) | ||
{ | ||
if (other is null) | ||
return false; | ||
return this.ExpressionString == other.ExpressionString; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((IdentifierExpression)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
=> this.ExpressionString!.GetHashCode(); | ||
|
||
public static bool operator ==(IdentifierExpression left, IdentifierExpression right) | ||
=> Equals(left, right); | ||
|
||
public static bool operator !=(IdentifierExpression left, IdentifierExpression right) | ||
=> !Equals(left, right); | ||
|
||
public override string ToString() => | ||
ExpressionString; | ||
|
||
public static implicit operator string(IdentifierExpression i) => i.ToString(); | ||
public static implicit operator IdentifierExpression(NameSymbol s) => new(s.name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.