Sublime Forum

Language definition entering infinite loop

#1

I’m using this language definition for Papyrus(the scripting language for Skyrim). It’s worked fine for the last couple years, but at some point (I couldn’t tell you when) it started choking on large files.

For instance, when I load this Activator script (a trivial file that just contains the required script header), it processes fine. But when I load up Actor.psc, a larger script with lots of functions, it hangs on the loading progress bar and never renders. Until I reboot Sublime Text, any attempt to load any other Papyrus script will also hang.

Without the language definition in place, all files open just fine. This definition worked well before, so I’m not sure what’s changed in the underlying systems. I know it contains a big regex for the built-in functions towards the bottom, but that hasn’t caused issues in the past. Anybody know what might be happening?

0 Likes

2217 locking up in Windows
#2

So through a painstaking commenting/uncommenting, I’ve narrowed it down to this portion towards the bottom of the file:

<key>params</key>
<dict>
	<key>begin</key>
	<string>\b</string>
	<key>end</key>
	<string>\)</string>
	<key>endCaptures</key>
	<dict>
		<key>1</key>
		<dict>
			<key>name</key>
			<string>variable.parameter.papyrus</string>
		</dict>
	</dict>
	<key>patterns</key>
	<array>
		<dict>
			<key>include</key>
			<string>$self</string>
		</dict>
	</array>
</dict>

If I comment out the part where I include $self, everything works fine. So I guess the question is, is there a better way to pass function parameters through syntax processing? I’m guessing this enters some kind of infinite loop, but this wasn’t the case in earlier builds.

0 Likes

#3

Managed to at least resolve my own problem, but I think there still might be some bugs in the syntax parser that were not present in previous builds.

Basically, I set my function parameter matcher to stop trying to match at a close parenthesis rather than end of line. Interestingly, it would consistently hang at the 161st function declared in the file. I’m not sure what’s magical about that number (it’s not a power of two, for instance), but that definitely proved to be the border.

Thanks to FichteFoll over at UserEcho for being an excellent sounding board and pointing me in the right direction!

0 Likes