local lpeg = require "lpeg" local identifier = lpeg.R"az" + lpeg.R"09" + lpeg.S"@+_" identifier = identifier * (identifier + lpeg.S".-")^0 local whitespace = lpeg.S" \t"^1 local rest = (1 - lpeg.S"\n")^0 local definition = lpeg.C(identifier) * whitespace * "=" * whitespace * lpeg.C(rest) * "\n" local subdefinition = whitespace * definition local emptylines = (whitespace * "\n")^1 local block = lpeg.Ct(lpeg.Ct(definition) * lpeg.Ct(subdefinition)^0) local thing = block * (emptylines * block)^0 local capture = lpeg.Ct(thing) local function srcinfo (handle) return capture:match(handle:read"a") end return srcinfo