(dir: Directive, out: &mut Vec<AsmToken>)
| 126 | fn is_string_directive(raw: &str) -> bool { |
| 127 | let head = raw.trim_start(); |
| 128 | [".asciz ", ".string ", ".asciz\t", ".string\t"] |
| 129 | .iter() |
| 130 | .any(|d| head.starts_with(d)) |
| 131 | } |
| 132 | |
| 133 | fn parse_directive_or_instruction( |
| 134 | raw: &str, |
| 135 | constants: &HashMap<String, i64>, |
| 136 | out: &mut Vec<AsmToken>, |
| 137 | ) -> Result<(), String> { |
| 138 | // Strip trailing inline `;` or `#` comments before any classification. |
| 139 | // String directives keep theirs: the directive parser stops at the quote. |
| 140 | let raw = if is_string_directive(raw) { |
| 141 | raw |
| 142 | } else { |
| 143 | match raw.find([';', '#']) { |
| 144 | Some(i) => raw[..i].trim_end(), |
| 145 | None => raw, |
| 146 | } |
| 147 | }; |
no test coverage detected