Sublime Forum

How to find where error is in tmLanguage file?

#1

I’m about to make a new release of a syntax definition for Python in Package Control. I’ve been using AAAPackageDev’s YAML-tmLanguage format for editing the regexes, then building into the XML-based tmLanguage format for testing in ST2 and ST3 (2.0.2 and Build 3095, respectively). Unfortunately, I seem to have screwed something up, as both versions of ST are giving me the uninformative error

error: Error loading syntax file "Packages/Python Improved/PythonImproved-Unicode.tmLanguage": boost::bad_any_cast: failed conversion using boost::any_cast

No line numbers, no regex to track down, nothing. Any ideas on where/how I can find the error?

0 Likes

#2

cry in a corner

Seriously though, what I mostly did was to check the recent changes I made from the last definitely working state (via git) and then inspect them carefully. It is most likely a missing - that turns the value of a “patterns” property into a mapping instead of a sequence. .sublime-syntax is a lot easier to debug here.

I have considered adding some kind of detection for these types of errors to PackageDev but I never really got around to because it was not a high priority. And with .sublime-syntax out now I’ll most likely never do it. (Otoh it’s really not too complicated … We’ll see, the issue still exists: github.com/SublimeText/AAAPackageDev/issues/49)

0 Likes