Skip to content

Commit 85c688d

Browse files
committed
Add support for tokens inside a 'try-catch' statement
1 parent a4af76a commit 85c688d

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

PHPCtags.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ private function struct($node, $reset=FALSE, $parent=array())
9797
//@todo
9898
} elseif ($node instanceof PHPParser_Node_Stmt_Declare) {
9999
//@todo
100+
} elseif ($node instanceof PHPParser_Node_Stmt_TryCatch) {
101+
foreach ($node as $subNode) {
102+
$this->struct($subNode);
103+
}
100104
} elseif ($node instanceof PHPParser_Node_Stmt_Function) {
101105
$kind = 'f';
102106
$name = $node->name;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
function e_0003_define()
3+
{
4+
return array(
5+
array(
6+
'name'=>'$ctags',
7+
'kind'=>'v',
8+
'line'=>'3',
9+
'scope'=>'',
10+
'access'=>'',
11+
),
12+
array(
13+
'name'=>'$result',
14+
'kind'=>'v',
15+
'line'=>'4',
16+
'scope'=>'',
17+
'access'=>'',
18+
),
19+
);
20+
}

tests/examples/0003.example.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
try {
3+
$ctags = new PHPCtags();
4+
$result = $ctags->export($file, $options);
5+
} catch (Exception $e) {
6+
die("phpctags: {$e->getMessage()}");
7+
}

tests/testcases/0003.testcase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
class t_0003 extends PHPCtagsTestCase {
3+
4+
public function __construct()
5+
{
6+
parent::__construct();
7+
$this->mExample = '0003';
8+
}
9+
10+
}

0 commit comments

Comments
 (0)