Reply To: using keywords to identify content

Product Compare Forums Multi-Edit Support using keywords to identify content Reply To: using keywords to identify content

#6796
deleyd
Participant

Here’s an unfinished write-up I’m making about how to add language support for a new language to Multi-Edit. You can specify special words to show up differently. In a programming language these are Reserved Words, and when you type one Multi-Edit instantly recognizes it and displays it differently, such as bold, or a different color, or highlighted, or any combination of that.

EDIT: Now see the final write-up:

Here’s the write up so far:

First become familiar with the COLOR SETUP dialog. Go to TOOLS -> CUSTOMIZE -> General(left side) -> COLOR SETUP (right side) to get the COLOR SETUP dialog. Click on HELP in that dialog and read all about the COLOR SETUP dialog. Also look up COLORS in the index of the Multi-Edit User’s Guide and read what it has to say there. Be sure to try out all the different Color Templates (upper left corner of the Color Setup dialog).

Scroll down the listbox on the right side until you come to the Syntax Highlighting section. There is a direct correspondence between items here and items in the Language Setup dialog. Note the entries are:
Reserved Words 1
Reserved Words 2
Reserved Words 3
Reserved Words 4
Symbol Text
Brackets
EOL Comment 1
EOL Comment 2
EOL Comment 3
EOL Comment 4
Open/Close Comment 1
Open/Close Comment 2
Numeric Text
String Text

Language Setup dialog
Now go to TOOLS -> CUSTOMIZE -> General (left side) -> Languages (right side). You may view an existing language setup by selecting the language and clicking EDIT. To add support for a new langauge, click INSERT to get an empty Language Setup dialog which you can fill in. Click the HELP button in the lower right corner and read what it has to say.

The Language field contains the name of your language.

The ‘Case Sensitive’ checkbox. Check this if your language is case sensitive.

(In the following when I say "the color specified" you can specify more than just color, you can specify text color, background of the text color (highlight), italic, bold. Make sure "Syntax Highlighting" is checked in the Color Setup dialog (at top))

Reserved Words
Reserved Words line 1: All words entered here will be displayed using the color specified in the Color Setup dialog for ‘Reserved Words 1’.

Reserved Words line 2: All words entered here will be displayed using the color specified in the Color Setup dialog for ‘Reserved Words 2’.

Reserved Words line 3: All words entered here will be displayed using the color specified in the Color Setup dialog for ‘Reserved Words 3’.

Reserved Words line 4: All words entered here will be displayed using the color specified in the Color Setup dialog for ‘Reserved Words 4’.

Symbols: Symbols entered here will be displayed using the color specified in the Color Setup Dialog for ‘Symbol Text’.

Brackets: Brackets entered here will be displayed using the color specified in the Color Setup Dialog for ‘Brackets’. Common brackets are ()[]{}.

Strings: Enter a double quotation mark " if strings in your language are enclosed in double quotation marks. Enter a single quotation mark ‘ if strings in your language are enclosed in single quotation marks. You may enter both a single and a double quotation mark if strings in your language may be enclosed in either. (Other delimiters may work, but I’ve never encountered a language that uses something other than single or double quotation marks.) Strings will then be displayed using the color specified in the Color Setup dialog for ‘String Text’.

If there is a special escape character which when found in a string means take the next character literally, enter that character in the ‘Literal;’ field. For example, in a CMAC double-quoted string the backslash character is a special character, so we enter a backslash here. This way a double quote will not be interpreted as the end of the string if it is preceded by a backslash. Thus the following string will be properly interpreted as a single string rather than two strings:

[code:towhn9jq]"He said, \"Goodbye!\" and then left."[/code:towhn9jq]

Note: Numerous predefined languages in Multi-Edit have two backslashes in the ‘Literal:’ field. This is not neccessary. One will suffice.

Numeric:
Literal:

Block Comments:
If your language supports starting and ending block comment characters enter them here. For example, in C and CMAC the sequence /* specifies the start of a block comment and the sequence */ specified the end of said block comment. You would enter /* in the Open 1 field and */ in the Close 1 field. Then these comments will be displayed using the color specified in the Color Setup dialog for Open/Close Comment 1.

Similarly, a block comment specified by the starting and ending characters in the Open 2 field and Close 2 field will be displayed using the color specified in the Color Setup dialog for Open/Close Comment 2.

End of line comments:
Specify the character or character sequence which identify the beginning of a comment which extends to the end of the line. A comment identified by End of line comments 1 will be displayed in using the color specified in the Color Setup dialog for ‘EOL Comment 1’. Similarly a comment identified by End of line comments 2,3,4, will be displayed using the color specified in the Color Setup dialog for ‘EOL Comment 2’,3,4, respectively.

If your language dictates that any text beyond a certain column number is to be treated as a comment, enter that column number in the Column field. For example, FORTRAN-77 specifies that any text beyond column 72 is a comment, so you would enter 73 in this field to specify that comments begin with column 73.

You can also combine comment character & column to specify that if a certain character is in a certain column, then starting there to the end of the line is a comment. For example, in FORTRAN-77 a "C" in column 1 specifies that line is a comment, so you enter a C for the character and 1 for the column.

You can also specify that a comment character or character sequence be the first non-whitespace character on the line in order for it to be a comment character by specifying -1 as the comment column number.

Some people have been creative in their use of the four different end of line comments you can define. They have used them for other things that they want to stand out.

I have set up four different EOL comments, each with their own color scheme. I can then insert the appropriate comments in my code to make lines show up as different colors. I have colors (with varying intensities) for "TODO/CRITICAL", "Headings", "Normal Comments", and a very muted gray for code I comment out that is slated for the chopping block. I use a muted color to help keep it from distracting me whereas for TODO/Critical I use a very loud red. The headings are intense yellow, and my normal comments are a pale yellow. It breaks up the code very nicely.[/quote:towhn9jq]

——-End write-up
Multi-Edit identifies the language by the file extention. You can define your own ‘language’, give it a name, fill in a list of reserved words. Then you need to associate a file extention with this new ‘language’ you created. Go to TOOLS -> CUSTOMIZE -> General (left side) -> FILENAME EXTENTIONS, click INSERT. This will give you the "Edit Filename Extention Setup" dialog. All you need to fill in is the Extention, and the Language, the one you just created and gave it a name so reserved words will be highlighted. You can later edit this by selecting the extention and clicking Edit instead of Insert.

Hope this is enough to get you going in the right direction.

EDIT: Final write-up: see