'converts a symbolic char to a number in the given base
returns expression, result
expression is a symbolic boolean indicating whether or not it was a valid number
result is the value'

@staticmethod
def _char_to_val(char, state, base):

    cases = []
    max_digit = state.se.BVV('9', 8)
    min_digit = state.se.BVV('0', 8)
    if (base < 10):
        max_digit = state.se.BVV(chr((ord('0') + base)), 8)
    is_digit = state.se.And((char >= min_digit), (char <= max_digit))
    if (base <= 10):
        return (is_digit, (char - min_digit))
    max_char_lower = state.se.BVV(chr((((ord('a') + base) - 10) - 1)), 8)
    max_char_upper = state.se.BVV(chr((((ord('A') + base) - 10) - 1)), 8)
    min_char_lower = state.se.BVV(chr(ord('a')), 8)
    min_char_upper = state.se.BVV(chr(ord('A')), 8)
    cases.append((is_digit, (char - min_digit)))
    is_alpha_lower = state.se.And((char >= min_char_lower), (char <= max_char_lower))
    cases.append((is_alpha_lower, ((char - min_char_lower) + 10)))
    is_alpha_upper = state.se.And((char >= min_char_upper), (char <= max_char_upper))
    cases.append((is_alpha_upper, ((char - min_char_upper) + 10)))
    expression = state.se.Or(is_digit, is_alpha_lower, is_alpha_upper)
    result = state.se.ite_cases(cases[:(-1)], cases[(-1)][1])
    return (expression, result)
