package main type NumMutator struct { Op NumOperator Var bool Value int } type NumOperator string const ( NumOperatorAdd NumOperator = "+" NumOperatorSub NumOperator = "-" NumOperatorMul NumOperator = "*" NumOperatorDiv NumOperator = "/" ) func NewNumOperatorFromString(str string) NumOperator { switch str { case "+": return NumOperatorAdd case "-": return NumOperatorSub case "*": return NumOperatorMul case "/": return NumOperatorDiv default: panic("invalid number operator: " + str) } }