pub enum ParseError {
Show 25 variants
UnexpectedEOF(FileId, Vec<String>),
UnexpectedToken(RawSpan, Vec<String>),
ExtraToken(RawSpan),
UnmatchedCloseBrace(RawSpan),
InvalidEscapeSequence(RawSpan),
InvalidAsciiEscapeCode(RawSpan),
InvalidUnicodeEscapeCode(RawSpan),
StringDelimiterMismatch {
opening_delimiter: RawSpan,
closing_delimiter: RawSpan,
},
ExternalFormatError(String, String, Option<RawSpan>),
UnboundTypeVariables(Vec<LocIdent>),
InvalidRecordType {
record_span: RawSpan,
tail_span: Option<RawSpan>,
cause: InvalidRecordTypeError,
},
RecursiveLetPattern(RawSpan),
PatternInLetBlock(RawSpan),
TypeVariableKindMismatch {
ty_var: LocIdent,
span: RawSpan,
},
TypedFieldWithoutDefinition {
field_span: RawSpan,
annot_span: RawSpan,
},
InterpolationInStaticPath {
input: String,
path_elem_span: RawSpan,
},
DuplicateIdentInRecordPattern {
ident: LocIdent,
prev_ident: LocIdent,
},
DuplicateIdentInLetBlock {
ident: LocIdent,
prev_ident: LocIdent,
},
DisabledFeature {
feature: String,
span: RawSpan,
},
InvalidContract(RawSpan),
InvalidImportFormat {
span: RawSpan,
},
SigilExprMissingColon(RawSpan),
UnknownSigilSelector {
selector: String,
span: RawSpan,
},
UnknownSigilAttribute {
selector: String,
attribute: String,
span: RawSpan,
},
MultipleFieldDecls {
ident: Ident,
include_span: RawSpan,
other_span: RawSpan,
},
}Expand description
An error occurring during parsing.
Variants§
UnexpectedEOF(FileId, Vec<String>)
Unexpected end of file.
UnexpectedToken(RawSpan, Vec<String>)
Unexpected token.
ExtraToken(RawSpan)
Superfluous, unexpected token.
UnmatchedCloseBrace(RawSpan)
A closing brace ‘}’ does not match an opening brace ‘{’. This rather precise error is detected because of how interpolated strings are lexed.
InvalidEscapeSequence(RawSpan)
Invalid escape sequence in a string literal.
InvalidAsciiEscapeCode(RawSpan)
Invalid ASCII escape code in a string literal.
InvalidUnicodeEscapeCode(RawSpan)
Invalid unicode escape code in a string literal.
StringDelimiterMismatch
A multiline string was closed with a delimiter which has a % count higher than the
opening delimiter.
ExternalFormatError(String, String, Option<RawSpan>)
Error when parsing an external format such as JSON, YAML, etc.
UnboundTypeVariables(Vec<LocIdent>)
Unbound type variable
InvalidRecordType
Illegal record type literal.
This occurs when failing to convert from the uniterm syntax to a record type literal. See RFC002 for more details.
Fields
cause: InvalidRecordTypeErrorThe reason that interpretation as a record type failed.
RecursiveLetPattern(RawSpan)
A recursive let pattern was encountered. They are not currently supported because we decided it was too involved to implement them.
PatternInLetBlock(RawSpan)
Let blocks can currently only contain plain bindings, not pattern bindings.
TypeVariableKindMismatch
A type variable is used in ways that imply it has muiltiple different kinds.
This can happen in several situations, for example:
- a variable is used as both a type variable and a row type variable,
e.g. in the signature
forall r. { ; r } -> r, - a variable is used as both a record and enum row variable, e.g. in the
signature
forall r. [| ; r |] -> { ; r }.
TypedFieldWithoutDefinition
A record literal, which isn’t a record type, has a field with a type annotation but without a definition. While we could technically handle this situation, this is most probably an error from the user, because this type annotation is useless and, maybe non-intuitively, won’t have any effect as part of a larger contract:
let MixedContract = {foo : String, bar | Number} in
{ foo = 1, bar = 2} | MixedContractThis example works, because the foo : String annotation doesn’t propagate, and contract
application is mostly merging, which is probably not the intent. It might become a warning
in a future version, but we don’t have warnings for now, so we rather forbid such
constructions.
Fields
InterpolationInStaticPath
The user provided a field path on the CLI, which is expected to be only composed of literals, but the parsed field path contains string interpolation.
DuplicateIdentInRecordPattern
A duplicate binding was encountered in a record destructuring pattern.
Fields
DuplicateIdentInLetBlock
A duplicate binding was encountered in a let block.
Fields
DisabledFeature
There was an attempt to use a feature that hasn’t been enabled.
InvalidContract(RawSpan)
A term was used as a contract in type position, but this term has no chance to make any sense as a contract. What terms make sense might evolve with time, but any given point in time, there are a set of expressions that can be excluded syntactically. Currently, it’s mostly constants.
InvalidImportFormat
Unrecognized explicit import format tag
SigilExprMissingColon(RawSpan)
A CLI sigil expression such as @env:FOO is invalid because no : separator was found.
UnknownSigilSelector
A CLI sigil expression is unknown or unsupported, such as @unknown:value.
UnknownSigilAttribute
A CLI sigil attribute is unknown or unsupported, such as @file/unsupported:value.
MultipleFieldDecls
An included field has several definitions. While we could just merge both at runtime like a piecewise field definition, we entirely forbid this situation for now.
Implementations§
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl<T> From<ParseError> for ParseError<usize, T, ParseOrLexError>
impl<T> From<ParseError> for ParseError<usize, T, ParseOrLexError>
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Source§impl From<ParseError> for ParseErrors
impl From<ParseError> for ParseErrors
Source§fn from(e: ParseError) -> ParseErrors
fn from(e: ParseError) -> ParseErrors
Source§impl From<ParseError> for ParseOrLexError
impl From<ParseError> for ParseOrLexError
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Source§impl From<UnboundTypeVariableError> for ParseError
impl From<UnboundTypeVariableError> for ParseError
Source§fn from(err: UnboundTypeVariableError) -> Self
fn from(err: UnboundTypeVariableError) -> Self
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more