aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-10-22 13:37:01 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-10-22 13:37:01 -0400
commit5caed0d5331c823ad74d2c443b9e0f8702349520 (patch)
tree02ec1a16f9db70de9338e6c84f12028d4a3ef0a3 /scripts
parentf52c1a0d5caa98e38bbf59dc8056ffd1a1b7a0da (diff)
Added tags for the Lua C API to the ansi_c module.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_lua_c_api_tags.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/gen_lua_c_api_tags.lua b/scripts/gen_lua_c_api_tags.lua
new file mode 100755
index 00000000..0bd56e13
--- /dev/null
+++ b/scripts/gen_lua_c_api_tags.lua
@@ -0,0 +1,19 @@
+#!/usr/bin/lua
+-- Copyright 2007-2015 Mitchell mitchell.att.foicica.com. See LICENSE.
+
+local f = io.open('../modules/ansi_c/lua_tags', 'w')
+-- Lua header files define API functions in a way ctags cannot detect.
+-- For example: `LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);`.
+-- The function name enclosed in parenthesis is causing the problem. A regex
+-- must be used to capture those definitions.
+local p = io.popen('ctags -o - --regex-c++="/\\(([a-zA-Z_]+)\\) +\\(/\\1/f/" '..
+ '../src/lua/src/lua.h ../src/lua/src/lauxlib.h')
+for line in p:read('*a'):gmatch('[^\n]+') do
+ -- Strip comment lines and replace file and ex_cmd fields with empty info.
+ if not line:find('^!') then
+ local tag, _, _, ext_fields = line:match('^(%S+)\t(%S+)\t(.-);"\t?(.*)$')
+ f:write(tag, '\t_\t0;"\t', ext_fields, '\n')
+ end
+end
+p:close()
+f:close()