Loop example, error

From the CottleSC3 document, I want to try this example:

	(
		{
			var bufNum = ~b_med1.bufnum, srate = 44100, start = 0, end = 3, duration, rate = 1;
			// Use these lines for proportional lengths
			// var bufNum = 0, srate = 44100, start = 0.21, end = 0.74,
			// rate = 1, duration, total;
			// total = BufFrames.kr(bufNum)/44100;
			// end = end*total; start = start*total;
			duration = abs(end - start);
			BufRd.ar(2, bufNum, // Buffer 0
				LinLin.ar(
					LFSaw.ar(rate/duration, 1), -1, 1, start, end)*srate)*EnvGen.kr(Env.linen(0.01, 0.98, 0.01), 
				timeScale: duration, gate: Impulse.kr(1/duration));
		}.play
	)

But I get this error and can’t find the problem:

ERROR: syntax error, unexpected $end, expecting ')'
  in file 'selected text'
  line 1 char 3:

  	( 
     
-----------------------------------
ERROR: Command line parse failed
-> nil

It looks like running the code fails on my system when a file exceeds a certain amount of lines (300 now)… ?

When I paste the code in a new file, it works as expected.

That certainly can’t be it. I’ve got files of a few thousand lines.

There is a known issue where a syntax error on, say, line 100 will cause the IDE to fail to see any (...) regions after it (even if you aren’t running the code containing the syntax error). I would guess that’s what you’re seeing.

hjh