Nmap Development mailing list archives
Re: Completed Lua 5.3 upgrade!
From: Patrick Donnelly <batrick () batbytes com>
Date: Thu, 7 Jul 2016 18:49:30 -0400
On Thu, Jul 7, 2016 at 6:26 PM, Daniel Miller <bonsaiviking () gmail com> wrote:
Patrick, These changes temporarily broke nsedoc generation. The specific issue I'm running into is detection of a file's "module" status, which we previously did with this chunk of Lua 5.1 code: -- module"x.y" -- module'x.y' local _, m1 = string.match(line, "^%s*module%s*([\"'])(.-[^\\])%1"); -- module[[x.y]] local _, m2 = string.match(line, "^%s*module%s*%[(=*)%[(.-)%]%1%]"); -- module([... or ]"x.y") -- module([... or ]'x.y') local _, m3 = string.match(line, "^%s*module%s*%(.-([\"'])(.-[^\\])%1"); -- module([... or ][[x.y]]) local _, m4 = string.match(line, "^%s*module%s*%(.-%[(=*)%[(.-)%]%1%]"); -- module(...) local _, m5 = string.match(line, "^%s*module%s*%(%s*%.%.%.%s*[,%)]"); -- _ENV = stdnse.module("name" local _, m6 = string.match(line, "^%s*_ENV%s*=%s*stdnse%s*%.%s*module%s*%(?%s*([\"'])(.-[^\\])%1"); -- _ENV = require "stdnse".module "base32" local _, _, m7 = string.match(line, "^%s*_ENV%s*=%s*require%s*([\"'])stdnse%1%s*%.%s*module%s*%(?%s*([\"'])(.-[^\\])%2"); local modulename = m1 or m2 or m3 or m4 or m5 or m6 or m7; I actually added that last one (m7) because of the syntax you used in base32.lua. But so far it appears the libraries bin, bit, and bits all do not use stdnse.module. I found a workaround by using the "@class module" and "@name" NSEdoc tags, but I wanted to know more about stdnse.module and stdnse.seeall. These are documented as "mimicking" the behavior of Lua 5.1, but are we using any of this behavior? Could all libs be converted to just returning _ENV and using @class and @name tags?
I believe I added stdnse.module to reduce the number of changes to libraries in the Lua 5.2 upgrade. I don't recall exactly why. Ideally, the NSEDoc tags are preferred but they're easy to forget (as I did). -- Patrick Donnelly _______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 02)
- Re: Completed Lua 5.3 upgrade! Tom Sellers (Jul 07)
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 07)
- Re: Completed Lua 5.3 upgrade! Paulino Calderon (Jul 15)
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 16)
- Re: Completed Lua 5.3 upgrade! Daniel Miller (Jul 16)
- Re: Completed Lua 5.3 upgrade! Paulino Calderon (Jul 17)
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 17)
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 07)
- Re: Completed Lua 5.3 upgrade! Tom Sellers (Jul 07)
- Re: Completed Lua 5.3 upgrade! Patrick Donnelly (Jul 07)
- <Possible follow-ups>
- Re: Completed Lua 5.3 upgrade! jah (Aug 11)