Spreadsheet formula references
Your task
A spreadsheet pastes a copied formula into another cell, and the paste has to move the references the formula holds. A reference is an optional dollar sign, one or more uppercase letters naming the column, an optional dollar sign, then one or more digits naming the row, as in A1, $A1, A$1 or $A$1. A dollar sign pins the half that follows it, so that half does not move. Given formula, row_delta and col_delta, return the formula with every unpinned row shifted by row_delta and every unpinned column shifted by col_delta, with every other character copied through unchanged. Columns run A to Z, then AA, AB and onward, so column 27 is AA. Letters with no digits after them are a function name, not a reference. The deltas never push a reference above row 1 or left of column A.
Examples
shift_formula_refs(formula: str, row_delta: int, col_delta: int) -> strshift_formula_refs("=A1+B2", 2, 0)"=A3+B4"shift_formula_refs("=$A$1+A1", 1, 1)"=$A$1+B2"shift_formula_refs("=SUM(A1:A3)*2", 0, 1)"=SUM(B1:B3)*2"