Enum ruxnasm::Error[][src]

pub enum Error {
Show variants NoMatchingClosingParenthesis { span: Range<usize>, }, NoMatchingOpeningParenthesis { span: Range<usize>, }, MacroNameExpected { span: Range<usize>, }, LabelExpected { span: Range<usize>, }, SublabelExpected { span: Range<usize>, }, SlashInLabelOrSublabel { span: Range<usize>, }, MoreThanOneSlashInIdentifier { span: Range<usize>, }, AmpersandAtTheStartOfLabel { span: Range<usize>, }, IdentifierExpected { span: Range<usize>, }, HexNumberExpected { span: Range<usize>, }, HexNumberOrCharacterExpected { span: Range<usize>, }, CharacterExpected { span: Range<usize>, }, MoreThanOneByteFound { bytes: Vec<u8>, span: Range<usize>, }, HexDigitInvalid { digit: char, number: String, span: Range<usize>, }, HexNumberUnevenLength { length: usize, number: String, span: Range<usize>, }, HexNumberTooLong { length: usize, number: String, span: Range<usize>, }, MacroCannotBeAHexNumber { number: String, span: Range<usize>, }, MacroCannotBeAnInstruction { instruction: String, span: Range<usize>, }, MacroUndefined { name: String, span: Range<usize>, }, MacroDefinedMoreThanOnce { name: String, span: Range<usize>, other_span: Range<usize>, }, LabelDefinedMoreThanOnce { name: String, span: Range<usize>, other_span: Range<usize>, }, OpeningBraceNotAfterMacroDefinition { span: Range<usize>, }, NoMatchingOpeningBrace { span: Range<usize>, }, NoMatchingClosingBrace { span: Range<usize>, }, SublabelDefinedWithoutScope { name: String, span: Range<usize>, }, NoMatchingOpeningBracket { span: Range<usize>, }, NoMatchingClosingBracket { span: Range<usize>, }, MacroError { original_error: Box<Error>, span: Range<usize>, }, SublabelReferencedWithoutScope { name: String, span: Range<usize>, }, LabelUndefined { name: String, span: Range<usize>, }, AddressNotZeroPage { address: u16, identifier: String, span: Range<usize>, }, AddressTooFar { distance: usize, identifier: String, span: Range<usize>, other_span: Range<usize>, }, BytesInZerothPage { span: Range<usize>, }, PaddedBackwards { previous_pointer: usize, desired_pointer: usize, span: Range<usize>, }, ProgramTooLong { span: Range<usize>, },
}
Expand description

Enum representing every error that can be reported from Ruxnasm.

Variants

NoMatchingClosingParenthesis

This error gets reported when an opening parenthesis is not closed i.e. it has no matching closing parenthesis.

Example

(
Show fields

Fields of NoMatchingClosingParenthesis

span: Range<usize>

Span of the opening parenthesis with no matching closing parenthesis.

NoMatchingOpeningParenthesis

This error gets reported when a closing parenthesis has no matching opening parenthesis.

Example

)
Show fields

Fields of NoMatchingOpeningParenthesis

span: Range<usize>

Span of the closing parenthesis with no matching opening parenthesis.

MacroNameExpected

This error gets reported when there is no macro name after a macro definition rune.

Example

%
Show fields

Fields of MacroNameExpected

span: Range<usize>

Span of the macro definition rune.

LabelExpected

This error gets reported when there is no label name after a label definition rune.

Example

@
Show fields

Fields of LabelExpected

span: Range<usize>

Span of the label definition rune.

SublabelExpected

This error gets reported when there is no sublabel name after a sublabel definition rune.

Example

&
Show fields

Fields of SublabelExpected

span: Range<usize>

Span of the sublabel definition rune.

SlashInLabelOrSublabel

This error gets reported when a label or a sublabel name contains a slash character.

Example

@label/name
Show fields

Fields of SlashInLabelOrSublabel

span: Range<usize>

Span of the slash in the label of sublabel.

MoreThanOneSlashInIdentifier

This error gets reported when an identifier contains more than one slash character.

Example

.label-name/sublabel/name
Show fields

