Enum cpclib_asm::parser::LocatedToken
source · [−]pub enum LocatedToken {
Show 21 variants
Standard {
token: Token,
span: Z80Span,
},
Defb(Vec<LocatedExpr>, Z80Span),
Defw(Vec<LocatedExpr>, Z80Span),
CrunchedSection(CrunchType, LocatedListing, Z80Span),
Str(Vec<LocatedExpr>, Z80Span),
For {
label: Z80Span,
start: LocatedExpr,
stop: LocatedExpr,
step: Option<LocatedExpr>,
listing: LocatedListing,
span: Z80Span,
},
Function(Z80Span, Vec<Z80Span>, LocatedListing, Z80Span),
Include(Z80Span, Option<Z80Span>, bool, Z80Span),
Incbin {
fname: Z80Span,
offset: Option<LocatedExpr>,
length: Option<LocatedExpr>,
extended_offset: Option<LocatedExpr>,
off: bool,
transformation: BinaryTransformation,
span: Z80Span,
},
If(Vec<(LocatedTestKind, LocatedListing)>, Option<LocatedListing>, Z80Span),
Label(Z80Span),
Macro {
name: Z80Span,
params: Vec<Z80Span>,
content: Z80Span,
span: Z80Span,
},
MacroCall(Z80Span, Vec<LocatedMacroParam>, Z80Span),
Repeat(LocatedExpr, LocatedListing, Option<Z80Span>, Option<LocatedExpr>, Z80Span),
Iterate(Z80Span, Either<Vec<LocatedExpr>, LocatedExpr>, LocatedListing, Z80Span),
RepeatUntil(LocatedExpr, LocatedListing, Z80Span),
Rorg(LocatedExpr, LocatedListing, Z80Span),
Struct(Z80Span, Vec<(Z80Span, LocatedToken)>, Z80Span),
Switch(LocatedExpr, Vec<(LocatedExpr, LocatedListing, bool)>, Option<LocatedListing>, Z80Span),
While(LocatedExpr, LocatedListing, Z80Span),
Module(Z80Span, LocatedListing, Z80Span),
}Expand description
Add span information for a Token. This hierarchy is a mirror of the original token one
Variants
Standard
Fields
token: TokenThe original token without any span information
span: Z80SpanThe span that correspond to the token
A token without any listing embedding
Defb(Vec<LocatedExpr>, Z80Span)
Defw(Vec<LocatedExpr>, Z80Span)
CrunchedSection(CrunchType, LocatedListing, Z80Span)
Str(Vec<LocatedExpr>, Z80Span)
For
Fields
label: Z80Spanstart: LocatedExprstop: LocatedExprstep: Option<LocatedExpr>listing: LocatedListingspan: Z80SpanFunction(Z80Span, Vec<Z80Span>, LocatedListing, Z80Span)
Include(Z80Span, Option<Z80Span>, bool, Z80Span)
Incbin
Fields
fname: Z80Spanoffset: Option<LocatedExpr>length: Option<LocatedExpr>extended_offset: Option<LocatedExpr>off: booltransformation: BinaryTransformationspan: Z80SpanIf(Vec<(LocatedTestKind, LocatedListing)>, Option<LocatedListing>, Z80Span)
Label(Z80Span)
Macro
MacroCall(Z80Span, Vec<LocatedMacroParam>, Z80Span)
Name, Parameters, FullSpan
Repeat(LocatedExpr, LocatedListing, Option<Z80Span>, Option<LocatedExpr>, Z80Span)
Iterate(Z80Span, Either<Vec<LocatedExpr>, LocatedExpr>, LocatedListing, Z80Span)
RepeatUntil(LocatedExpr, LocatedListing, Z80Span)
Rorg(LocatedExpr, LocatedListing, Z80Span)
Struct(Z80Span, Vec<(Z80Span, LocatedToken)>, Z80Span)
Name, Parameters, FullSpan
Switch(LocatedExpr, Vec<(LocatedExpr, LocatedListing, bool)>, Option<LocatedListing>, Z80Span)
While(LocatedExpr, LocatedListing, Z80Span)
Module(Z80Span, LocatedListing, Z80Span)
Implementations
sourceimpl LocatedToken
impl LocatedToken
Trait Implementations
sourceimpl Clone for LocatedToken
impl Clone for LocatedToken
sourceimpl Debug for LocatedToken
impl Debug for LocatedToken
sourceimpl Display for LocatedToken
impl Display for LocatedToken
sourceimpl ListingElement for LocatedToken
impl ListingElement for LocatedToken
type Expr = LocatedExpr
type MacroParam = LocatedMacroParam
type TestKind = LocatedTestKind
fn mnemonic(&self) -> Option<&Mnemonic>
fn mnemonic_arg1(&self) -> Option<&DataAccess>
fn mnemonic_arg2(&self) -> Option<&DataAccess>
fn mnemonic_arg1_mut(&mut self) -> Option<&mut DataAccess>
fn mnemonic_arg2_mut(&mut self) -> Option<&mut DataAccess>
fn is_directive(&self) -> bool
fn is_rorg(&self) -> bool
fn rorg_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn rorg_expr(&self) -> &Self::Expr
fn is_iterate(&self) -> bool
fn iterate_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn iterate_counter_name(&self) -> &str
fn iterate_values(&self) -> Either<&Vec<Self::Expr>, &Self::Expr>
fn is_for(&self) -> bool
fn for_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn for_label(&self) -> &str
fn for_start(&self) -> &Self::Expr
fn for_stop(&self) -> &Self::Expr
fn for_step(&self) -> Option<&Self::Expr>
fn is_repeat_until(&self) -> bool
fn repeat_until_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn repeat_until_condition(&self) -> &Self::Expr
fn is_repeat(&self) -> bool
fn repeat_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn repeat_count(&self) -> &Self::Expr
fn repeat_counter_name(&self) -> Option<&str>
fn repeat_counter_start(&self) -> Option<&Self::Expr>
fn is_macro_definition(&self) -> bool
fn macro_definition_name(&self) -> &str
fn macro_definition_arguments(&self) -> SmallVec<[&str; 4]>
fn macro_definition_code(&self) -> &str
fn macro_call_name(&self) -> &str
fn macro_call_arguments(&self) -> &[Self::MacroParam]
fn is_if(&self) -> bool
fn if_nb_tests(&self) -> usize
fn if_test(&self, idx: usize) -> (&Self::TestKind, &[Self])
fn if_else(&self) -> Option<&[Self]>
fn is_include(&self) -> bool
fn is_incbin(&self) -> bool
fn incbin_fname(&self) -> &str
fn incbin_offset(&self) -> Option<&Self::Expr>
fn incbin_length(&self) -> Option<&Self::Expr>
fn incbin_transformation(&self) -> &BinaryTransformation
fn include_fname(&self) -> &str
fn include_namespace(&self) -> Option<&str>
fn include_once(&self) -> bool
fn is_call_macro_or_build_struct(&self) -> bool
fn is_function_definition(&self) -> bool
fn function_definition_name(&self) -> &str
fn function_definition_params(&self) -> SmallVec<[&str; 4]>
fn function_definition_inner(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn is_crunched_section(&self) -> bool
fn crunched_section_listing(&self) -> &[Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn crunched_section_kind(&self) -> &CrunchType
sourceimpl MayHaveSpan for LocatedToken
impl MayHaveSpan for LocatedToken
sourceimpl ParsingStateVerified for LocatedToken
impl ParsingStateVerified for LocatedToken
fn is_accepted(&self, state: &ParsingState) -> bool
sourceimpl ReturnExpr for LocatedToken
impl ReturnExpr for LocatedToken
fn return_expr(&self) -> Option<&Expr>
sourceimpl ToSimpleToken for LocatedToken
impl ToSimpleToken for LocatedToken
sourcefn as_simple_token(&self) -> Cow<'_, Token>
fn as_simple_token(&self) -> Cow<'_, Token>
Convert the token in its simplest form
sourceimpl TokenExt for LocatedToken
impl TokenExt for LocatedToken
fn estimated_duration(&self) -> Result<usize, AssemblerError>
sourcefn unroll(&self, _env: &Env) -> Option<Result<Vec<&Self>, AssemblerError>>
fn unroll(&self, _env: &Env) -> Option<Result<Vec<&Self>, AssemblerError>>
Unroll the tokens when it represents a loop
sourcefn disassemble_data(&self) -> Result<Listing, String>
fn disassemble_data(&self) -> Result<Listing, String>
Generate the listing of opcodes for directives that embed bytes
fn to_bytes_with_options(
&self,
_option: &AssemblingOptions
) -> Result<Vec<u8>, AssemblerError>
fn number_of_bytes(&self) -> Result<usize, String>
sourcefn number_of_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent
) -> Result<usize, String>
fn number_of_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent
) -> Result<usize, String>
Return the number of bytes of the token given the provided context
sourcefn to_bytes(&self) -> Result<Vec<u8>, AssemblerError>
fn to_bytes(&self) -> Result<Vec<u8>, AssemblerError>
Dummy version that assemble without taking into account the context TODO find a way to not build a symbol table each time Read more
sourcefn to_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent
) -> Result<Vec<u8>, AssemblerError>
fn to_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent
) -> Result<Vec<u8>, AssemblerError>
Assemble the symbol taking into account some context, but never modify this context
sourceimpl Visited for LocatedToken
impl Visited for LocatedToken
Auto Trait Implementations
impl RefUnwindSafe for LocatedToken
impl Send for LocatedToken
impl Sync for LocatedToken
impl Unpin for LocatedToken
impl UnwindSafe for LocatedToken
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self to use its Binary implementation when Debug-formatted. Read more
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self to use its Display implementation when
Debug-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self to use its LowerExp implementation when
Debug-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self to use its LowerHex implementation when
Debug-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self to use its Octal implementation when Debug-formatted. Read more
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self to use its Pointer implementation when
Debug-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self to use its UpperExp implementation when
Debug-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self to use its UpperHex implementation when
Debug-formatted. Read more
fn fmt_list(self) -> FmtList<Self> where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self> where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.borrow() into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
Mutably borrows self, then passes self.borrow_mut() into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.as_ref() into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self, then passes self.as_mut() into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.deref() into the pipe function.
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B> of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B> of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R> view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R> view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap() only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut() only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow() only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut() only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref() only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut() only in debug builds, and is erased in release
builds. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more