BBEdit LassoScript Codeless Language Module
 
Introduction

This article contains instructions on how to enable LassoScript syntax coloring in BBEdit 8.5.x and how to use AppleScript to switch language modes between LassoScript, HTML and JavaScript.

This codeless language module is designed to work with both the LassoScript <?lassoscript ?> and square-bracket [] syntaxes for Lasso Professional 8.5.x.

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.5.5. To update the BBLMKeywordList, edit "LassoScript.plist" as specified in this message on LassoTalk: Subject: List of all LDML tags and keywords.

I modified the SQL statement from the above message as shown below.

To update the BBLMKeywordList

Step 1: Export tags, parameter names and parameter values

Begin by going to the LassoAdmin database browser, under the SQL tab: http://localhost/DatabaseBrowser.0.LassoApp?tab1=sql

Use the following search parameters:

Expand SQL Statement options
Datasource: Lasso Internal
Host: Internal
Database: LDML8_Reference
Table: Tags

Expand Format options
Format: Tab Delimited
Field Names: No
Line Endings: UNIX/Mac OS X

Expand Options options
Show Fields: 
Max Records: All Records
Max Field Lines: 
Submit on Return: No

SQL Statement field:
SELECT tag_name FROM tags
UNION 
SELECT DISTINCT param_name FROM parameters WHERE param_name LIKE "-%"
UNION 
SELECT DISTINCT param_value FROM parameters WHERE param_value LIKE "-%"
ORDER BY tag_name;

Click Issue SQL Statement button.

Click Export Results button.

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 .zip download. 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.

Find Replace
(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 Appendix D of the BBEdit manual.

Installation Instructions
  1. Download BBEditLDML.zip (28 Kb Last updated Jun 25, 2008.)
  2. Unzip the downloaded file.
  3. Backup and remove all other LDML Language Modules from:
    ~/Library/Application Support/BBEdit/Language Modules
    This avoids possible conflicts.
  4. Move the file
    BBEditLDML/Language Modules/LassoScript.plist
    to
    ~/Library/Application Support/BBEdit/Language Modules
  5. Move the folder
    BBEditLDML/Scripts/06)Set Language to/
    and its contents to
    ~/Library/Application Support/BBEdit/Scripts/
  6. Restart BBEdit. This will load the new .plist and AppleScripts. Next you configure BBEdit to use these items.
  7. 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.
  8. 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".
  9. Under the Scripts menu (the funny scroll icon shaped like an "S"), select Set Language to > LDML.
  10. 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.
  11. 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).

 

Updates, suggestions and comments regarding this article may be sent to Steve Piercy, web@stevepiercy.com.