Hi Christopher,

Here is a minimal Codeless Language Module for an hypothetical 
"Christopher" language that demonstrates the use of color runs.
Save it as Christopher.plist in ~/Library/Application 
Support/BBEdit/Language Modules.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
    <key>BBEditDocumentType</key>
    <string>CodelessLanguageModule</string>
    <key>BBLMColorsSyntax</key>
    <true/>
    <key>BBLMIsCaseSensitive</key>
    <false/>
    <key>BBLMLanguageCode</key>
    <string>Chri</string>
    <key>BBLMLanguageDisplayName</key>
    <string>Christopher</string>
    <key>BBLMSuffixMap</key>
    <array>
        <dict>
        <key>BBLMLanguageSuffix</key>
        <string>.chris</string>
        </dict>
    </array>
    <key>BBLMRunColors</key>
    <dict>
        <key>com.christopher.preferred_color</key>
        <string>hsla(1.000, 1.000, 1.000, 1.000)</string>
    </dict>
    <key>BBLMRunNames</key>
    <dict>
        <key>com.christopher.preferred_color</key>
        <string>Christorpher's preferred color</string>
    </dict>
    <key>BBLMKeywordPatterns</key>
    <array>
        <dict>
            <key>RunKind</key>
            <string>com.christopher.preferred_color</string>
            <key>Pattern</key>
            <string>Chris(topher)?</string>
        </dict>
    </array>
    <key>Language Features</key>
    <dict>
        <key>Identifier and Keyword Character Class</key>
        <string>\p{L}\p{N}\-</string>
    </dict>
</dict>
</plist>

After restarting BBEdit and selecting the "Christopher" language, any 
instances of "Chris" or "Christopher" should be colored in red.

"Christopher's preferred color" is configurable in BBEdit > Preferences > 
Text Colors > Christopher > Christopher's preferred color.

For more information about "Keywords, Run Kind Patterns, and More" see:
https://www.barebones.com/support/technotes/language-module-changes.html

HTH

Jean Jourdain
On Monday, August 23, 2021 at 10:05:22 PM UTC+2 Christopher Waterman wrote:

> Hello,
>
> I’m curious about BBLMRunColors.
>
> I imagine it would be implemented something like this:
>
> <key>BBLMRunColors</key>
> <array>
> <string>com.run.kind.name</string>
> </array> 
>
> But this crashes BBEdit.
>
> This is pulled from this technote: 
> https://www.barebones.com/support/technotes/language-module-changes.html
>
> The BBLMKeywords key is an array of dictionaries. In each dictionary, 
> there is a RunKindkey that specifies the run kind to be used (one of the 
> factory-supplied run kinds, or one defined in your language module's 
> BBLMRunColors array),...
>
> ...
>
> The run kinds you can use are not limited to the built-in ones; you can 
> define your own run kinds and color mappings using a BBLMRunColors key, 
> as previously described. You must also add a BBLMRunNames key which maps 
> those run kinds to human-readable names, so that users can adjust the color 
> settings.
>
>
> This isn’t explicit as to whether this BBLMRunColors is a “coded” only 
> language module feature or if it works with the codeless variety.
>
> The only example I could find was in the built in Python module, where it 
> was mapping built in run kinds to custom ones.
>
> - Does it work with codeless language modules?
>
> - If it does, does anyone have an example?
>
> Thanks
> —C. Waterman
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9fc1b13e-c0db-48ca-8a7b-6e7d2002ef0cn%40googlegroups.com.

Reply via email to