{"ScriptPreparationCode":"var xpath = \u0022sdf[ewr[dasdfdsaf]asdfasdf]gh[asdfasdf]adsdasd[asdasd]asdasdsa[asd[[[[[asdasdasd]]]]]asd]\u0022","TestCases":[{"Name":"Reduce","Code":"var result = _.reduce(xpath, function(accumulator, element, index) {\r\n if (element === \u0027[\u0027) {\r\n accumulator.push({start: index});\r\n\t}\r\n\tif (element === \u0027]\u0027) {\r\n\t\t_.set(_.findLast(accumulator, (obj) =\u003E !obj.end), \u0022end\u0022, index);\r\n }\r\n return accumulator;\r\n}, []);","IsDeferred":false},{"Name":"For","Code":"var predicateMarkStack = [];\r\nvar predicateMarkIndexRange = [];\r\nfor (var i = 0; i \u003C xpath.length; i\u002B\u002B) {\r\n if (xpath.charAt(i) === \u0022[\u0022) {\r\n predicateMarkStack.push(i);\r\n }\r\n if (xpath.charAt(i) === \u0022]\u0022) {\r\n var index = predicateMarkStack.pop();\r\n// if (predicateMarkStack.length === 0) {\r\n predicateMarkIndexRange.push({init: index, end: i});\r\n// }\r\n }\r\n}","IsDeferred":false}]}