sql_mojo_parser/__init__.py
def p_colspec(p):
    '''
    colspec : STAR
            | NAME
            | function
            | NAME COMMA colspec
            | function COMMA colspec
    '''
    rest = p[3] if len(p) > 3 else []
    if p[1] == "*":
        p[0] = [{"type": "star"}]
    elif isinstance(p[1], dict) and p[1].get("type") == "function":
        p[0] = [p[1], *rest]
    elif p[1]:
        p[0] = [
            {
                "type": "name",
                "value": p[1],
            },
            *rest,
        ]
    else:
        p[0] = []
def p_colspec(p):
    '''
    colspec : STAR
            | NAME
            | function
            | NAME COMMA colspec
            | function COMMA colspec
    '''
    rest = p[3] if len(p) > 3 else []
    if p[1] == "*":
        p[0] = [{"type": "star"}]
    elif isinstance(p[1], dict) and p[1].get("type") == "function":
        p[0] = [p[1], *rest]
    elif p[1]:
        p[0] = [
            {
                "type": "name",
                "value": p[1],
            },
            *rest,
        ]
    else:
        p[0] = []
def p_colspec ( p ) : rest = p [ 3 ] if len ( p ) > 3 else [ ] if p [ 1 ] == "*" : p [ 0 ] = [ { "type" : "star" } ] elif isinstance ( p [ 1 ] , dict ) and p [ 1 ] . get ( "type" ) == "function" : p [ 0 ] = [ p [ 1 ] , * rest ] elif p [ 1 ] : p [ 0 ] = [ { "type" : "name" , "value" : p [ 1 ] , } , * rest , ] else : p [ 0 ] = [ ]
colspec : STAR
            | NAME
            | function
            | NAME COMMA colspec
            | function COMMA colspec
colspec : STAR | NAME | function | NAME COMMA colspec | function COMMA colspec