return (functionlocal builders = local function register(name, f) builders[name] = fendregister('llpeg', function return require end)
register('advent.compat', function return require end)
register('llpeg.lpegrex', function(myrequire)--
-- LPegRex depends on LPegLabel.local lpeg = myrequire('llpeg')local compat = myrequire('advent.compat') -- lua 5.1 compatibilitylocal andP = compat.len -- &p for patterns
-- Increase LPEG max stack, because the default is too low to use with complex grammars.lpeg.setmaxstack(1024)
-- The LPegRex module table.local lpegrex =
-- Cache tables for `match`, `find` and `gsub`.local mcache, fcache, gcache
-- Global LPegRex options.local defrexoptions = local rexoptions
-- LPeGRex syntax errors.local ErrorInfo = '", -- for the captures MisClose6 = "missing closing '>'", MisClose7 = "missing closing '}'", -- for the labels MisClose8 = "missing closing ']'",
MisTerm1 = "missing terminating single quote", MisTerm2 = "missing terminating double quote", MisTerm3 = "missing terminating backtick quote",}
-- Localize some functions used in compiled PEGs.local char = string.charlocal utf8char = compat.utf8charlocal select, tonumber = select, tonumberlocal insert = table.insert
-- Pattern matching any character.local Any = lpeg.P(1)
-- Predefined patterns.local Predef =
-- Fold tables to the left (use only with `~>`).-- Example: -> function Predef.foldleft(lhs, rhs) insert(rhs, 1, lhs) return rhsend
-- Fold tables to the right (use only with `->`).-- Example: -> }function Predef.foldright(first, ...) if ... then local lhs = first for i=1,select('#', ...) do local rhs = select(i, ...) lhs[compat.len(lhs)+1] = rhs lhs = rhs end end return firstend
-- Fold tables to the left in reverse order (use only with `->`).-- Example: -> function Predef.rfoldleft(first, ...) if ... then local rhs = first for i=1,select('#', ...) do local lhs = select(i, ...) insert(rhs, 1, lhs) rhs = lhs end end return firstend
-- Fold tables to the right in reverse order (use only with `~>`)-- Example: ->