{"action":"created","issue":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/569","labels_url":"https://api.github.com/repos/universal-ctags/ctags/issues/569/labels{/name}","comments_url":"https://api.github.com/repos/universal-ctags/ctags/issues/569/comments","events_url":"https://api.github.com/repos/universal-ctags/ctags/issues/569/events","html_url":"https://github.com/universal-ctags/ctags/pull/569","id":107754820,"number":569,"title":"Adding reference tag function","user":{"login":"shigio","id":14746762,"avatar_url":"https://avatars.githubusercontent.com/u/14746762?v=3","gravatar_id":"","url":"https://api.github.com/users/shigio","html_url":"https://github.com/shigio","followers_url":"https://api.github.com/users/shigio/followers","following_url":"https://api.github.com/users/shigio/following{/other_user}","gists_url":"https://api.github.com/users/shigio/gists{/gist_id}","starred_url":"https://api.github.com/users/shigio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shigio/subscriptions","organizations_url":"https://api.github.com/users/shigio/orgs","repos_url":"https://api.github.com/users/shigio/repos","events_url":"https://api.github.com/users/shigio/events{/privacy}","received_events_url":"https://api.github.com/users/shigio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/universal-ctags/ctags/labels/Main%20part","name":"Main part","color":"fbca04"},{"url":"https://api.github.com/repos/universal-ctags/ctags/labels/tags%20file%20format","name":"tags file format","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"masatake","id":77077,"avatar_url":"https://avatars.githubusercontent.com/u/77077?v=3","gravatar_id":"","url":"https://api.github.com/users/masatake","html_url":"https://github.com/masatake","followers_url":"https://api.github.com/users/masatake/followers","following_url":"https://api.github.com/users/masatake/following{/other_user}","gists_url":"https://api.github.com/users/masatake/gists{/gist_id}","starred_url":"https://api.github.com/users/masatake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masatake/subscriptions","organizations_url":"https://api.github.com/users/masatake/orgs","repos_url":"https://api.github.com/users/masatake/repos","events_url":"https://api.github.com/users/masatake/events{/privacy}","received_events_url":"https://api.github.com/users/masatake/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/universal-ctags/ctags/milestones/1","html_url":"https://github.com/universal-ctags/ctags/milestones/Feature%20plan","labels_url":"https://api.github.com/repos/universal-ctags/ctags/milestones/1/labels","id":750596,"number":1,"title":"Feature plan","description":"These are just ideas.","creator":{"login":"masatake","id":77077,"avatar_url":"https://avatars.githubusercontent.com/u/77077?v=3","gravatar_id":"","url":"https://api.github.com/users/masatake","html_url":"https://github.com/masatake","followers_url":"https://api.github.com/users/masatake/followers","following_url":"https://api.github.com/users/masatake/following{/other_user}","gists_url":"https://api.github.com/users/masatake/gists{/gist_id}","starred_url":"https://api.github.com/users/masatake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masatake/subscriptions","organizations_url":"https://api.github.com/users/masatake/orgs","repos_url":"https://api.github.com/users/masatake/repos","events_url":"https://api.github.com/users/masatake/events{/privacy}","received_events_url":"https://api.github.com/users/masatake/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":2,"state":"open","created_at":"2014-08-12T04:37:22Z","updated_at":"2015-10-21T09:23:03Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-09-22T16:49:09Z","updated_at":"2015-10-22T15:10:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/universal-ctags/ctags/pulls/569","html_url":"https://github.com/universal-ctags/ctags/pull/569","diff_url":"https://github.com/universal-ctags/ctags/pull/569.diff","patch_url":"https://github.com/universal-ctags/ctags/pull/569.patch"},"body":"Hello,\r\nThis pull request is to add a new ability which generates reference tags.\r\nNow, it works in combination with GNU GLOBAL(*1).\r\n\r\n> *1: GNU GLOBAL (http://www.gnu.org/software/global/) is a source code\r\n>    tagging system. It also works as a tagging framework which offers\r\n>    various functions like follows:\r\n>\t* Project base concept\r\n>\t* High performance & machine architecture independent\r\n>\t* Incremental updating of tag files\r\n>\t* Tag search and path search using regular expression\r\n>\t* ... (please see http://www.gnu.org/software/global/)\r\n\r\nBy this modification, we become to be able to write a parser which treats\r\nreference tags with a little burden. The parser is applicable in both of\r\nctags (definitions) and GNU GLOBAL (definitions and references).\r\n\r\n# What is included?\r\n\r\nThe modification includes the following.\r\n\r\n* makeSimpleReferenceTag() function\r\n  This function makes a reference tag. Now ctags prints it only when\r\n  the -x option and --gtags option (explained later) are specified.\r\n  Basically, you may use the function for all symbols except for\r\n  definitions.\r\n \r\n* Modified scheme parser (parsers/scheme.c)\r\n  This is an example parser to show the usage of makeSimpleReferenceTag()\r\n  function.\r\n\r\n* --gtags option and test\r\n  If this option is specified with the -x option, ctags also prints\r\n  reference tags as well as definition tags with a type string at the\r\n  head of each output. The type string is one of the following:\r\n\r\n\tD\tdefinition\r\n\tR\treference\r\n\r\n  GNU GLOBAL understand this format since global-6.2.6.\r\n\r\nSince modified ctags is upper compatible, if you don't use the\r\n--gtags option, its output is same as the original.\r\n\r\n# How to write a parser using makeSimpleReferenceTag()?\r\n\r\nHere is an example in parsers/scheme.c.\r\nYou can use makeSimpleReferenceTag() instead of makeSimpleTag()\r\nfor reference tags.\r\n\r\n[Tmain/gtags-option.d/input.scm]\r\n<pre>\r\n1\t(define name \"name1\")\t\t; makeSimpleTag(\"name\", ...)\r\n2\t(set! name \"name2\")\t\t; makeSimpleReferenceTag(\"name\", ...)     <= added\r\n3\t(set! unknown \"name3\")\t\t; makeSimpleReferenceTag(\"unknown\", ...)  <= added\r\n</pre>\r\n\r\n(Build of ctags)\r\nYou need to use --enable-gtags option for the configure script.\r\n<pre>\r\n$ ./configure --enable-gtags\r\n$ make\r\n$ sudo make install\r\n</pre>\r\n\r\nWithout --gtags, it's same as the original.\r\n<pre>\r\n$ ctags -x --format=1 input.scm\r\nname                1 input.scm        (define name \"name1\")\r\n</pre>\r\n\r\nWith --gtags - also print references tags with a type string\r\nfor each output.\r\n<pre>\r\n$ ctags -x --format=1 --gtags input.scm\r\nD name                1 input.scm        (define name \"name1\")\r\nR name                2 input.scm        (set! name \"name2\")\r\nR unknown             3 input.scm        (set! unknown \"name3\")\r\n</pre>\r\n\r\n# How does it work via GNU GLOBAL?\r\n\r\n(Build of GNU GLOBAL)\r\nYou may use --with-exuberant-ctags option for the configure script.\r\nIt's usually recognized automatically though.\r\n<pre>\r\n$ ./configure --with-exuberant-ctags=/usr/local/bin/ctags\r\n$ make \r\n$ sudo make install\r\n</pre>\r\n\r\nPreparations to use ctags as a plug-in parser of GLOBAL.\r\n<pre>\r\n$ export GTAGSCONF=/usr/local/share/gtags/gtags.conf\r\n$ export GTAGSLABEL=ctags\r\n</pre>\r\n\r\nMake tag files - gtags invokes ctags internally\r\n<pre>\r\n$ gtags\r\n</pre>\r\n\r\nPrint all definitions ('.*' is a regular expression which means ALL.)\r\n<pre>\r\n$ global -x '.*' -d\r\nname                1 input.scm        (define name \"name1\")\r\n</pre>\r\n\r\nPrint all references to defined symbols\r\n<pre>\r\n$ global -x '.*' -r\r\nname                2 input.scm        (set! name \"name2\")\r\n</pre>\r\n\r\nPrint all references to undefined symbols\r\n<pre>\r\n$ global -x '.*' -s\r\nunknown             3 input.scm        (set! unknown \"name3\")\r\n</pre>\r\n-----\r\nI believe this pull request adds new possibility to ctags, and is harmless.\r\nI also believe it brings profit to both of ctags users and GLOBAL users.\r\n\r\nBest Regards,\r\nShigio"},"comment":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/comments/150256774","html_url":"https://github.com/universal-ctags/ctags/pull/569#issuecomment-150256774","issue_url":"https://api.github.com/repos/universal-ctags/ctags/issues/569","id":150256774,"user":{"login":"masatake","id":77077,"avatar_url":"https://avatars.githubusercontent.com/u/77077?v=3","gravatar_id":"","url":"https://api.github.com/users/masatake","html_url":"https://github.com/masatake","followers_url":"https://api.github.com/users/masatake/followers","following_url":"https://api.github.com/users/masatake/following{/other_user}","gists_url":"https://api.github.com/users/masatake/gists{/gist_id}","starred_url":"https://api.github.com/users/masatake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masatake/subscriptions","organizations_url":"https://api.github.com/users/masatake/orgs","repos_url":"https://api.github.com/users/masatake/repos","events_url":"https://api.github.com/users/masatake/events{/privacy}","received_events_url":"https://api.github.com/users/masatake/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T15:10:20Z","updated_at":"2015-10-22T15:10:20Z","body":"@vhda, thank you. I read #80 again. I think we can do something without memory database.\r\nHere we assume tags file format is stable enough(We are working for it now:-P).\r\nIn the first pass ctags creates 1st.tags.\r\nAssume ctags cat take hints with arguments like ``--add-hint-lang:ObjectiveC-kind:class=NSObject``.\r\nConsider a command which can generate hints options from a given tags file like:\r\n ```\r\n   $ make-hints ./1st.tags > hints.ctags\r\n```\r\nNow you can ctags as `the second pass ` tags generator like:\r\n```\r\n  $ ctags --options=hints.ctags input-dir\r\n```\r\n\r\nDo I make sense?\r\n\r\nOf course it is cool if we can remove these manual steps. However, these manual steps are helpful for use to develop ctags. Other tools than ctags can generate hits.\r\n\r\nDo I make sense? Or Do I misunderstand your idea?\r\n\r\n"}}