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

Method parse_shift

crates/hll-to-ir/src/parser.rs:839–861  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

837 })
838 }
839
840 // Strip the wrapper carried by opening and one-line asm source lines.
841 fn normalize_asm_line(line: &str) -> String {
842 let mut s = line;
843 if let Some(idx) = s.find('{') {
844 s = &s[idx + 1..];
845 }
846 if let Some(idx) = s.rfind('}') {
847 s = &s[..idx];
848 }
849 s.trim().to_owned()
850 }
851
852 // Parse the three typed bridge forms; keep every other line raw.
853 fn parse_asm_ops(&mut self, lines: Vec<String>) -> Result<Vec<crate::ast::AsmOp>, ParserError> {
854 use crate::ast::AsmOp;
855 let mut ops = Vec::with_capacity(lines.len());
856 for line in lines {
857 let code = line
858 .split_once(';')
859 .map_or(line.as_str(), |(code, _)| code)
860 .trim();
861 let (opcode, operands) = code
862 .split_once(char::is_whitespace)
863 .map_or((code, ""), |(opcode, operands)| (opcode, operands.trim()));
864 let operands = operands.split(',').map(str::trim).collect::<Vec<_>>();

Callers 1

parse_comparisonMethod · 0.80

Calls 4

parse_additiveMethod · 0.80
consume_terminatorsMethod · 0.80
match_shlMethod · 0.80
match_shrMethod · 0.80

Tested by

no test coverage detected