Parser errors #
The class ParseIt.Error is used throughout the library to report parsing errors. Users are
encouraged to provide instances tailored to their applications.
Three general purpose instances are provided:
Error.Trivialdiscards all error information.Error.Basicrecords the position and offending token of the furthest error.Error.Simplerecords all error information, without processing.
Parser error class
unexpected it treports unexpected input at iteratorit, optionally with the offending token.addMessage e it msgadds information to erroreat iteratorit.merge e₁ e₂combines the errors of two failed alternatives; by default it keepse₂.
- merge : ε → ε → ε
Instances
@[reducible, inline]
Trivial error type: discards all error information.
Instances For
@[instance_reducible]
Basic error type: the position and, optionally, the offending token. Merging keeps the error at the furthest position, preferring the later alternative on ties. Messages are discarded.
- pos : HasPos.Pos ι
Position of the error.
- token : Option τ
Offending token, if any.
Instances For
@[instance_reducible]
instance ParseIt.Error.instBasicOfDecidableLEPos {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] [LE (HasPos.Pos ι)] [DecidableLE (HasPos.Pos ι)] :
@[instance_reducible]
instance ParseIt.Error.instToStringBasicOfReprPos {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] [Repr τ] [Repr (HasPos.Pos ι)] :
Simple error type: records all error information, without processing.
- unexpected {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] : HasPos.Pos ι → Option τ → Simple ι
Unexpected input at a position.
- addMessage {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] : Simple ι → HasPos.Pos ι → String → Simple ι
Error with an additional message at a position.
- merge {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] : Simple ι → Simple ι → Simple ι
Errors from two failed alternatives.
Instances For
@[instance_reducible]
def ParseIt.Error.Simple.toString {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] [Repr τ] [Repr (HasPos.Pos ι)] :
Render a simple error, listing alternatives separated by " or ".
Instances For
@[instance_reducible]
instance ParseIt.Error.instToStringSimpleOfReprPos {ι τ : Type u} [Std.Iterator ι Id τ] [HasPos ι τ] [Repr τ] [Repr (HasPos.Pos ι)] :