- 引入OP_NOP常量用于处理标签后的空操作 - 修改语句解析循环以跟踪最后一条语句 - 在标签语句后添加空操作防止代码优化问题 - 添加jump02和jump03测试用例验证goto功能 - 创建mv.php脚本用于文件重命名和git添加操作pull/1/head
parent
82e13b62f1
commit
752767012f
4 changed files with 58 additions and 1 deletions
@ -0,0 +1,18 @@ |
||||
#!/usr/bin/env php |
||||
<?php |
||||
if ($argc < 2) { |
||||
echo "Usage: php mv.php <file>\n"; |
||||
exit(1); |
||||
} |
||||
$file = $argv[1]; |
||||
if (!file_exists($file)) { |
||||
echo "File not found: " . $file . "\n"; |
||||
exit(1); |
||||
} |
||||
$newFile = str_replace('-raw', '', $file); |
||||
$dir = dirname($newFile); |
||||
if (!is_dir($dir)) { |
||||
mkdir($dir, 0755, true); |
||||
} |
||||
rename($file, $newFile); |
||||
shell_exec('git add ' . $newFile); |
||||
@ -0,0 +1,16 @@ |
||||
--TEST-- |
||||
jump 02: goto forward |
||||
--FILE-- |
||||
<?php |
||||
$n = 1; |
||||
L1: |
||||
if ($n > 3) goto L2; |
||||
echo "$n: ok\n"; |
||||
$n++; |
||||
goto L1; |
||||
L2: |
||||
?> |
||||
--EXPECT-- |
||||
1: ok |
||||
2: ok |
||||
3: ok |
||||
@ -0,0 +1,18 @@ |
||||
--TEST-- |
||||
jump 03: goto inside control structures |
||||
--FILE-- |
||||
<?php |
||||
do { |
||||
if (1) { |
||||
echo "1: ok\n"; |
||||
goto L1; |
||||
} else { |
||||
echo "bug\n"; |
||||
L1: |
||||
echo "2: ok\n"; |
||||
} |
||||
} while (0); |
||||
?> |
||||
--EXPECT-- |
||||
1: ok |
||||
2: ok |
||||
Loading…
Reference in new issue