BBEdit LassoScript Codeless Language Module
The project BBEdit_LassoScript_CLM and its source files are hosted on GitHub.
Eric Knibbe has published a BBEdit Codeless Language Module for Lasso 9.
This codeless language module is designed to work with both the LassoScript <?lassoscript ?> and square-bracket  syntaxes for Lasso Professional 8.5.x and later.
Filenames must end with .lasso, .las, or .inc. You can modify the file LassoScript.plist to include other file suffixes.
The BBLMKeywordList is current as of Lasso Professional 8.6.3. To update the BBLMKeywordList, edit LassoScript.plist as specified in the message on LassoTalk Subject: List of all LDML tags and keywords.
I modified the SQL statement from the above message as shown below.
Update the BBLMKeywordList¶
Step 2: Clean up export in BBEdit¶
Manually remove any symbols and other Types from the records (! Not Logical ... -> Member).
After you have done that, you can either use the following process manually, or you can use the AppleScript LDML_Prep.scpt which is included in the repository. LDML_Prep.scpt executes the following steps in order.
Strip " ... " (spaces before and after) for matching container tags, then a stray "..." (no spaces), then account for parameter values that are comma-separated, then strip square brackets, then format for the plist.
|" ... "||\r|
|(.*)\r||\t\t<string>\1</string>\r (use grep)|
Step 3: Modify plist¶
Paste results into my plist at the top of the BBLMKeywordList, select the array of keywords, and use BBEdit's Text > Process Duplicate Lines command to remove duplicate keywords.
Complete information on writing Codeless Language Modules can be found in the BBEdit User Manual.
- clone the GitHub repository BBEdit_LassoScript_CLM or download the .zip file
- Backup and remove all other LDML Language Modules from ~/Library/Application Support/BBEdit/Language Modules. This avoids possible conflicts.
- Move the file BBEditLDML/Language Modules/LassoScript.plist to ~/Library/Application Support/BBEdit/Language Modules.
- Move the folder BBEditLDML/Scripts/06)Set Language to/ and its contents to ~/Library/Application Support/BBEdit/Scripts/.
- Restart BBEdit. This will load the new .plist and AppleScripts. Next you configure BBEdit to use these items.
- In BBEdit, select BBEdit > Preferences > Languages > Lasso Script >
Options... > General.
- For adding multiline comments, enter /* and */ for Comment start and Comment end, respectively.
- For looking up selections in the local reference, for Reference URL template enter http://localhost/Reference.LassoApp?__SYMBOLNAME__. Ctrl-click on a selection, and select Find in Reference. The local copy of your language reference should appear in a web browser and search for the selected text.
- In BBEdit, select BBEdit > Preferences > Languages > Suffix Mappings. Map the file suffixes that you want to have lasso syntax highlighting to the appropriate language module. You might need to Add... or Change... file suffixes. I recommend mapping .lasso, .las, and .inc. For each suffix, set the name of the suffix, set the language to Lasso Script, and select the radio button for Source File.
- Under the Scripts menu (the funny scroll icon shaped like an S), select Set Language to > LDML.
- You can set keyboard shortcuts for these scripts to easily switch language modes. Select Window > Palettes > Scripts. Expand Set Language to. Select HTML. Click Set Key.... I use ^H (CTRL-H) for HTML, and ^L for LDML.
- Create a new file, name it test.lasso, set the language to LDML, and syntax coloring should work.
Use at your own risk!
Thanks to Johan Sölve, Adam Randall, Greg Willits and Chris Corwin for contributions (with or without their knowledge).
Did you like this article? Please send me a Gratipay, as little as 25¢ per week!
Updates, suggestions and comments regarding this article may be sent to Steve Piercy, [email protected] or comment using Disqus.