Esempio n. 1
0
function define_class($class)
{
    global $output, $net;
    $name = $class['name'];
    $desc = idx_string($class, 'desc');
    if ((empty($desc) || $net == 1) && $net != -1) {
        $desc = phpnet_get_class_desc($name);
    }
    $output .= "////////////////////////////////////////" . "///////////////////////////////////////\n\n";
    begin_function('BeginClass');
    begin_array();
    out_str('name', $name, true);
    out_str('parent', $class['parent']);
    out_fmt('ifaces', idx_array($class, 'ifaces'));
    out_fmt('bases', idx_array($class, 'bases'));
    out_str('desc', $desc);
    out_fmt('flags', idx_flags($class, 'flags', false));
    out_str('note', idx_string($class, 'note'));
    out_doc('footer', idx_string($class, 'footer'));
    end_array(false);
    end_function();
    define_constants($class['consts']);
    foreach ($class['methods'] as $func) {
        define_function($func, $name);
    }
    define_properties($class['properties']);
    begin_function('EndClass');
    end_function();
}
Esempio n. 2
0
 public function compose_program()
 {
     foreach ($this->action as $k => $body) {
         $this->action[$k] = define_function('$tokens', preg_replace('/{(\\d+)}/', '$tokens[\\1]', $body));
     }
     return array('start' => $this->symbol_start_states(), 'delta' => $this->dpda_transition_function(), 'action' => $this->action);
 }