From 9bbd1702850fa4f5ee0235181b9ffe40ec1f3133 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 24 Jun 2011 00:11:37 -0400 Subject: 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. --- scripts/gen_iface.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'scripts/gen_iface.lua') 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 mitchellcaladbolg.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() -- cgit v1.2.3