~nabijaczleweli/yaxpeax-superh

57bd929e01116532e2ceb761747aef6467707530 — наб 18 days ago f2087f2
Fix display of immediates
2 files changed, 9 insertions(+), 3 deletions(-)

M build.rs
M tests/bare/mod.rs
M build.rs => build.rs +3 -2
@@ 101,7 101,7 @@ fn main() {
    arguments.insert("u8",
                     Argument {
                         tp: ArgumentType::Literal(0xFF + 1),
                         prefix: "#imm",
                         prefix: "imm",
                         prefix_alt: None,
                         suffix: "",
                         multiplier: 0,


@@ 351,7 351,7 @@ fn main() {
            const FAKE_ARGUMENTS: &[&str] = &["", "@(R0", "FPUL", "PC)", "R0", "FR0", "DBR", "GBR", "SGR", "SPC", "SR", "SSR", "VBR", "FPSCR", "MACH", "MACL",
                                              "PR"];
            for (mut disp_arg, arg_tp) in instr.disp.split(|c| c == ' ' || c == ',').skip(1).filter(|d| !FAKE_ARGUMENTS.contains(d)).zip(instr.args.iter()) {
                while disp_arg.starts_with(|ref c| ['(', '@', '-'].contains(c)) {
                while disp_arg.starts_with(|ref c| ['(', '@', '-', '#'].contains(c)) {
                    disp_arg = &disp_arg[1..];
                }
                for &sfx in &[')', '+'] {


@@ 382,6 382,7 @@ fn main() {
                display_format.push_str(&instr.disp[last_disp_idx..this_disp_idx]);
                display_format.push_str("{}");
                last_disp_idx = this_disp_idx + disp_arg.len();

            }

            display_format.push_str(&instr.disp[last_disp_idx..]);

M tests/bare/mod.rs => tests/bare/mod.rs +6 -1
@@ 1,6 1,6 @@
extern crate yaxpeax_superh;

use yaxpeax_superh::SuperHInstruction;
use yaxpeax_superh::{SuperHInstruction, SuperHRegister};


#[test]


@@ 15,6 15,11 @@ fn round_trip() {
    }
}

#[test]
fn display() {
    assert_eq!(format!("{}", SuperHInstruction::MovImm(0x69, SuperHRegister::R4)), "MOV #105,R4"); // Agrees with objdump
}


mod generated_f64 {
    use yaxpeax_superh::{SuperHInstruction, SuperHRegister, SuperHRegisterBank, SuperHFloatRegister, SuperHVectorFloatRegister, SuperHDoubleRegister,