我需要用符号浏览器做一个编辑器,我说我会玩 ctags。好吧,我阅读了 ctags 格式并尝试使用 Google 并在 SO 上搜索。我发现的只是关于 ctags 和 vim 的问题,而我在 vim 上为零。所以我决定自己一个人玩。所以我拿了一个标签文件,我完全糊涂了!
在这里,我放置了 PHP 文件及其相应的标签,我需要您的帮助,我如何知道该行代表类属性还是方法?另外我怎么知道 PHP 函数/方法的返回值?
除了 vi/vim 连接之外,我还没有找到任何关于在 ctags 中处理 PHP(或任何其他语言)标签的好教程!谢谢
PHP 文件
<?php
$teachers = array("standard one"=>"Celina Stephen", "Standard Two"=>"Emanyor Dickson");
function set_teachers($teacher_array){
$teachers = $teacher_array;
return $teacher_array;
}
class School{
$teachers;
$students;
public function __construct(){
}
public function get_all(){
return array($this->teachers,$this->students);
}
}
class ManySchools extends School{
public __construct(){
parent::construct();
}
private do_selection($teacher, $student=null){
return false;
}
}
标签文件
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
ManySchools test.php /^class ManySchools extends School{$/;" c
School test.php /^class School{$/;" c
__construct test.php /^ public function __construct(){$/;" f
get_all test.php /^ public function get_all(){$/;" f
set_teachers test.php /^function set_teachers($teacher_array){$/;" f
teachers test.php /^ $teachers = $teacher_array;$/;" v
teachers test.php /^$teachers = array("standard one"=>"Celina Stephen", "Standard Two"=>"Emanyor Dickson");$/;" v