Parse a pic field line. Return A VariableNode or None in case of malformed
    code.

    :param l: The line number (starting from 0)
    :param c: The column number (starting from 0)
    :param last_section_node: The last section node found
    :param last_vars: The last vars dict
    :param line: The line string (without indentation)
    :return: The extracted variable node

def parse_pic_field(l, c, last_section_node, last_vars, line):
    """
    Parse a pic field line. Return A VariableNode or None in case of malformed
    code.

    :param l: The line number (starting from 0)
    :param c: The column number (starting from 0)
    :param last_section_node: The last section node found
    :param last_vars: The last vars dict
    :param line: The line string (without indentation)
    :return: The extracted variable node
    """
    parent_node = None
    raw_tokens = line.split(" ")
    tokens = []
    for t in raw_tokens:
        if not t.isspace() and t != "":
            tokens.append(t)
    try:
        if tokens[0].upper() == "FD":
            lvl = 1
        else:
            lvl = int(tokens[0], 16)
        name = tokens[1]
    except ValueError:
        return None
    except IndexError:
        # line not complete
        return None
    name = name.replace(".", "")
    if name in ALL_KEYWORDS or name in ['-', '/']:
        return None
    m = re.findall(r'pic.*\.', line, re.IGNORECASE)
    if m:
        description = ' '.join([t for t in m[0].split(' ') if t])
    else:
        description = line
    try:
        index = description.lower().index('value')
    except ValueError:
        description = description.replace('.', '')
    else:
        description = description[index:].replace('value', '')[:80]
    if lvl == int('78', 16):
        lvl = 1
    if lvl == 1:
        parent_node = last_section_node
        last_vars.clear()
    else:
        # find parent level
        levels = sorted(last_vars.keys(), reverse=True)
        for lv in levels:
            if lv < lvl:
                parent_node = last_vars[lv]
                break
    if not parent_node:
        # malformed code
        return None
    # todo: enabled this with an option in pyqode 3.0
    # if lvl == int('88', 16):
    #     return None
    if not name or name.upper().strip() == 'PIC':
        name = 'FILLER'
    node = Name(Name.Type.Variable, l, c, name, description)
    parent_node.add_child(node)
    last_vars[lvl] = node
    # remove closed variables
    levels = sorted(last_vars.keys(), reverse=True)
    for l in levels:
        if l > lvl:
            last_vars.pop(l)
    return node