Codeless Language Module for LiveCode (nee RunRev)

74 views
Skip to first unread message

Stam Kapetanakis

unread,
Aug 11, 2024, 12:51:01 PM8/11/24
to BBEdit Talk
Hi all,
I've found an old pList used for LiveCode within BBEdit.

Just have an issue with line commenting. The old file only had 1 commenting style:
<key>BBLMCommentLineDefault</key>
<string>#</string>

followed by the multiline commenting:
<key>BBLMCommentPrefixDefault</key>
<string>/*</string>
<key>BBLMCommentSuffixDefault</key>
<string>*/</string>


but in this language there are 3 styles for single line comments: "//", "#" and "--"

I thought I'd be clever and change the single line comment key to:

<key>BBLMCommentLineDefault</key>
<array>
<string>#</string>
<string>--</string>
<string>//</string>
</array>



everything works except "--" 
I suspect none of this made any difference BBEdit was processing "//" and "#" as default 
markers for a comment line.

Question: How can I make BBEdit treat "--" as start of. comment line?

Many thanks
Stam


jj

unread,
Aug 16, 2024, 4:35:29 AM8/16/24
to BBEdit Talk

Hi Stam,


Take a look at https://www.barebones.com/support/develop/clm.html#ExREComments.


You could leave empty all the BBLMComment* keys and add this to your plist:


<key>Comment Pattern</key>

<string><![CDATA[

(?x)                (?# Allow comments and ignore whitespace even in classes.)

(?-s)               (?# Dot doesn't match newlines.)

(\#|--|\/\/)        (?# Single line comment prefixes.)

.*                  (?# Rest of the line)

$                   (?# End of line.)

]]></string>


Here is an imaginary Stam Codeless Language Module that would be applied to files with .stam extension.

Name it ~/Library/Application Support/BBEdit/Language Modules_out/Stam.plist and restart BBEdit.


<?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>Stam</string>

    <key>BBLMLanguageDisplayName</key>

    <string>Stam</string>

    <key>BBLMSuffixMap</key>

    <array>

        <dict>

        <key>BBLMLanguageSuffix</key>

        <string>.stam</string>

        </dict>

    </array>

    <key>Language Features</key>

    <dict>

        <key>Identifier and Keyword Character Class</key>

        <string>\p{L}\p{N}\-</string>

        <key>Comment Pattern</key>

        <string><![CDATA[

        (?x)                (?# Allow comments and ignore whitespace even in classes.)

        (?-s)               (?# Dot doesn't match newlines.)

        (\#|--|\/\/)        (?# Single line comment prefixes.)

        .*                  (?# Rest of the line)

        $                   (?# End of line.)

        ]]></string>

    </dict>

</dict>

</plist>



For help on regular expressions, see BBEdit > Help > BBEdit Help > Grep Reference.


HTH


Jean Jourdain

Gil Dawson

unread,
Aug 30, 2024, 9:28:17 PM8/30/24
to bbe...@googlegroups.com
Markup -> Check -> Document Syntax ^⌘Y 

...on my XML document gets a few ignorable errors:

PastedGraphic-1.png

Is there a way to avoid those errors?

My document starts with "<?xml version="1.0" encoding="utf-8"?>"

I tried adding "<!DOCTYPE XML>"; didn't help.

The bottom of the BBEdit window says XML:

PastedGraphic-2.png

--Gil


Reply all
Reply to author
Forward
0 new messages