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

Function parse_quoted_string

crates/asm-to-binary/src/assembler/directive.rs:60–73  ·  view source on GitHub ↗

Strip the surrounding `"..."` from a quoted string directive argument.

(s: &str)

Source from the content-addressed store, hash-verified

58 ".dword" | ".quad" => parse_u64(rest, constants).map(Self::Dword),
59 ".asciz" | ".string" => parse_quoted_string(rest).map(Self::Asciz),
60 ".space" | ".zero" => parse_u64(rest, constants).map(Self::Space),
61 ".equ" | ".set" => {
62 let mut parts = rest.splitn(2, ',');
63 let name = parts.next()?.trim();
64 if name.is_empty()
65 || !name
66 .chars()
67 .all(|character| character.is_ascii_alphanumeric() || character == '_')
68 {
69 return None;
70 }
71 let val: i64 = parts.next()?.trim().parse().ok()?;
72 Some(Self::Equ(name.to_owned(), val))
73 }
74 _ if [
75 ".section", ".text", ".data", ".rodata", ".bss", ".globl", ".global", ".align",
76 ".balign", ".byte", ".half", ".short", ".word", ".long", ".dword", ".quad",

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected