예제 #1
0
파일: good.php 프로젝트: mohc/vdd
    // Blank line after the case statement is allowed.
    case 3:
        $i;
        break;
    default:
        $i;
}
// Empty case statements are allowed.
switch ($code) {
    case 200:
    case 304:
        break;
    case 301:
    case 302:
    case 307:
        call_function();
        break;
    default:
        $result->error = $status_message;
}
/**
 * Allowed switch() statement in a function without breaks.
 */
function foo()
{
    switch ($x) {
        case 1:
            return 5;
        case 2:
            return 6;
    }
예제 #2
0
function blockToCode($block)
{
    if ($block == NULL) {
        return '';
    }
    if ($block->nodeName != 'block') {
        echo "xml Wrong";
        echo $block->nodeName;
        return '';
    }
    $type = $block->getAttribute('type');
    switch ($type) {
        case 'controls_if':
            return controls_if($block);
            break;
        case 'logic_boolean':
            return logic_bool($block);
            break;
        case 'logic_compare':
            return logic_compare($block);
            break;
        case 'logic_operation':
            return logic_operation($block);
            break;
        case 'logic_negate':
            return logic_negate($block);
            break;
        case 'logic_ternary':
            return logic_ternary($block);
            break;
        case 'logic_null':
            return logic_null($block);
            break;
        case 'controls_whileUntil':
            return controls_whileUntil($block);
            break;
        case 'controls_flow_statements':
            return controls_flow_statements($block);
            break;
        case 'io_buzzer':
            return buzzer_msec($block);
            break;
        case 'text':
            return textvalue($block);
            break;
        case 'text_print':
            return prints($block);
            break;
        case 'math_number':
            return math_number($block);
            break;
        case 'motion':
            return motion($block);
            break;
        case 'turn':
            return turn($block);
            break;
        case 'soft_turn':
            return soft_turn($block);
            break;
        case 'back_turn':
            return back_turn($block);
            break;
        case 'position_motion':
            return position_motion($block);
            break;
        case 'position_turn':
            return position_turn($block);
            break;
        case 'position_turn_soft':
            return position_turn_soft($block);
            break;
        case 'position_turn_back':
            return position_turn_back($block);
            break;
        case 'sensor_white':
            return sensor_white($block);
            break;
        case 'sensor_sharp':
            return sensor_sharp($block);
            break;
        case 'sensor_ir':
            return sensor_ir($block);
            break;
        case 'buzzer_on':
            return buzzer_on($block);
            break;
        case 'buzzer_off':
            return buzzer_off($block);
            break;
        case 'delay_ms':
            return delay_ms($block);
            break;
        case 'math_arithmetic':
            return math_arithmetic($block);
            break;
        case 'math_single':
            return math_single($block);
            break;
        case 'math_trig':
            return math_trig($block);
            break;
        case 'math_modulo':
            return math_modulo($block);
            break;
        case 'register':
            return register($block);
            break;
        case 'pin':
            return pin($block);
            break;
        case 'set_item':
            return set_item($block);
            break;
        case 'call_function':
            return call_function($block);
            break;
        case 'call_function_with_return':
            return call_function_with_return($block);
            break;
        case 'function_defreturn':
            return function_defreturn($block);
            break;
        case 'function_defnoreturn':
            return function_defnoreturn($block);
            break;
        case 'procedures_callnoreturn':
            return procedures_callnoreturn($block);
            break;
        case 'procedures_callreturn':
            return procedures_callreturn($block);
            break;
        case 'hex':
            return hex($block);
            break;
        case 'return':
            return returnr($block);
            break;
        case 'variable_get':
            return variable_get($block);
            break;
        case 'incl_ude':
            return incl_ude($block);
            break;
        case 'define':
            return def_ine($block);
            break;
        default:
            echo "not defined in blockToCode " . $block->getAttribute('type');
    }
}