gpt4 book ai didi

c++ - 用 C++ 解析 Exuberant Ctags

转载 作者:行者123 更新时间:2023-11-30 03:05:14 25 4
gpt4 key购买 nike

我需要用 Symbol Browser 做一个编辑器,我说我会玩 ctags。好吧,我阅读了 ctags 格式并尝试使用 Google 并在此处搜索。我发现的只是关于 ctags 和 vim 的问题,而我对 vim 的了解为零。所以我决定自己一个人玩。所以我拿了一个标签文件,我完全糊涂了!

我在这里放置了 PHP 文件及其相应的标签,我需要你的帮助,我如何知道该行是否表示类属性或方法?另外,我如何知道 PHP 函数/方法的返回值?

除了 vi/vim connected 之外,我还没有找到任何关于在 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

最佳答案

;" 之后的第一项在每一行中描述了标签的 kind ,即它是否是一个类,函数等。在你的例子中 c 代表类,f 代表函数等。您可以通过 ctags --list-kinds=php 获取完整列表。

返回类型(不幸的是)不被 ctags 报告。

你绝对应该看看 ctags 联机帮助页,那里的一切都解释得很好,例如,除了默认报告的信息之外,它还可以报告哪些其他信息。

关于c++ - 用 C++ 解析 Exuberant Ctags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7900329/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com