Exemple #1
0
void function_declaration() {
    match('(');
    function_parameter();
    match(')');
    match('{');
    function_body();

    current_id = symbols;
    while (current_id[Token]) {
        if (current_id[Class] == Loc) {
            current_id[BClass] = current_id[Class];
            current_id[BType] = current_id[Type];
            current_id[BValue] = current_id[Value];
        }
        current_id = current_id + IdSize;
    }
}
void function_declaration() {
    // type func_name (...) {...}
    //               | this part

    match('(');
    function_parameter();
    match(')');
    match('{');
    function_body();
    //match('}');

    // unwind local variable declarations for all local variables.
    current_id = symbols;
    while (current_id[Token]) {
        if (current_id[Class] == Loc) {
            current_id[Class] = current_id[BClass];
            current_id[Type]  = current_id[BType];
            current_id[Value] = current_id[BValue];
        }
        current_id = current_id + IdSize;
    }
}