File: pdefaultesymbol.c

package info (click to toggle)
yodl 4.04.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,720 kB
  • sloc: ansic: 7,803; perl: 683; cpp: 570; sh: 411; xml: 190; makefile: 164
file content (35 lines) | stat: -rw-r--r-- 983 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "parser.ih"

void p_default_symbol(register Parser *pp, bool plusPrefix,
                        SymbolType notUsed)
{
    register HashItem *item =
        hashmap_find(pp->d_symtab_ptr, p_matched(pp), BUILTIN | MACRO);

    switch (hashitem_type(item))
    {
        case BUILTIN:
            if (message_show(MSG_INFO))
                message("Calling builtin %s", p_matched(pp));
            builtin_call((Builtin *)hashitem_value(item));
        return;

        case MACRO:
            if (message_show(MSG_INFO))
                message("Expanding macro %s", p_matched(pp));
            p_expand_macro(pp, item);
        return;

        default:
            if (plusPrefix)
                (*pp->d_insert)(pp, "+");

            if (message_show(MSG_INFO))
                message("Inserting text %s", p_matched(pp));
            (*pp->d_insert)(pp, p_matched(pp));

            if (pp->d_show_nomacros)
                p_no_user_macro(pp);
        return;
    }
}