def _translate_token()

in o2a/o2a_libs/src/o2a_lib/el_parser.py [0:0]


def _translate_token(token: Token) -> str:
    """
    Translates non-python values to python equivalents.
    """
    if token.type == "BEGIN":
        token.value = " {{"

    if token.type == "END":
        token.value = "}} "

    if token.type == "INVOCATION_COLON":
        token.value = "."

    if token.type == "NULL":
        token.value = None

    if token.type == "FUNC":
        token.value = _camel_to_snake(token.value)

    if token.type == "BOOL":
        if token.value == "true":
            token.value = True
        else:
            token.value = False

    if token.type == "FIRST_JAVA":
        if token.value in EL_CONSTANTS.keys():
            return str(EL_CONSTANTS[token.value])

    return str(token.value)