Class ParseError<TToken>
Represents an error encountered during parsing.
Inheritance
- object
- ParseError<TToken>
Implements
- IEquatable<ParseError<TToken>>
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
Declaration
public class ParseError<TToken> : IEquatable<ParseError<TToken>>
Type Parameters
Name | Description |
---|---|
TToken |
The type of tokens in the input stream. |
Properties
EOF
Was the parse error due to encountering the end of the input stream while parsing?.
Declaration
public bool EOF { get; }
Property Value
Type | Description |
---|---|
True if and only if the parse error was due to encountering the end of the input stream while parsing. |
ErrorOffset
The offset in the input stream at which the parse error occurred.
Declaration
public int ErrorOffset { get; }
Property Value
Type | Description |
---|---|
ErrorPos
The position in the input stream at which the parse error occurred.
Declaration
public SourcePos ErrorPos { get; }
Property Value
Type | Description |
---|---|
ErrorPosDelta
The offset in the input stream at which the parse error occurred.
Declaration
public SourcePosDelta ErrorPosDelta { get; }
Property Value
Type | Description |
---|---|
Expected
A collection of expected inputs.
Declaration
public IEnumerable<Expected<TToken>> Expected { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Expected<TToken>> |
The collection of expected inputs. |
Message
A custom error message.
Declaration
public string? Message { get; }
Property Value
Type | Description |
---|---|
A custom error message, or null if the error was created without a custom error message. |
Unexpected
The token which caused the parse error.
Declaration
public Maybe<TToken> Unexpected { get; }
Property Value
Type | Description |
---|---|
Maybe<TToken> |
The token which caused the parse error, or Nothing<T>() if the parse error was not caused by an unexpected token. |
Methods
Equals(ParseError<TToken>?)
Represents an error encountered during parsing.
Declaration
public bool Equals(ParseError<TToken>? other)
Parameters
Type | Name | Description |
---|---|---|
ParseError<TToken> |
other |
Returns
Type | Description |
---|---|
Equals(object?)
Represents an error encountered during parsing.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
obj |
Returns
Type | Description |
---|---|
Overrides
GetHashCode()
Represents an error encountered during parsing.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Overrides
RenderErrorMessage(SourcePos?)
Render the parse error as a string.
Declaration
public string RenderErrorMessage(SourcePos? initialSourcePos = null)
Parameters
Type | Name | Description |
---|---|---|
initialSourcePos |
The SourcePos of the beginning of the parse. |
Returns
Type | Description |
---|---|
An error message. |
ToString()
Render the parse error as a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
An error message. |
Overrides
ToString(SourcePos)
Render the parse error as a string.
Declaration
public string ToString(SourcePos initialSourcePos)
Parameters
Type | Name | Description |
---|---|---|
initialSourcePos |
The SourcePos of the beginning of the parse. |
Returns
Type | Description |
---|---|
An error message. |
Operators
operator ==(ParseError<TToken>, ParseError<TToken>)
Equality operator.
Declaration
public static bool operator ==(ParseError<TToken> left, ParseError<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
ParseError<TToken> |
left |
The left ParseError<TToken>. |
ParseError<TToken> |
right |
The right ParseError<TToken>. |
Returns
Type | Description |
---|---|
operator !=(ParseError<TToken>, ParseError<TToken>)
Inequality operator.
Declaration
public static bool operator !=(ParseError<TToken> left, ParseError<TToken> right)
Parameters
Type | Name | Description |
---|---|---|
ParseError<TToken> |
left |
The left ParseError<TToken>. |
ParseError<TToken> |
right |
The right ParseError<TToken>. |
Returns
Type | Description |
---|---|