Class ParseException
The error raised when a document does not parse, carrying the position the parser stopped at.
Implements
Inherited Members
Namespace: Link.Foundation.Links.Notation
Assembly: Link.Foundation.Links.Notation.dll
Syntax
public class ParseException : FormatException, ISerializable
Remarks
The position is the furthest one the parser reached, which is the character the document stops making sense at rather than the point the last alternative gave up on. It derives from FormatException, the exception the generated parser raised on its own, so code that catches that keeps working. A document nested deeper than MaxDepth is refused with this exception too; then MaxDepth says how deep the nesting may go, and the position is the group or the line that is one level too deep.
Constructors
| Edit this page View SourceParseException(string, int, Exception?)
Creates an exception describing where subject stopped parsing.
Declaration
public ParseException(string subject, int offset, Exception? innerException = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subject | The document that failed to parse. |
| int | offset | Offset of the position the parser stopped at. |
| Exception | innerException | The error the generated parser raised, if any. |
ParseException(string, int, int, Exception?)
Creates an exception saying that subject nests deeper than
maxDepth at offset.
Declaration
public ParseException(string subject, int offset, int maxDepth, Exception? innerException = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subject | The document that nests too deeply. |
| int | offset | Offset of the group or the line that is one level too deep. |
| int | maxDepth | The deepest nesting allowed. |
| Exception | innerException | The error the parser raised, if any. |
Properties
| Edit this page View SourceColumn
Column the offending position is at, counted from 1.
Declaration
public int Column { get; }
Property Value
| Type | Description |
|---|---|
| int |
Found
The character found instead, or null at the end of the document.
Declaration
public char? Found { get; }
Property Value
| Type | Description |
|---|---|
| char? |
Line
Line the offending position is on, counted from 1.
Declaration
public int Line { get; }
Property Value
| Type | Description |
|---|---|
| int |
LineText
The offending line, as written, without its line ending.
Declaration
public string LineText { get; }
Property Value
| Type | Description |
|---|---|
| string |
MaxDepth
The deepest nesting allowed, when the document is nested deeper than that; null for any other error.
Declaration
public int? MaxDepth { get; }
Property Value
| Type | Description |
|---|---|
| int? |
Offset
Offset of the offending position from the start of the document.
Declaration
public int Offset { get; }
Property Value
| Type | Description |
|---|---|
| int |
Snippet
The offending line with a caret under the offending column, quoted the way a compiler quotes source. A long line is shown as a window around the caret, so the message stays the same size whether the document has ten lines or fifteen hundred.
Declaration
public string Snippet { get; }
Property Value
| Type | Description |
|---|---|
| string |
Summary
The one-line summary: where the parser stopped and what stands there, or that the nesting is too deep there.
Declaration
public string Summary { get; }
Property Value
| Type | Description |
|---|---|
| string |