Ejemplo n.º 1
0
struct variable* child_variables(Dwarf_Die *parent, Dwarf_Files *files,
                                 struct expr_context *ctx, bool params)
{
    int ret;
    Dwarf_Die die;
    struct variable *var, *head = NULL, *tail = NULL;
    int desired_tag = params ? DW_TAG_formal_parameter : DW_TAG_variable;

    ret = dwarf_child(parent, &die);
    if (ret != 0)
        return NULL;

    do
    {
        if (dwarf_tag(&die) == desired_tag)
        {
            var = analyze_variable(&die, files, ctx);
            if (!var)
                continue;

            list_append(head, tail, var);
        }
    } while (dwarf_siblingof(&die, &die) == 0);

    return head;
}
static
void scan_tokens(processorfn_t fn, void *arg)
{
    int token;

    while ((token = get_token()) != 0)
    {
        if (token != TOKEN_COMMENT)
        {
            last_text_line = *ratslexer.lex_lineno;
            if (current_ignore != (ignore_t *)NULL)
            {
                current_ignore->lineno = *ratslexer.lex_lineno;
                current_ignore = (ignore_t *)NULL;
            }
        }
        if (fn != NULL)
            if (!fn(token, arg))
                break;
        switch (token)
        {
        
            case TOKEN_DOUBLE:
            case TOKEN_FLOAT:
            case TOKEN_INT:
            case TOKEN_LONG:
            case TOKEN_SHORT:
            case TOKEN_STRUCT:
            case TOKEN_VOID:
            case TOKEN_ENUM:
            case TOKEN_UNION:
            case TOKEN_CHAR:
                analyze_variable(token);
                break;

            case TOKEN_IDENTIFIER:
                analyze_identifier();
                break;

            case TOKEN_COMMENT:
                analyze_comment();
                break;

            case '`':
                analyze_backticks();
                break;
 
        }
    }
}