diff options
author | Aki <please@ignore.pl> | 2024-02-15 01:40:42 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-02-15 01:40:42 +0100 |
commit | add28ed158e7f6992ad94b946e96ca44c36fbe2d (patch) | |
tree | d3a8ae6292011506d25d65c56a91576da31eed68 /srcinfo.lua | |
parent | edf34ef94eb35988833e21bd0a0287405d509434 (diff) | |
download | lua-srcinfo-add28ed158e7f6992ad94b946e96ca44c36fbe2d.zip lua-srcinfo-add28ed158e7f6992ad94b946e96ca44c36fbe2d.tar.gz lua-srcinfo-add28ed158e7f6992ad94b946e96ca44c36fbe2d.tar.bz2 |
Comments may now be preceded by whitespace and not followed by one
Diffstat (limited to 'srcinfo.lua')
-rw-r--r-- | srcinfo.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/srcinfo.lua b/srcinfo.lua index 40ae7d1..ef40cd9 100644 --- a/srcinfo.lua +++ b/srcinfo.lua @@ -22,7 +22,7 @@ local whitespace = lpeg.S" \t"^0 local newline = lpeg.P"\r\n" + "\n" local rest = (1 - newline)^0 local definition = lpeg.Cc"definition" * whitespace * lpeg.C(identifier) * whitespace * "=" * whitespace * lpeg.C(rest) -local comment = lpeg.Cc"comment" * lpeg.P"#" * whitespace * lpeg.C(rest) +local comment = lpeg.Cc"comment" * whitespace * lpeg.P"#" * lpeg.C(rest) local empty = lpeg.Cc"empty" * whitespace local invalid = lpeg.Cc"invalid" * lpeg.C(rest) local line = lpeg.Carg(1) * (definition + comment + empty + invalid) / apply * newline @@ -32,12 +32,11 @@ local capture = lpeg.Ct(line^0) * -lpeg.P(1) local function srcinfo (text, options) options = options or {} - mode = modes[options.mode] or PKGNAME return capture:match( text, nil, { - mode = mode, + mode = modes[options.mode] or PKGNAME, base = nil, current = nil, definition = function (self, name, value) |