it can be partially implemented using Universal Ctags and using the flags {_multiline=N}
and {scope}
. N
is the number of the group whose position is stored in the generated tags
file. For more information, see here: docs / optlib.rst
Configuration: mylang.ctags
--langmap=mylang:.txt --regex-mylang=/^[[:blank:]]*(int)[[:blank:]]/\1/{placeholder}{scope=set}{_multiline=1} --regex-mylang=/(;)/\1/{placeholder}{scope=clear} --regex-mylang=/[[:blank:]]*([[:alnum:]]+)[[:blank:]]*,?/\1/v,variable/{_multiline=1}{scope=ref}
Test file: test.txt
void main() { int a, b, c, d; }
Create tags with: ctags --options=mylang.ctags test.txt
Generated tags
file:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ !_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ !_TAG_PROGRAM_AUTHOR Universal Ctags Team // !_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ !_TAG_PROGRAM_URL https://ctags.io/ /official site/ !_TAG_PROGRAM_VERSION 0.0.0 /cb4476eb/ a test.txt /^ int a, b, c, d;$/;" v b test.txt /^ int a, b, c, d;$/;" v c test.txt /^ int a, b, c, d;$/;" v d test.txt /^ int a, b, c, d;$/;" v int test.txt /^ int a, b, c, d;$/;" v main test.txt /^void main() {$/;" v void test.txt /^void main() {$/;" v
source share