Fields of MoreThanOneSlashInIdentifier

span: Range<usize>

Span of the slash in the identifier.

AmpersandAtTheStartOfLabel

This error gets reported when a label name in a label definition has an ampersand as the first character.

Example

@&label-name
Show fields

Fields of AmpersandAtTheStartOfLabel

span: Range<usize>

Span of the ampersand at the start of the label.

IdentifierExpected

This error gets reported when there is no identifier after an address rune (literal zero-page address rune, literal relative address rune, literal absolute address runem, or raw address rune).

Example

.
Show fields

Fields of IdentifierExpected

span: Range<usize>

Span of the address rune.

HexNumberExpected

This error gets reported when there is no hexadecimal number after an absolute or relative pad rune.

Example

|
Show fields

Fields of HexNumberExpected

span: Range<usize>

Span of the abolute or relative pad rune.

HexNumberOrCharacterExpected

This error gets reported when there is no character or hexadecimal number after a literal hex rune.

Example

#
Show fields

Fields of HexNumberOrCharacterExpected

span: Range<usize>

Span of the literal hex rune.

CharacterExpected

This error gets reported when there is no character after a character rune.

Example

'
Show fields

Fields of CharacterExpected

span: Range<usize>

Span of the character rune.

MoreThanOneByteFound

This error gets reported when there is more than one byte after a character rune.

Example

'characters
Show fields

Fields of MoreThanOneByteFound

bytes: Vec<u8>

Sequence of bytes after the character rune.

span: Range<usize>

Span of the characters after the character rune.

HexDigitInvalid

This error gets reported when a hexadecimal number contains an invalid digit.

Example

#00g0
Show fields

Fields of HexDigitInvalid

digit: char

The invalid digit.

number: String

The whole hexadecimal number with the invalid digit.

span: Range<usize>

Span of the hexadecimal number.

HexNumberUnevenLength

This error gets reported when a hexadecimal number after a literal hex rune has a length of 3, i.e. it is made out of exactly 3 hexadecimal digits.

Example

#000
Show fields

Fields of HexNumberUnevenLength

length: usize

Length of the hexadecimal number.

number: String

The hexadecimal number.

span: Range<usize>

Span of the hexadecimal number.

HexNumberTooLong

This error gets reported when the hexadecimal number after a literal hex rune is longer than 4 hexadecimal digits.

Example

#fffff
Show fields

Fields of HexNumberTooLong

length: usize

Length of the hexadecimal number.

number: String

The hexadecimal number.

span: Range<usize>

Span of the hexadecimal number.

MacroCannotBeAHexNumber

This error gets reported when the macro name after a macro definition rune is a valid hexadecimal number i.e. it contains exactly 2 or 4 valid hexadecimal digits.

Example

%01
Show fields

Fields of MacroCannotBeAHexNumber

number: String

The hexadecimal number that was meant to be a macro name.

span: Range<usize>

Span of the hexadecimal number that was meant to be a macro name.

MacroCannotBeAnInstruction

This error gets reported when the macro name after a macro definition rune is a valid instruction.

Example

%ADD
Show fields

Fields of MacroCannotBeAnInstruction

instruction: String

The instruction that was meant to be a macro name.

span: Range<usize>

Span of the instruction that was meant to be a macro name.

MacroUndefined

This error gets reported during an attempt to expand a macro that has not been previously defined.

Example

macro
Show fields

Fields of MacroUndefined

name: String

Name of the macro.

span: Range<usize>

Span of the macro invocation.

MacroDefinedMoreThanOnce

This error gets reported when a macro with the same name is defined multiple times.

Example

%macro { ADD }
%macro { ADD }
Show fields

Fields of MacroDefinedMoreThanOnce

name: String

Name of the macro.

span: Range<usize>

Span of the current macro definition.

other_span: Range<usize>

Span of the previous macro definition.

LabelDefinedMoreThanOnce

This error gets reported when a label with the same name is defined multiple times.

Example

@label
@label
Show fields

Fields of LabelDefinedMoreThanOnce

name: String

Name of the label.

span: Range<usize>

