Exemple #1
0
 function code_lines(&$bc, $term = JS_END)
 {
     global $type, $val, $next, $nextval;
     $term = (array) $term;
     jsc::getnext();
     while ($type && !in_array($type, $term)) {
         #echo("code_lines debug: [$type,$val,$next]<br/>");
         switch ($type) {
             case JS_CURLYBR1:
                 $bc[] = array();
                 jsc::block($bc[count($bc) - 1]);
                 break;
             case JS_CURLYBR0:
                 return;
             case JS_BREAK:
                 jsc::constr_break($bc);
                 break;
             case JS_RETURN:
                 jsc::constr_return($bc);
                 break;
             case JS_FOR:
                 jsc::constr_for($bc);
                 break;
             case JS_IF:
                 jsc::constr_if($bc);
                 break;
             case JS_WHILE:
                 jsc::constr_while($bc);
                 break;
             case JS_DO:
                 jsc::constr_do($bc);
                 break;
             case JS_SWITCH:
                 jsc::constr_switch($bc);
                 $type = 900;
                 // go on
                 break;
             case JS_PRINT:
                 jsc::constr_rt($bc);
                 break;
             case JS_VAR_STATEMENT:
                 jsc::constr_var($bc);
                 break;
             case JS_FUNCDEF:
                 jsc::constr_func($bc);
                 break;
             case JS_END:
                 break;
             case JS_EOF:
                 break;
             default:
                 $bc[] = jsc::expr_start();
         }
         #-- end of line
         while ($next == JS_END) {
             jsc::get();
         }
         if ($type == JS_CURLYBR0) {
             jsc::getnext();
             //            echo "going home...";
             return;
         }
         jsc::getnext();
     }
 }