The YAML in your question is compiled by PackageDev into a .tmLanguage
XML/Plist format. Each regex is associated with one or more scopes. A scope is essentially just a specific region in an editing buffer with a name, in this case constant.language.log
. As buffers are modified, Sublime (and TextMate, where the idea originally came from) scans the text for matches to the regexes in the .tmLanguage
syntax definition file, and names them appropriately. In this case, anywhere the word ERROR
or Error
appears on its own, it is assigned the constant.language.log
scope.
The coloring comes from your color scheme, the .tmTheme
file shown in your User Preferences. Color scheme files are also XML-based, but instead of containing regexes they contain scope selectors, similar to CSS selectors, if you are familiar with them. Each scope selector can be assigned a foreground color, a background color, and/or bold or italic text. So, for example, a color scheme may have the selector constant
(which will match constant.language
, constant.environment
, etc.) and rules to color it purple and make the text bold and italic. Now, every time Sublime assigns the selector constant.*
to a region, the color scheme will style that region according to its rules.