Home Download Buy Blog Forum Support

Language definition entering infinite loop

Language definition entering infinite loop

Postby SJML on Wed Jul 18, 2012 2:42 pm

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?
SJML
 
Posts: 19
Joined: Sat Feb 05, 2011 3:32 am

Re: Language definition entering infinite loop

Postby SJML on Wed Aug 15, 2012 11:59 pm

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

Code: Select all
<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.
SJML
 
Posts: 19
Joined: Sat Feb 05, 2011 3:32 am

Re: Language definition entering infinite loop

Postby SJML on Thu Aug 16, 2012 12:46 am

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!
SJML
 
Posts: 19
Joined: Sat Feb 05, 2011 3:32 am


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests