MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / parse_la

Function parse_la

crates/asm-to-binary/src/assembler/parser.rs:534–546  ·  view source on GitHub ↗

Parse `rd, symbol` for the `la` pseudo-instruction.

(operands: &str)

Source from the content-addressed store, hash-verified

532 Some((rs1, imm))
533}
534
535fn split_mnemonic(line: &str) -> (&str, &str) {
536 match line.find(|c: char| c.is_whitespace()) {
537 Some(idx) => (&line[..idx], line[idx..].trim_start()),
538 None => (line, ""),
539 }
540}
541
542// Parse `rs1, rs2, label` for a branch instruction.
543fn parse_branch(kind: BranchKind, operands: &str) -> Option<AsmToken> {
544 let parts: Vec<&str> = operands.splitn(3, ',').collect();
545 if parts.len() != 3 {
546 return None;
547 }
548 let rs1 = parse_int_reg(parts[0].trim())?;
549 let rs2 = parse_int_reg(parts[1].trim())?;

Callers

nothing calls this directly

Calls 2

parse_int_regFunction · 0.85
collectMethod · 0.80

Tested by

no test coverage detected