-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# | ||
# cmake.ctags --- multitable regex parser for CMake's files | ||
# | ||
# Copyright (c) 2018, 128 Technology, Inc. | ||
# | ||
# Author: Hadriel Kaplan (hadrielk@yahoo.com) | ||
# | ||
# This source code is released for free distribution under the terms of the | ||
# GNU General Public License version 2 or (at your option) any later version. | ||
# | ||
# | ||
# Overview: | ||
# | ||
# This universal-ctags optlib option file defines the parser for tagging | ||
# CMake files. It supports tagging the following: | ||
# | ||
# - cmake function and macro names | ||
# - build target, executable, and library target names | ||
# - cmake variables and options | ||
# - cmake project names | ||
# | ||
# Caveats: | ||
# | ||
# Names that are ${} references to variables are not tagged. | ||
# | ||
# For example, given the following: | ||
# | ||
# set(PROJECT_NAME_STR ${PROJECT_NAME}) | ||
# add_executable( ${PROJECT_NAME_STR} ... ) | ||
# add_custom_target( ${PROJECT_NAME_STR}_tests ... ) | ||
# add_library( sharedlib ... ) | ||
# | ||
# the variable 'PROJECT_NAME_STR' and target 'sharedlib' will both be tagged, | ||
# but the other targets will not be. | ||
# | ||
# | ||
# References: | ||
# | ||
# - https://cmake.org/cmake/help/latest/manual/cmake-language.7.html | ||
# | ||
|
||
--langdef=CMake | ||
--map-CMake=+.cmake | ||
--map-CMake=+(CMakeLists.txt) | ||
|
||
# | ||
# Kinds | ||
# | ||
--kinddef-CMake=f,function,functions | ||
--kinddef-CMake=m,macro,macros | ||
--kinddef-CMake=t,target,targets | ||
--kinddef-CMake=v,variable,variable definitions | ||
--kinddef-CMake=D,option,options specified with -D | ||
--kinddef-CMake=p,project,projects | ||
|
||
# | ||
# Tables | ||
# | ||
--_tabledef-CMake=main | ||
--_tabledef-CMake=variable | ||
--_tabledef-CMake=function | ||
--_tabledef-CMake=macro | ||
--_tabledef-CMake=target | ||
--_tabledef-CMake=option | ||
--_tabledef-CMake=project | ||
|
||
# | ||
# comment | ||
# | ||
--_tabledef-CMake=commentBegin | ||
--_tabledef-CMake=commentMultiline | ||
|
||
--_mtable-regex-CMake=commentBegin/\[\[//{tjump=commentMultiline} | ||
--_mtable-regex-CMake=commentBegin/[^\n]*[ \t\n]*//{tleave} | ||
|
||
--_mtable-regex-CMake=commentMultiline/\]\][ \t\n]*//{tleave} | ||
--_mtable-regex-CMake=commentMultiline/.[^]]*// | ||
|
||
--_tabledef-CMake=skipComment | ||
--_mtable-regex-CMake=skipComment/#//{tenter=commentBegin} | ||
|
||
# | ||
# Utilities | ||
# | ||
--_tabledef-CMake=skipWhiteSpace | ||
--_tabledef-CMake=skipToName | ||
--_tabledef-CMake=nextToken | ||
|
||
--_mtable-regex-CMake=skipWhiteSpace/[ \t\n]+// | ||
|
||
--_mtable-extend-CMake=skipToName+skipWhiteSpace | ||
--_mtable-extend-CMake=skipToName+skipComment | ||
|
||
--_mtable-regex-CMake=nextToken/[^ \t\n]+[ \t\n]*// | ||
|
||
# | ||
# main | ||
# | ||
# This first regex entry may seem odd - it's purely for improving performance, by | ||
# matching tokens with leading characters that could not possibly match a later regex, | ||
# and just skipping the whole token (and trailing whitespace). This one regex line | ||
# improved performance by an order of magnitude. | ||
--_mtable-regex-CMake=main/[^sSfFmMaAoOpP# \t\n][^ #\t\n]*[ \t\n]+// | ||
--_mtable-extend-CMake=main+skipComment | ||
--_mtable-regex-CMake=main/set[ \t]*\(//{icase}{tenter=variable} | ||
--_mtable-regex-CMake=main/function[ \t]*\(//{icase}{tenter=function} | ||
--_mtable-regex-CMake=main/macro[ \t]*\(//{icase}{tenter=macro} | ||
--_mtable-regex-CMake=main/add_(custom_target|executable|library)[ \t]*\(//{icase}{tenter=target} | ||
--_mtable-regex-CMake=main/option[ \t]*\(//{icase}{tenter=option} | ||
--_mtable-regex-CMake=main/project[ \t]*\(//{icase}{tenter=project} | ||
--_mtable-extend-CMake=main+nextToken | ||
--_mtable-extend-CMake=main+skipWhiteSpace | ||
|
||
|
||
# | ||
# Each of the following basically work the same way, and only differ in the | ||
# exact pattern allowed to be their name, and the Kind they add. Note that they | ||
# capture a required trailing '[# \t\n\)]', to verify the full name token matched | ||
# the name's pattern, but then we advanceTo=2start for the next round, so that | ||
# we don't go past a potential '#' comment token but instead match it again in | ||
# the main table as a comment (or whitespace if it was whitespace). | ||
# | ||
|
||
# | ||
# variable | ||
# | ||
--_mtable-regex-CMake=variable/([A-Za-z0-9_.-]+)([# \t\n\)])/\1/v/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=variable+skipToName | ||
|
||
# | ||
# function | ||
# | ||
--_mtable-regex-CMake=function/([A-Za-z_][A-Za-z0-9_]*)([# \t\n\)])/\1/f/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=function+skipToName | ||
|
||
# | ||
# macro | ||
# | ||
--_mtable-regex-CMake=macro/([A-Za-z_][A-Za-z0-9_]*)([# \t\n\)])/\1/m/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=macro+skipToName | ||
|
||
# | ||
# target | ||
# | ||
--_mtable-regex-CMake=target/([A-Za-z0-9_.-]+)([# \t\n\)])/\1/t/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=target+skipToName | ||
|
||
# | ||
# option | ||
# | ||
--_mtable-regex-CMake=option/([A-Za-z0-9_.-]+)([# \t\n\)])/\1/D/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=option+skipToName | ||
|
||
# | ||
# project | ||
# | ||
--_mtable-regex-CMake=project/([A-Za-z0-9_.-]+)([# \t\n\)])/\1/p/{tleave}{advanceTo=2start} | ||
--_mtable-extend-CMake=project+skipToName |