Extract the token for an identifier from the context. Tokens can be:
        * ID - The name of a JSG definition
        * idref -- A reference to an existing JSG definition
        * LEXER_ID - The name of a match pattern definition
        * LEXER_ID_REF - A reference to an existing match pattern definition
        * STRING -- A JSG item name enclosed in quotes

        :param ctx: JSG parser item with some sort of identifier
        :return:

def get_terminal(ctx: ParserRuleContext) -> str:
    """ Extract the token for an identifier from the context. Tokens can be:
        * ID - The name of a JSG definition
        * idref -- A reference to an existing JSG definition
        * LEXER_ID - The name of a match pattern definition
        * LEXER_ID_REF - A reference to an existing match pattern definition
        * STRING -- A JSG item name enclosed in quotes

        :param ctx: JSG parser item with some sort of identifier
        :return:
        """
    tkn = None
    for ele_name in identifier_types:
        ele = getattr(ctx, ele_name, None)
        if ele and ele():
            tkn = ele().getText()[1:-1] if ele_name == 'STRING' else ele().getText()
    return str(tkn)