Struct Expected<TToken>
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Implements
- IEquatable<Expected<TToken>>
- IComparable<Expected<TToken>>
Inherited Members
Declaration
public readonly struct Expected<TToken> : IEquatable<Expected<TToken>>, IComparable<Expected<TToken>>
Type Parameters
Name | Description |
---|---|
TToken |
The type of tokens in the parser's input stream. |
Properties
IsEof
Did the parser expect the end of the input stream?.
Declaration
public bool IsEof { get; }
Property Value
Type | Description |
---|---|
True if the parser expected the end of the input stream. |
Label
The custom name of the parser that produced this error, or null if the expectation was a sequence of tokens.
Declaration
public string? Label { get; }
Property Value
Type | Description |
---|---|
The label. |
Tokens
The sequence of tokens that were expected at the point of the error, null if the parser had a custom name.
Declaration
public ImmutableArray<TToken> Tokens { get; }
Property Value
Type | Description |
---|---|
ImmutableArray<TToken> |
The sequence of tokens that were expected. |
Methods
CompareTo(Expected<TToken>)
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Declaration
public int CompareTo(Expected<TToken> other)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
other |
Returns
Type | Description |
---|---|
Equals(Expected<TToken>)
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Declaration
public bool Equals(Expected<TToken> other)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
other |
Returns
Type | Description |
---|---|
Equals(object?)
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
obj |
Returns
Type | Description |
---|---|
Overrides
GetHashCode()
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Overrides
ToString()
Represents a parsing expectation for error reporting.
Expected values are either a sequence of expected tokens (in which case Label == null && Tokens != null
),
a custom-named parser (Label != null && Tokens == null
),
or the end of the input stream (Label == null && Tokens == null
).
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
Overrides
Operators
operator ==(Expected<TToken>, Expected<TToken>)
Equality operator.
Declaration
public static bool operator ==(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|
operator >(Expected<TToken>, Expected<TToken>)
Comparison operator.
Declaration
public static bool operator >(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|
operator >=(Expected<TToken>, Expected<TToken>)
Comparison operator.
Declaration
public static bool operator >=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|
operator !=(Expected<TToken>, Expected<TToken>)
Inequality operator.
Declaration
public static bool operator !=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|
operator <(Expected<TToken>, Expected<TToken>)
Comparison operator.
Declaration
public static bool operator <(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|
operator <=(Expected<TToken>, Expected<TToken>)
Comparison operator.
Declaration
public static bool operator <=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
The left Expected<TToken>. |
Expected<TToken> |
right |
The right Expected<TToken>. |
Returns
Type | Description |
---|---|