def line_to_variables(source, line, inherit_permission, parent):
    """
    Returns a list of variables declared in the provided line of code. The
    line of code should be provided as a string.
    """
    vartype, kind, strlen, proto, rest = parse_type(line,parent.strings,parent.settings)
    attribs = []
    intent = ""
    optional = False
    permission = inherit_permission
    parameter = False

    attribmatch = ATTRIBSPLIT_RE.match(rest)
    if attribmatch:
        attribstr = attribmatch.group(1).strip()
        declarestr = attribmatch.group(2).strip()
        tmp_attribs = ford.utils.paren_split(",",attribstr)
        for i in range(len(tmp_attribs)):
            tmp_attribs[i] = tmp_attribs[i].strip()
            if tmp_attribs[i].lower() == "public": permission = "public"
            elif tmp_attribs[i].lower() == "private": permission = "private"
            elif tmp_attribs[i].lower() == "protected": permission = "protected"
            elif tmp_attribs[i].lower() == "optional": optional = True
            elif tmp_attribs[i].lower() == "parameter": parameter = True
            elif tmp_attribs[i].lower().replace(' ','') == "intent(in)":
                intent = 'in'
            elif tmp_attribs[i].lower().replace(' ','') == "intent(out)":
                intent = 'out'
            elif tmp_attribs[i].lower().replace(' ','') == "intent(inout)":
                intent = 'inout'
            else: attribs.append(tmp_attribs[i])
    else:
        declarestr = ATTRIBSPLIT2_RE.match(rest).group(2)
    declarations = ford.utils.paren_split(",",declarestr)

    varlist = []
    for dec in declarations:
        dec = re.sub(" ","",dec)
        split = ford.utils.paren_split('=',dec)
        if len(split) > 1:
            name = split[0]
            if split[1][0] == '>':
                initial = split[1][1:]
                points = True
            else:
                initial = split[1]
                points = False
        else:
            name = dec.strip()
            initial = None
            points = False

        if initial:
            initial = COMMA_RE.sub(', ',initial)
            search_from = 0
            while QUOTES_RE.search(initial[search_from:]):
                num = int(QUOTES_RE.search(initial[search_from:]).group()[1:-1])
                old_string = NBSP_RE.sub('&nbsp;',parent.strings[num])
                string = ''
                for i in range(len(old_string)):
                    if old_string[i] == "\\" and (old_string[i+1] in '0123456789' or
                                                   old_string[i+1] == 'g'):
                        string += r'\\'
                    elif old_string[i] == '(' and old_string[i+1] =='?':
                        string += r'\('
                    else:
                        string += old_string[i]
                initial = initial[0:search_from] + QUOTES_RE.sub(string,initial[search_from:],count=1)
                search_from += QUOTES_RE.search(initial[search_from:]).end(0)

        if proto:
            varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
                           optional,permission,parameter,kind,strlen,list(proto),
                           [],points,initial))
        else:
            varlist.append(FortranVariable(name,vartype,parent,copy.copy(attribs),intent,
                           optional,permission,parameter,kind,strlen,proto,
                           [],points,initial))

    doc = []
    docline = source.__next__()
    while docline[0:2] == "!" + parent.settings['docmark']:
        doc.append(docline[2:])
        docline = source.__next__()
    source.pass_back(docline)
    for var in varlist: var.doc = doc
    return varlist
def line_to_variables ( source , line , inherit_permission , parent ) : vartype , kind , strlen , proto , rest = parse_type ( line , parent . strings , parent . settings ) attribs = [ ] intent = "" optional = False permission = inherit_permission parameter = False attribmatch = ATTRIBSPLIT_RE . match ( rest ) if attribmatch : attribstr = attribmatch . group ( 1 ) . strip ( ) declarestr = attribmatch . group ( 2 ) . strip ( ) tmp_attribs = ford . utils . paren_split ( "," , attribstr ) for i in range ( len ( tmp_attribs ) ) : tmp_attribs [ i ] = tmp_attribs [ i ] . strip ( ) if tmp_attribs [ i ] . lower ( ) == "public" : permission = "public" elif tmp_attribs [ i ] . lower ( ) == "private" : permission = "private" elif tmp_attribs [ i ] . lower ( ) == "protected" : permission = "protected" elif tmp_attribs [ i ] . lower ( ) == "optional" : optional = True elif tmp_attribs [ i ] . lower ( ) == "parameter" : parameter = True elif tmp_attribs [ i ] . lower ( ) . replace ( ' ' , '' ) == "intent(in)" : intent = 'in' elif tmp_attribs [ i ] . lower ( ) . replace ( ' ' , '' ) == "intent(out)" : intent = 'out' elif tmp_attribs [ i ] . lower ( ) . replace ( ' ' , '' ) == "intent(inout)" : intent = 'inout' else : attribs . append ( tmp_attribs [ i ] ) else : declarestr = ATTRIBSPLIT2_RE . match ( rest ) . group ( 2 ) declarations = ford . utils . paren_split ( "," , declarestr ) varlist = [ ] for dec in declarations : dec = re . sub ( " " , "" , dec ) split = ford . utils . paren_split ( '=' , dec ) if len ( split ) > 1 : name = split [ 0 ] if split [ 1 ] [ 0 ] == '>' : initial = split [ 1 ] [ 1 : ] points = True else : initial = split [ 1 ] points = False else : name = dec . strip ( ) initial = None points = False if initial : initial = COMMA_RE . sub ( ', ' , initial ) search_from = 0 while QUOTES_RE . search ( initial [ search_from : ] ) : num = int ( QUOTES_RE . search ( initial [ search_from : ] ) . group ( ) [ 1 : - 1 ] ) old_string = NBSP_RE . sub ( '&nbsp;' , parent . strings [ num ] ) string = '' for i in range ( len ( old_string ) ) : if old_string [ i ] == "\\" and ( old_string [ i + 1 ] in '0123456789' or old_string [ i + 1 ] == 'g' ) : string += r'\\' elif old_string [ i ] == '(' and old_string [ i + 1 ] == '?' : string += r'\(' else : string += old_string [ i ] initial = initial [ 0 : search_from ] + QUOTES_RE . sub ( string , initial [ search_from : ] , count = 1 ) search_from += QUOTES_RE . search ( initial [ search_from : ] ) . end ( 0 ) if proto : varlist . append ( FortranVariable ( name , vartype , parent , copy . copy ( attribs ) , intent , optional , permission , parameter , kind , strlen , list ( proto ) , [ ] , points , initial ) ) else : varlist . append ( FortranVariable ( name , vartype , parent , copy . copy ( attribs ) , intent , optional , permission , parameter , kind , strlen , proto , [ ] , points , initial ) ) doc = [ ] docline = source . __next__ ( ) while docline [ 0 : 2 ] == "!" + parent . settings [ 'docmark' ] : doc . append ( docline [ 2 : ] ) docline = source . __next__ ( ) source . pass_back ( docline ) for var in varlist : var . doc = doc return varlist
Returns a list of variables declared in the provided line of code. The
    line of code should be provided as a string.