(line, lineNo, start)
| 16 | |
| 17 | var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; |
| 18 | function scan(line, lineNo, start) { |
| 19 | if (!line.text) return; |
| 20 | var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1; |
| 21 | if (start != null) pos = start + d; |
| 22 | for (; pos != end; pos += d) { |
| 23 | var ch = line.text.charAt(pos); |
| 24 | if (re.test(ch) && cm.getTokenAt(Pos(lineNo, pos + 1)).type == style) { |
| 25 | var match = matching[ch]; |
| 26 | if (match.charAt(1) == ">" == forward) stack.push(ch); |
| 27 | else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; |
| 28 | else if (!stack.length) return {pos: pos, match: true}; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) { |
| 33 | if (i == cur.line) found = scan(line, i, pos); |
| 34 | else found = scan(cm.getLineHandle(i), i); |
no test coverage detected