[][src]Enum cpclib_asm::preamble::Token

pub enum Token {
    Align(ExprOption<Expr>),
    Assert(ExprOption<String>),
    Bank(Expr),
    Bankset(Expr),
    Basic(Option<Vec<String>>, Option<Vec<u16>>, String),
    Break,
    Breakpoint(Option<Expr>),
    BuildCpr,
    BuildSna(SnapshotVersion),
    Comment(String),
    CrunchedBinary(CrunchTypeString),
    CrunchedSection(CrunchTypeBaseListing<Token>),
    Defb(Vec<Expr>),
    Defs(ExprOption<Expr>),
    Defw(Vec<Expr>),
    Equ(StringExpr),
    If(Vec<(TestKind, BaseListing<Token>)>, Option<BaseListing<Token>>),
    Incbin(StringOption<Expr>, Option<Expr>, Option<Expr>, Option<Expr>, Option<Vec<u8>>, BinaryTransformation),
    Include(StringOption<BaseListing<Token>>),
    Label(String),
    Let(StringExpr),
    Limit(Expr),
    List,
    Macro(StringVec<String>, String),
    MacroCall(StringVec<Expr>),
    NoList,
    OpCode(MnemonicOption<DataAccess>, Option<DataAccess>),
    Org(ExprOption<Expr>),
    Print(Vec<FormattedExpr>),
    Protect(ExprExpr),
    Repeat(ExprBaseListing<Token>, Option<String>),
    RepeatUntil(ExprBaseListing<Token>),
    Rorg(ExprBaseListing<Token>),
    Run(ExprOption<Expr>),
    Save {
        filename: String,
        address: Expr,
        size: Expr,
        save_type: Option<SaveType>,
        dsk_filename: Option<String>,
        side: Option<Expr>,
    },
    SetCPC(Expr),
    SetCrtc(Expr),
    StableTicker(StableTickerAction),
    Str(Vec<u8>),
    Struct(StringVec<(String, Token)>),
    Switch(Vec<(Expr, BaseListing<Token>)>),
    Undef(String),
    While(ExprBaseListing<Token>),
}

Variants

Align(ExprOption<Expr>)
Assert(ExprOption<String>)
Bank(Expr)
Bankset(Expr)

Basic code which tokens will be included in the code (imported variables, lines to hide, code)

Break
Breakpoint(Option<Expr>)
BuildCpr
BuildSna(SnapshotVersion)
Comment(String)
CrunchedBinary(CrunchTypeString)
CrunchedSection(CrunchTypeBaseListing<Token>)
Defb(Vec<Expr>)
Defs(ExprOption<Expr>)
Defw(Vec<Expr>)
Equ(StringExpr)

Conditional expression. _0 contains all the expression and the appropriate code, _1 contains the else case

Include of an asm file _0 contains the name of the file, _1 contains the content of the file. It is not loaded at the creation of the Token because there is not enough context to know where to load file

Label(String)
Let(StringExpr)
Limit(Expr)
List
Macro(StringVec<String>, String)
MacroCall(StringVec<Expr>)
NoList
Org(ExprOption<Expr>)
Protect(ExprExpr)

Duplicate the token stream

RepeatUntil(ExprBaseListing<Token>)

Set the value of $ to Expr

Run(ExprOption<Expr>)
Save

Fields of Save

filename: Stringaddress: Exprsize: Exprsave_type: Option<SaveType>dsk_filename: Option<String>side: Option<Expr>
SetCPC(Expr)
SetCrtc(Expr)
StableTicker(StableTickerAction)
Str(Vec<u8>)
Struct(StringVec<(String, Token)>)
Undef(String)

Methods

impl Token[src]

pub fn is_opcode(&self) -> bool[src]

pub fn label(&self) -> Option<&String>[src]

pub fn mnemonic(&self) -> Option<&Mnemonic>[src]

pub fn mnemonic_arg1(&self) -> Option<&DataAccess>[src]

pub fn mnemonic_arg2(&self) -> Option<&DataAccess>[src]

pub fn org_expr(&self) -> Option<&Expr>[src]

Deprecated since 0.1.1:

please use expr instead as other token need it

pub fn expr(&self) -> Option<&Expr>[src]

Trait Implementations

impl Clone for Token[src]

impl Debug for Token[src]

impl Display for Token[src]

impl Eq for Token[src]

impl From<u8> for Token[src]

impl ListingElement for Token[src]

impl PartialEq<Token> for Token[src]

impl StructuralEq for Token[src]

impl StructuralPartialEq for Token[src]

impl TokenExt for Token[src]

fn unroll(
    &self,
    sym: &SymbolsTableCaseDependent
) -> Option<Result<Vec<&Self>, AssemblerError>>
[src]

Unroll the tokens when in a repetition loop TODO return an iterator in order to not produce the vector each time

fn disassemble_data(&self) -> Result<Listing, String>[src]

Generate the listing of opcodes for directives that contain data Defb/defw/Defs in order to have mnemonics. Fails when some values are not opcodes

fn read_referenced_file(
    &mut self,
    ctx: &ParserContext
) -> Result<(), AssemblerError>
[src]

Modify the few tokens that need to read files TODO refactor file reading of filename search

fn to_bytes(&self) -> Result<Bytes, AssemblerError>[src]

Dummy version that assemble without taking into account the context TODO find a way to not build a symbol table each time

fn to_bytes_with_context(
    &self,
    table: &mut SymbolsTableCaseDependent
) -> Result<Bytes, AssemblerError>
[src]

Assemble the symbol taking into account some context, but never modify this context

fn estimated_duration(&self) -> Result<usize, String>[src]

Returns an estimation of the duration. This estimation may be wrong for instruction having several states.

fn number_of_bytes(&self) -> Result<usize, String>[src]

Return the number of bytes of the token

fn number_of_bytes_with_context(
    &self,
    table: &mut SymbolsTableCaseDependent
) -> Result<usize, String>
[src]

Return the number of bytes of the token given the provided context

impl<'_> TokenTryFrom<&'_ str> for Token[src]

impl TokenTryFrom<String> for Token[src]

Auto Trait Implementations

impl RefUnwindSafe for Token

impl Send for Token

impl Sync for Token

impl Unpin for Token

impl UnwindSafe for Token

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.