pub enum ParserError {
Formatted(Formatted),
Backtraced(Backtraced),
}Expand description
ParserError enum that represents all the errors for the leo-parser crate.
Variants§
Formatted(Formatted)
Backtraced(Backtraced)
Implementations§
Source§impl ParserError
impl ParserError
Sourcepub fn unexpected_token(message: impl Display, span: Span) -> Self
pub fn unexpected_token(message: impl Display, span: Span) -> Self
For when the parser encountered an unexpected token.
Sourcepub fn invalid_address_lit(token: impl Display, span: Span) -> Self
pub fn invalid_address_lit(token: impl Display, span: Span) -> Self
For when the parser encountered an invalid address literal.
Sourcepub fn invalid_import_list(span: Span) -> Self
pub fn invalid_import_list(span: Span) -> Self
For when the parser encountered an empty import list.
Sourcepub fn unexpected_eof(span: Span) -> Self
pub fn unexpected_eof(span: Span) -> Self
For when the parser encountered an unexpected End of File.
Sourcepub fn unexpected_whitespace(
left: impl Display,
right: impl Display,
span: Span,
) -> Self
pub fn unexpected_whitespace( left: impl Display, right: impl Display, span: Span, ) -> Self
For when the parser encountered an unexpected whitespace.
Sourcepub fn unexpected(
found: impl Display,
expected: impl Display,
span: Span,
) -> Self
pub fn unexpected( found: impl Display, expected: impl Display, span: Span, ) -> Self
For when the parser encountered an unexpected list of tokens.
Sourcepub fn mixed_commas_and_semicolons(span: Span) -> Self
pub fn mixed_commas_and_semicolons(span: Span) -> Self
For when the parser encountered a mix of commas and semi-colons in struct member variables.
Sourcepub fn unexpected_ident(
found: impl Display,
expected: &[impl Display],
span: Span,
) -> Self
pub fn unexpected_ident( found: impl Display, expected: &[impl Display], span: Span, ) -> Self
For when the parser encountered an unexpected identifier.
Sourcepub fn unexpected_statement(
found: impl Display,
expected: impl Display,
span: Span,
) -> Self
pub fn unexpected_statement( found: impl Display, expected: impl Display, span: Span, ) -> Self
For when the parser encountered an unexpected statement.
Sourcepub fn unexpected_str(
found: impl Display,
expected: impl Display,
span: Span,
) -> Self
pub fn unexpected_str( found: impl Display, expected: impl Display, span: Span, ) -> Self
For when the parser encountered an unexpected string.
Sourcepub fn spread_in_array_init(span: Span) -> Self
pub fn spread_in_array_init(span: Span) -> Self
For when the parser encountered an unexpected spread in an array init expression.
Sourcepub fn lexer_empty_input() -> Self
pub fn lexer_empty_input() -> Self
When more input was expected but not found.
Sourcepub fn lexer_expected_valid_escaped_char(input: impl Display) -> Self
pub fn lexer_expected_valid_escaped_char(input: impl Display) -> Self
When an integer is started with a leading zero.
Sourcepub fn lexer_string_not_closed(input: impl Display) -> Self
pub fn lexer_string_not_closed(input: impl Display) -> Self
When a string is not properly closed.
Sourcepub fn lexer_empty_block_comment() -> Self
pub fn lexer_empty_block_comment() -> Self
When a block comment is empty.
Sourcepub fn lexer_block_comment_does_not_close_before_eof(
input: impl Display,
) -> Self
pub fn lexer_block_comment_does_not_close_before_eof( input: impl Display, ) -> Self
When a block comment is not closed before end of file.
Sourcepub fn could_not_lex(input: impl Display) -> Self
pub fn could_not_lex(input: impl Display) -> Self
When the lexer could not lex some text.
Sourcepub fn implicit_values_not_allowed(input: impl Display, span: Span) -> Self
pub fn implicit_values_not_allowed(input: impl Display, span: Span) -> Self
When the user tries to pass an implicit value.
Sourcepub fn lexer_hex_number_provided(input: impl Display) -> Self
pub fn lexer_hex_number_provided(input: impl Display) -> Self
When a hex number is provided.
Sourcepub fn inputs_multiple_variable_modes_specified(span: Span) -> Self
pub fn inputs_multiple_variable_modes_specified(span: Span) -> Self
For when a user specified more than one mode on a parameter.
Sourcepub fn lexer_bidi_override() -> Self
pub fn lexer_bidi_override() -> Self
For when the lexer encountered a bidi override character
Sourcepub fn invalid_method_call(
expr: impl Display,
func: impl Display,
num_args: impl Display,
span: Span,
) -> Self
pub fn invalid_method_call( expr: impl Display, func: impl Display, num_args: impl Display, span: Span, ) -> Self
Parsed an unknown method call on the type of an expression.
pub fn invalid_associated_access(name: impl Display, span: Span) -> Self
pub fn leo_and_aleo_imports_only(span: Span) -> Self
pub fn space_in_annotation(span: Span) -> Self
pub fn circuit_is_deprecated(span: Span) -> Self
pub fn only_one_program_scope_is_allowed(span: Span) -> Self
pub fn missing_program_scope(span: Span) -> Self
pub fn invalid_network(span: Span) -> Self
pub fn tuple_must_have_at_least_two_elements( kind: impl Display, span: Span, ) -> Self
pub fn async_finalize_is_deprecated(span: Span) -> Self
pub fn finalize_statements_are_deprecated(span: Span) -> Self
pub fn console_statements_are_not_yet_supported(span: Span) -> Self
Sourcepub fn tuple_index_must_be_whole_number(found: impl Display, span: Span) -> Self
pub fn tuple_index_must_be_whole_number(found: impl Display, span: Span) -> Self
Enforce that tuple index must not have leading 0, or underscore in between digits
pub fn array_must_have_at_least_one_element( kind: impl Display, span: Span, ) -> Self
pub fn invalid_external_type(span: Span) -> Self
pub fn cannot_declare_external_struct(span: Span) -> Self
pub fn external_type_cannot_be_used_inside_function( program: impl Display, file_type: impl Display, span: Span, ) -> Self
Sourcepub fn cannot_import_inside_program_body(span: Span) -> Self
pub fn cannot_import_inside_program_body(span: Span) -> Self
Enforce that cannot use import in program scope
pub fn only_aleo_external_calls(span: Span) -> Self
pub fn cannot_define_external_record(span: Span) -> Self
Sourcepub fn comma_expected_after_member(span: Span) -> Self
pub fn comma_expected_after_member(span: Span) -> Self
For when the parser encountered a member declaration not followed by a comma.
pub fn hexbin_literal_nonintegers(span: Span) -> Self
pub fn wrong_digit_for_radix(digit: char, radix: u32, token: String) -> Self
pub fn identifier_too_long( ident: impl Display, length: usize, max_length: usize, span: Span, ) -> Self
pub fn expected_identifier(span: Span) -> Self
pub fn identifier_cannot_contain_double_underscore( ident: impl Display, span: Span, ) -> Self
pub fn custom(msg: impl Display, span: Span) -> Self
pub fn conflicting_module_definitions( module_name: impl Display, file_a: impl Display, file_b: impl Display, ) -> Self
pub fn keyword_used_as_module_name( module_name: impl Display, keyword: impl Display, ) -> Self
pub fn could_not_lex_span(input: impl Display, span: Span) -> Self
Sourcepub fn lexer_bidi_override_span(span: Span) -> Self
pub fn lexer_bidi_override_span(span: Span) -> Self
For when the lexer encountered a bidi override character
pub fn wrong_digit_for_radix_span( digit: char, radix: u32, token: impl Display, span: Span, ) -> Self
pub fn identifier_cannot_start_with_underscore(span: Span) -> Self
pub fn num_exit_codes() -> i32
pub fn with_labels(self, labels: Vec<Label>) -> Self
Trait Implementations§
Source§impl Clone for ParserError
impl Clone for ParserError
Source§fn clone(&self) -> ParserError
fn clone(&self) -> ParserError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserError
impl Debug for ParserError
Source§impl Display for ParserError
impl Display for ParserError
Source§impl Error for ParserError
impl Error for ParserError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Backtraced> for ParserError
impl From<Backtraced> for ParserError
Source§fn from(source: Backtraced) -> Self
fn from(source: Backtraced) -> Self
Source§impl From<Formatted> for ParserError
impl From<Formatted> for ParserError
Source§impl From<ParserError> for LeoError
impl From<ParserError> for LeoError
Source§fn from(source: ParserError) -> Self
fn from(source: ParserError) -> Self
Source§impl LeoMessageCode for ParserError
Implements the trait for LeoError Codes.
impl LeoMessageCode for ParserError
Implements the trait for LeoError Codes.
Source§fn error_code(&self) -> String
fn error_code(&self) -> String
Source§fn warning_code(&self) -> String
fn warning_code(&self) -> String
Source§fn message_type() -> String
fn message_type() -> String
Source§fn code_identifier() -> i8
fn code_identifier() -> i8
Auto Trait Implementations§
impl Freeze for ParserError
impl RefUnwindSafe for ParserError
impl Send for ParserError
impl Sync for ParserError
impl Unpin for ParserError
impl UnsafeUnpin for ParserError
impl UnwindSafe for ParserError
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<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