(line, file, near)
| 411 | } |
| 412 | |
| 413 | function findMatchingPosition(line, file, near) { |
| 414 | var pos = Math.max(0, near - 500), closest = null; |
| 415 | if (!/^\s*$/.test(line)) for (;;) { |
| 416 | var found = file.indexOf(line, pos); |
| 417 | if (found < 0 || found > near + 500) break; |
| 418 | if (closest == null || Math.abs(closest - near) > Math.abs(found - near)) |
| 419 | closest = found; |
| 420 | pos = found + line.length; |
| 421 | } |
| 422 | return closest; |
| 423 | } |
| 424 | |
| 425 | function scopeDepth(s) { |
| 426 | for (var i = 0; s; ++i, s = s.prev) {} |