Enum leo_errors::errors::parser::parser_errors::ParserError

source ·
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

source

pub fn unexpected_token(message: impl Display, span: Span) -> Self

For when the parser encountered an unexpected token.

source

pub fn invalid_address_lit(token: impl Display, span: Span) -> Self

For when the parser encountered an invalid address literal.

source

pub fn invalid_import_list(span: Span) -> Self

For when the parser encountered an empty import list.

source

pub fn unexpected_eof(span: Span) -> Self

For when the parser encountered an unexpected End of File.

source

pub fn unexpected_whitespace( left: impl Display, right: impl Display, span: Span, ) -> Self

For when the parser encountered an unexpected whitespace.

source

pub fn unexpected( found: impl Display, expected: impl Display, span: Span, ) -> Self

For when the parser encountered an unexpected list of tokens.

source

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.

source

pub fn unexpected_ident( found: impl Display, expected: &[impl Display], span: Span, ) -> Self

For when the parser encountered an unexpected identifier.

source

pub fn unexpected_statement( found: impl Display, expected: impl Display, span: Span, ) -> Self

For when the parser encountered an unexpected statement.

source

pub fn unexpected_str( found: impl Display, expected: impl Display, span: Span, ) -> Self

For when the parser encountered an unexpected string.

source

pub fn spread_in_array_init(span: Span) -> Self

For when the parser encountered an unexpected spread in an array init expression.

source

pub fn lexer_empty_input() -> Self

When more input was expected but not found.

source

pub fn lexer_expected_valid_escaped_char(input: impl Display) -> Self

When an integer is started with a leading zero.

source

pub fn lexer_string_not_closed(input: impl Display) -> Self

When a string is not properly closed.

source

pub fn lexer_empty_block_comment() -> Self

When a block comment is empty.

source

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.

source

pub fn could_not_lex(input: impl Display) -> Self

When the lexer could not lex some text.

source

pub fn implicit_values_not_allowed(input: impl Display, span: Span) -> Self

When the user tries to pass an implicit value.

source

pub fn lexer_hex_number_provided(input: impl Display) -> Self

When a hex number is provided.

source

pub fn inputs_multiple_variable_modes_specified(span: Span) -> Self

For when a user specified more than one mode on a parameter.

source

pub fn lexer_bidi_override() -> Self

For when the lexer encountered a bidi override character

source

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.

source

pub fn invalid_associated_access(name: impl Display, span: Span) -> Self

source

pub fn leo_and_aleo_imports_only(span: Span) -> Self

source

pub fn space_in_annotation(span: Span) -> Self

source

pub fn circuit_is_deprecated(span: Span) -> Self

source

pub fn only_one_program_scope_is_allowed(span: Span) -> Self

source

pub fn missing_program_scope(span: Span) -> Self

source

pub fn invalid_network(span: Span) -> Self

source

pub fn tuple_must_have_at_least_two_elements( kind: impl Display, span: Span, ) -> Self

source

pub fn async_finalize_is_deprecated(span: Span) -> Self

source

pub fn finalize_statements_are_deprecated(span: Span) -> Self

source

pub fn console_statements_are_not_yet_supported(span: Span) -> Self

source

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

source

pub fn array_must_have_at_least_one_element( kind: impl Display, span: Span, ) -> Self

source

pub fn invalid_external_type(span: Span) -> Self

source

pub fn cannot_declare_external_struct(span: Span) -> Self

source

pub fn external_type_cannot_be_used_inside_function( program: impl Display, file_type: impl Display, span: Span, ) -> Self

source

pub fn cannot_import_inside_program_body(span: Span) -> Self

Enforce that cannot use import in program scope

source

pub fn only_aleo_external_calls(span: Span) -> Self

source

pub fn cannot_define_external_record(span: Span) -> Self

source

pub fn comma_expected_after_member(span: Span) -> Self

For when the parser encountered a member declaration not followed by a comma.

source

pub fn num_exit_codes() -> i32

Trait Implementations§

source§

impl Clone for ParserError

source§

fn clone(&self) -> ParserError

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ParserError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for ParserError

source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for ParserError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Backtraced> for ParserError

source§

fn from(source: Backtraced) -> Self

Converts to this type from the input type.
source§

impl From<Formatted> for ParserError

source§

fn from(source: Formatted) -> Self

Converts to this type from the input type.
source§

impl From<ParserError> for LeoError

source§

fn from(source: ParserError) -> Self

Converts to this type from the input type.
source§

impl LeoMessageCode for ParserError

Implements the trait for LeoError Codes.

source§

fn exit_code(&self) -> i32

Returns the error’s exit code for the program.
source§

fn error_code(&self) -> String

Returns the prefixed error identifier.
source§

fn warning_code(&self) -> String

Returns the prefixed warning identifier.
source§

fn code_mask() -> i32

Returns the messages’s exit code mask, as to avoid conflicts.
source§

fn message_type() -> String

Returns the message’s code type for the program.
source§

fn is_error() -> bool

Returns if the message is an error or warning.
source§

fn code_identifier() -> i8

The LeoErrorCode which has a default code identifier of 037 (Leo upsidedown and backwards). This is to make the exit codes unique to Leo itself.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.