0

I am using a Language Module for Stata in BBEdit. Open Line Comments in Stata can begin with either an asterisk or two forward slashes in a row. BBEdit handles comments beginning with two forward slashes correctly. No matter where the two forward slashes fall in a line of code, BBEdit recognizes it as the start of a comment and highlights the two forward slashes and the characters after as Open Line Comments. But with the asterisk, the behavior is different, which I understand because an asterisk is also used as the multiplication sign in formulas in the Stata coding language, so this means that you only want an asterisk at the beginning of a line to be recognized as the start of an Open Line Comment.

My issue is that BBEdit will not recognize an asterisk as the start of an Open Line Comment if there are any spaces or tabs before the asterisk, even though Stata would recognize this as the start of a comment line and ignore the line when running the code. My inability to have tabs at the beginning of a comment line before an asterisk messes up my normal way of organizing my Stata code with lots of indentations and comments. Any help on this front would be appreciated! (I used to use Notepad++ as my code editor for Stata, but I switched to a Mac, which doesn't have Notepad++, and found BBEdit to be a nice alternative.)

To fix this issue, I tried to add additional lines of code in the .plist file with tabs before the asterisk as also strings that should be recognized as the start of Open Line Comments, but BBEdit does not recognize the tabs and still behaves as before, where an asterisk after a tab is not recognized as the start of an Open Line Comment. My guess it that I'll need to use "Regular Expression Patterns" (see https://www.barebones.com/support/develop/clm.html#Structures) rather than "String Patterns" to indicate that I want a tab followed by an asterisk to indicate an Open Line Comment, but I haven't found how to do that.

Here is the code I added with tabs that didn't work.

<key>Open Line Comments</key>
<string>//</string>
<key>Open Line Comments</key>
<string>*</string>
<key>Open Line Comments</key>
<string>    *</string>
<key>Open Line Comments</key>
<string>        *</string>
<key>Open Line Comments</key>
<string>            *</string>
<key>Open Line Comments</key>
<string>                *</string>
<key>Open Line Comments</key>
<string>                    *</string>
<key>Open Line Comments</key>
<string>                        *</string>

0 Answers0