Struct TokenSymbol
Represents a token symbol in a Grammar.
public readonly struct TokenSymbol : IEquatable<TokenSymbol>
- Implements
Remarks
Token symbols are produced by tokenizers, usually powered by a DFA.
Properties
Attributes
The token symbol's TokenSymbolAttributes.
public TokenSymbolAttributes Attributes { get; }
Property Value
Handle
The TokenSymbol's TokenSymbolHandle.
public TokenSymbolHandle Handle { get; }
Property Value
Name
The TokenSymbol's name.
public string Name { get; }
Property Value
Methods
Equals(TokenSymbol)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(TokenSymbol other)
Parameters
other
TokenSymbolAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns a string describing the TokenSymbol.
public override string ToString()
Returns
Operators
operator ==(TokenSymbol, TokenSymbol)
Compares two TokenSymbols for equality.
public static bool operator ==(TokenSymbol left, TokenSymbol right)
Parameters
left
TokenSymbolThe first token symbol.
right
TokenSymbolThe second token symbol.
Returns
operator !=(TokenSymbol, TokenSymbol)
Compares two TokenSymbols for inequality.
public static bool operator !=(TokenSymbol left, TokenSymbol right)
Parameters
left
TokenSymbolThe first token symbol.
right
TokenSymbolThe second token symbol.