OnigRegExp.getCaptureTree does not include empty child captures

This commit is contained in:
Nathan Sobo 2012-08-06 18:27:39 -06:00
parent a85345e392
commit 6878d19a6a

View File

@ -9,7 +9,8 @@ OnigRegExp.prototype.getCaptureTree = (string, startPosition) ->
childCaptures = []
while startPositions[0] < endPosition
childCaptures.push(buildCaptureTree(captures, startPositions, totalCaptures))
subtree = buildCaptureTree(captures, startPositions, totalCaptures)
childCaptures.push(subtree) if subtree.text.length
tree.captures = childCaptures if childCaptures.length
tree