diff options
author | 2011-06-24 00:11:37 -0400 | |
---|---|---|
committer | 2011-06-24 00:11:37 -0400 | |
commit | 9bbd1702850fa4f5ee0235181b9ffe40ec1f3133 (patch) | |
tree | 0b66bf8cf572818b1f506d3a5e67a3a4bf032db2 /scripts/gen_iface.lua | |
parent | a591de5df7c1f264f4642ecba9c86a24620f5a46 (diff) | |
download | textadept-9bbd1702850fa4f5ee0235181b9ffe40ec1f3133.tar.gz textadept-9bbd1702850fa4f5ee0235181b9ffe40ec1f3133.zip |
Add ability to fake modules for generating Adeptsense.
With the new absolute field recognition, it is possible have a non-existant
module name in scripts/adeptsensedoc.lua's add_field() function. For example,
A '_G._SCINTILLA.constants.SCLEX_LPEG' field would look-up the
'_SCINTILLA.constants' module which does not exist; it is a table. Instead of
throwing an error, create a fake module so the appropriate tags and apidoc
are created ('SCLEX_LPEG _ 0;" F class:_SCINTILLA.constants') but do not create
tags and apidoc for the fake module.
Diffstat (limited to 'scripts/gen_iface.lua')
-rwxr-xr-x | scripts/gen_iface.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/gen_iface.lua b/scripts/gen_iface.lua index 4c2aeff7..311f3a92 100755 --- a/scripts/gen_iface.lua +++ b/scripts/gen_iface.lua @@ -14,6 +14,7 @@ local types = { keymod = 6, string = 7, stringresult = 8, cells = 9, textrange = 10, findtext = 11, formatrange = 12 } +local s = '_G._SCINTILLA.constants' f = io.open('../core/iface.lua', 'w') @@ -35,7 +36,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) + fielddoc[#fielddoc + 1] = string_format('-- * `%s.%s`: %d', s, name, value) end end @@ -71,7 +72,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) + fielddoc[#fielddoc + 1] = string_format('-- * `%s.%s`: %d', s, event, value) end -- Lexers added to constants. local lexers = { @@ -82,7 +83,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) + fielddoc[#fielddoc + 1] = string_format('-- * `%s.%s`: %d', s, lexer, value) end -- Write constants. @@ -91,9 +92,7 @@ f:write [[ -- Scintilla constants. -- @class table -- @name constants -]] -f:write(table.concat(fielddoc, '\n')) -f:write('\nconstants = {') +constants = {]] f:write(table.concat(constants, ',')) f:write('}\n\n') @@ -179,3 +178,14 @@ end ]] f:close() + +f = io.open('../core/._SCINTILLA.luadoc', 'w') +f:write [[ +-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE. +-- This is a DUMMY FILE used for making Adeptsense for built-in constants in the +-- global _SCINTILLA.constants table. + +]] +f:write(table.concat(fielddoc, '\n')) +f:write('\n') +f:close() |