Span of the current label definition.

other_span: Range<usize>

Span of the previous label definition.

OpeningBraceNotAfterMacroDefinition

This error gets reported when an opening brace character is not directly preceded by a macro definition.

Example

{ ADD }
Show fields

Fields of OpeningBraceNotAfterMacroDefinition

span: Range<usize>

Span of the opening brace.

NoMatchingOpeningBrace

This error gets reported when a closing brace has no matching opening brace.

Example

}
Show fields

Fields of NoMatchingOpeningBrace

span: Range<usize>

Span of the closing brace with no matching opening brace.

NoMatchingClosingBrace

This error gets reported when an opening brace is not closed i.e. it has no matching closing brace.

Example

%macro {
Show fields

Fields of NoMatchingClosingBrace

span: Range<usize>

Span of the opening brace with no matching closing brace.

SublabelDefinedWithoutScope

This error gets reported during an attempt to define a sublabel, when no previous label has been defined.

Example

&sublabel
Show fields

Fields of SublabelDefinedWithoutScope

name: String

Name of the sublabel.

span: Range<usize>

Span of the sublabel definition.

NoMatchingOpeningBracket

This error gets reported when a closing bracket has no matching opening bracket.

Example

]
Show fields

Fields of NoMatchingOpeningBracket

span: Range<usize>

Span of the closing bracket with no matching opening bracket.

NoMatchingClosingBracket

This error gets reported when an opening bracket is not closed i.e. it has no matching closing bracket.

Example

[
Show fields

Fields of NoMatchingClosingBracket

span: Range<usize>

Span of the opening bracket with no matching closing bracket.

MacroError

This error wraps an error that has been reported from a macro definition.

Example

%macro { #001 }
macro
Show fields

Fields of MacroError

original_error: Box<Error>

The error that has been reported from a macro definition.

span: Range<usize>

Span of the macro invocation.

SublabelReferencedWithoutScope

This error gets reported during an attempt to reference a sublabel, when no previous label has been defined.

Example

.&sublabel
Show fields

Fields of SublabelReferencedWithoutScope

name: String

Name of the sublabel.

span: Range<usize>

Span of the sublabel reference.

LabelUndefined

This error gets reported during an attempt to reference a label that has not been defined.

Example

.label
Show fields

Fields of LabelUndefined

name: String

Name of the label.

span: Range<usize>

Span of the label reference.

AddressNotZeroPage

This error gets reported during an attempt to reference a non-zero-page label after a literal zero-page address rune.

Example

|0100 @label
.label
Show fields

Fields of AddressNotZeroPage

address: u16

The actuall address that is not zero-page.

identifier: String

Name of the identifier that is referenced by the literal zero-page address.

span: Range<usize>

Span of the literal zero-page address.

AddressTooFar

This error gets reported during an attempt to reference a label that is too far to be a relative address after a literal relative address rune.

Example

@label
|0100 ,label
Show fields

Fields of AddressTooFar

distance: usize

The distance in bytes from the literal relative address and the label definition.

identifier: String

Name of the identifier that is referenced by the literal relative address.

span: Range<usize>

Span of the literal relative address.

other_span: Range<usize>

Span of the label definition that is referenced by the literal relative address.

BytesInZerothPage

This error gets reported when there are bytes in the zeroth page (first 256 bytes) of the binary.

Example

#01 #02 ADD
Show fields

Fields of BytesInZerothPage

span: Range<usize>

Span of the tokens in the zeroth page.

PaddedBackwards

This error gets reported during an attempt to do an absolute pad to an address before the current address pointer.

Example

#01 #02 ADD
|0000 #02 #03 ADD
Show fields

Fields of PaddedBackwards

previous_pointer: usize

The address at which the absolute pad is attempted.

desired_pointer: usize

The address to which the absolute pad is attempted.

span: Range<usize>

Span of the absolute pad.

ProgramTooLong

This error gets reported when the program size exceeds 65536 bytes.

Example

|ffff #01 #02 ADD
Show fields

Fields of ProgramTooLong

span: Range<usize>

Span of the tokens that exceed the maximum size.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.