Class 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
)
Inheritance
- Object
- Expected<TToken>
Implements
- IEquatable<Expected<TToken>>
- IComparable<Expected<TToken>>
Declaration
public sealed class Expected<TToken> : ValueType
Type Parameters
Name | Description |
---|---|
TToken |
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>)
Declaration
public int CompareTo(Expected<TToken> other)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
other |
Returns
Type | Description |
---|---|
Equals(Expected<TToken>)
Declaration
public bool Equals(Expected<TToken> other)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
other |
Returns
Type | Description |
---|---|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
obj |
Returns
Type | Description |
---|---|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
Operators
Equality(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator ==(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|
GreaterThan(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator>(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|
GreaterThanOrEqual(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator >=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|
Inequality(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator !=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|
LessThan(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator <(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|
LessThanOrEqual(Expected<TToken>, Expected<TToken>)
Declaration
public static bool operator <=(Expected<TToken> left, Expected<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
Expected<TToken> |
left |
|
Expected<TToken> |
right |
Returns
Type | Description |
---|---|