CHDK Wiki
Advertisement

uBASIC Syntax Highlighting for BBEdit and TextWrangler[]

uBasic Syntax Highlighting is available for the BBEdit and TextWrangler code editors on the Mac.

This is an example of uBasic syntax highlighting in TextWrangler.

Download the Language Module[]

The uBASIC Language Module can be downloaded here: ubasic.plist.zip

Installing the Language Module[]

Step 1. Download and unzip the ubasic.plist.zip file to your Mac desktop.

Step 2. To enable uBasic syntax highlighting for BBEdit save the file ubasic.plist to the following location:

   ~/Library/Application Support/BBEdit/Language Modules/ubasic.plist

for TextWranger the ubasic.plist file goes in:

   ~/Library/Application Support/TextWrangler/Language Modules/ubasic.plist

If you are on Mac OS X Lion you can open the hidden ~/Library/Applications Support folder by using the Finder's Go > Go to Folder... menu item.

This is the Go to Folder menu item in the Mac OS X Finder.

In the Go to Folder dialogue paste in the text ~/Library/Application Support/ and click the Go button.

Use the go to folder menu item to navigate to the "Applications Support" folder.

This will take you into the Applications Support folder. From here you can open up either the TextWrangler or BBedit folders.

TextWrangler Applications Support Folder[]

This is a screenshot of the TextWrangler Applications Support folder. Drag the file ubasic.plist into the Language Modules folder. This is the TextWrangler Applications Support folder.

BBEdit Applications Support Folder[]

This is a screenshot of the BBEdit Applications Support folder. Drag the file ubasic.plist into the Language Modules folder. This is the BBEdit Applications Support folder.

If you haven't used a Languages Module before, the directory "Language Modules" might not exist. You can create it yourself using the File > New Folder menu item in the Finder. Rename the new folder item "Language Modules".

After you copy the Language Module file into place, restart the text editor.

Now, when you open a uBASIC .BAS file, TextWranger performs syntax highlighting which makes editing code faster and easier.

Alternate Installation Technique[]

Save the following xml file under your user directory: /Users/<your account>/Library/Application Support/BBEdit/Language Modules/ubasic.plist

<!-- uBasic Codeless Language Module for BBEdit 8 -->
<!-- version 0.92 -->
<!-- August, 2009 -->
<!-- Created by John Bussjaeger -->


<?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>
	<true/>
	<key>BBLMLanguageCode</key>
	<string>uBAS</string>
	<key>BBLMLanguageDisplayName</key>
	<string>uBASIC</string>
	<key>BBLMScansFunctions</key>
	<true/>
	
	<key>BBLMSuffixMap</key>
	<array>
		<dict>
			<key>BBLMLanguageSuffix</key>
			<string>.bas</string>
			<key>BBLMCanResolveIncludeFiles</key>
			<false/>
		</dict>
	</array>
	<key>Language Features</key>
	<dict>
		
		<key>Identifier and Keyword Characters</key>
		<string>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:@</string>
	
		<key>Open Strings 1</key>
		<string>"</string>
		<key>Close Strings 1</key>
		<string>"</string>
		
		<key>Prefix for Functions</key>
		<string>:</string>

		<key>End-of-line Ends Strings 1</key>
		<false/>
		
		<key>Open Line Comments</key>
		<string>rem</string>
	</dict>
	<key>BBLMKeywordList</key>
	<array>
		<string>let</string>
		<string>if</string>
		<string>then</string>
		<string>else</string>
		<string>for</string>
		<string>to</string>
		<string>next</string>
		<string>goto</string>
		<string>gosub</string>
		<string>return</string>
		<string>end</string>
		<string>@title</string>
		<string>@param</string>
		<string>@default</string>
		<string>print</string>
		<string>not</string>
		<string>and</string>
		<string>or</string>
		<string>endif</string>
		<string>cls</string>
		<string>@pause</string>
		
		
		<string>af_led_off</string>
		<string>af_led_on</string>
		<string>amber_led_off</string>
		<string>amber_led_on</string>
		<string>auto_focus_bracketing</string>
		<string>blue_led_off</string>
		<string>blue_led_on</string>
		<string>click</string>
		<string>display</string>
		<string>down</string>
		<string>erase</string>
		<string>exit_alt</string>
		<string>flash</string>
		<string>get_av</string>
		<string>get_day_seconds</string>
		<string>get_disk_size</string>
		<string>get_dof</string>
		<string>get_far_limit</string>
		<string>get_focus</string>
		<string>get_free_disk_space</string>
		<string>get_hyp_dist</string>
		<string>get_iso_real</string>
		<string>get_iso</string>
		<string>get_jpg_count</string>
		<string>get_near_limit</string>
		<string>get_prop</string>
		<string>get_raw_count</string>
		<string>get_raw_nr</string>
		<string>get_tick_count</string>
		<string>get_vbatt</string>
		<string>get_zoom</string>
		<string>green_led_off</string>
		<string>green_led_on</string>
		<string>is_key</string>
		<string>is_key</string>
		<string>iso</string>
		<string>left</string>
		<string>macro</string>
		<string>md_detect_motion</string>
		<string>md_detect_motion</string>
		<string>md_get_cell_diff</string>
		<string>md_get_cell_diff</string>
		<string>menu</string>
		<string>mf</string>
		<string>press</string>
		<string>print_screen</string>
		<string>release</string>
		<string>right</string>
		<string>set_av_rel</string>
		<string>set_av</string>
		<string>set_backlight</string>
		<string>set_focus</string>
		<string>set_iso</string>
		<string>set_led</string>
		<string>set_led</string>
		<string>set_nd_filter</string>
		<string>set_prop</string>
		<string>set_raw</string>
		<string>set_tv_rel get_tv</string>
		<string>set_tv</string>
		<string>set_zoom_rel</string>
		<string>set_zoom</string>
		<string>shoot_full</string>
		<string>shoot_half</string>
		<string>shoot</string>
		<string>shut_down</string>
		<string>shut_down</string>
		<string>sleep</string>
		<string>timer_led_off</string>
		<string>timer_led_on</string>
		<string>timer</string>
		<string>up</string>
		<string>video</string>
		<string>wait_click</string>
		<string>wend</string>
		<string>wheel_left</string>
		<string>wheel_right</string>
		<string>yellow_led_off</string>
		<string>yellow_led_on</string>
		<string>zoom_in</string>
		<string>zoom_out</string>

	</array>

</dict>
</plist>

You can alternatively paste the xml code into the unix terminal after running the following command; after pasting the xml text above, press control D.

cat > "~/Library/Application Support/BBEdit/Language Modules/ubasic.plist"
Advertisement