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

Method parse_additive

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

Source from the content-addressed store, hash-verified

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<_>>();
865 match (opcode, operands.as_slice()) {
866 ("mv", [op1, op2]) => {
867 if let Some(place) = Self::parse_asm_place(op2) {
868 if op1.starts_with('$') {
869 return Err(self.error(
870 "asm bridge `mv` cannot move between two `$place` operands",
871 ));
872 }
873 ops.push(AsmOp::Load {
874 reg: (*op1).to_owned(),
875 place,
876 });
877 } else if op1.starts_with('$') {
878 let Some(place) = Self::parse_asm_place(op1) else {
879 return Err(self.error("invalid inline-asm `$place` operand"));
880 };
881 ops.push(AsmOp::Store {
882 place,
883 reg: (*op2).to_owned(),
884 });
885 } else {
886 ops.push(AsmOp::Raw(line.clone()));
887 }
888 }

Callers 2

parse_comparisonMethod · 0.80
parse_shiftMethod · 0.80

Calls 4

parse_multiplicativeMethod · 0.80
consume_terminatorsMethod · 0.80
match_plusMethod · 0.80
match_minusMethod · 0.80

Tested by

no test coverage detected