-
Notifications
You must be signed in to change notification settings - Fork 791
Lua lexer bug #3036
Copy link
Copy link
Closed
Description
I've experienced Pygments "hanging" when processing a Lua file, I've narrowed it down to the following synthetic example:
function outer()
for i = 1, 10 do
for j = 1, 5 do
local node3 = {}
for k = 1, 3 do
local item4 = collection.items[ref4]
local item4data = extractFromItem(document, item4)
local refs5 = item4.itemRefs or {}
node4.children = {}
-- has no children but sequences
node4.sequences = {}
node4.name = item4data.name or "unnamed node"
node4.item_refs = refs5
manager.rootgroups[#manager.rootgroups + 1] = node4
manager.nodes[#manager.nodes + 1] = node4
node3.children[#node3.children + 1] = node4
-- print(("Level4 Item %s:" ):format(ref4))
-- util.dumpTable(data.items)
end
end
end
end
The stack trace pointed me at this line taking forever https://github.com/pygments/pygments/blob/master/pygments/lexer.py#L712 and the regular expression causing this seems to be:
[A-Za-z_]\w*(?=(?:(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])|(?:--.*$)|(?:\s+))*[.:])
Edit: after half an hour, it progressed to the next expression:
[A-Za-z_]\w*(?=(?:(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])|(?:--.*$)|(?:\s+))*\()
Let me know if I can provide more details.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels