aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/gen_iface.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2011-06-22 22:11:01 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2011-06-22 22:11:01 -0400
commit9c339f6fcc8eb5f4f5f9b29b664f0859b9858ec6 (patch)
treeb4f7fd1d98fb218a41fad698ad5175da6a474fdf /scripts/gen_iface.lua
parent09e50d3ca36591632e0b4e35deaecd548678b6f4 (diff)
Add @field parameters to _SCINTILLA.constants; scripts/gen_iface.lua
Diffstat (limited to 'scripts/gen_iface.lua')
-rwxr-xr-xscripts/gen_iface.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/gen_iface.lua b/scripts/gen_iface.lua
index 6996ff2e..4c2aeff7 100755
--- a/scripts/gen_iface.lua
+++ b/scripts/gen_iface.lua
@@ -8,7 +8,7 @@ local iface = f:read('*all')
f:close()
local string_format = string.format
-local constants, functions, properties = {}, {}, {}
+local constants, fielddoc, functions, properties = {}, {}, {}, {}
local types = {
void = 0, int = 1, length = 2, position = 3, colour = 4, bool = 5,
keymod = 6, string = 7, stringresult = 8, cells = 9, textrange = 10,
@@ -24,7 +24,7 @@ f:write [[
---
-- Scintilla constants, functions, and properties.
-- Do not modify anything in this module. Doing so will result in instability.
-module('_SCINTILLA', package.seeall)
+module('_SCINTILLA')
]]
@@ -35,6 +35,7 @@ for item in iface:match('Constants%[%] = (%b{})'):sub(2, -2):gmatch('%b{}') do
not name:find('^SCLEX_') then
if name == 'SC_MASK_FOLDERS' then value = '-33554432' end
constants[#constants + 1] = string_format('%s=%s', name, value)
+ fielddoc[#fielddoc + 1] = string_format('-- @field %s %d', name, value)
end
end
@@ -70,6 +71,7 @@ local events = {
}
for event, value in pairs(events) do
constants[#constants + 1] = string_format('%s=%d', event, value)
+ fielddoc[#fielddoc + 1] = string_format('-- @field %s %d', event, value)
end
-- Lexers added to constants.
local lexers = {
@@ -80,6 +82,7 @@ local lexers = {
}
for lexer, value in pairs(lexers) do
constants[#constants + 1] = string_format('%s=%d', lexer, value)
+ fielddoc[#fielddoc + 1] = string_format('-- @field %s %d', lexer, value)
end
-- Write constants.
@@ -88,7 +91,9 @@ f:write [[
-- Scintilla constants.
-- @class table
-- @name constants
-constants = {]]
+]]
+f:write(table.concat(fielddoc, '\n'))
+f:write('\nconstants = {')
f:write(table.concat(constants, ','))
f:write('}\n\n')