Qedit

Customizing a Syntax Coloring Language Template

By François Desrochers

Syntax coloring has been introduced in Qedit for Windows 5.3. Each language supported is defined in its own language template file. Language template files are simple XML files stored as text. This means it's easy to create new templates or customize existing ones. Qedit for Windows comes with a series of templates defining many languages commonly found in HP3000 and HP9000 environments. This article shows how to customize one of these templates, namely SPL.

Robelle-supplied templates are stored in the system/language subdirectory where Qedit for Windows is installed. Typically, this would be c:\robelle\qedit\system\language. You should not change these files since they will be replaced next time you install a new version of Qedit for Windows. You should make a copy of the files you want to customize into \robelle\qedit\user\language or into one of your own directories. This rule also applies to a new template that you create.

Once you have copied the template in an appropriate location, you can use your favorite editor, Qedit for Windows of course, to modify the template file. For example, Neil Armstrong, Robelle's Suprtool architect, has customized his copy of the SPL template with new keywords. In SPL, blocks are defined by Begin and End keywords. This construct is used for procedures, subroutines, if conditions and a host of others. When these constructs are nested, you end up with a series of End statements like these:

   procedure check'file
   begin
      while <<somecondition>>
	  begin
	     << some logic here >>
		 if <<othercondition>> then
		 begin
		    << othercondition is True >>
		 end           <<if>>
		 else
		 begin
		    << othercondition is False >>
		 end;          <<else>>
	  end;             <<while>>
   end;                <<procedure>>
To make it easier to identify which End statement applies to which block, we use a number of Defines:
	define
	   end'if   = end#  ,end'else = end#  ,end'while= end#
	  ,end'case = end#  ,end'do   = end#  ,end'proc = end#
	  ,end'subr = end#  ,end'for  = end#;
Each one corresponds to the End statement but, at the same time, each one clearly identifies which block it corresponds to. So, the code snippet above would now looks like:
   procedure check'file
   begin
      while <<somecondition>>
	  begin
	     << some logic here >>
		 if <<othercondition>> then
		 begin
		    << othercondition is True >>
		 end'if
		 else
		 begin
		    << othercondition is False >>
		 end'else;
	  end'while;
   end'proc;
The basic SPL template contains the Begin and End keywords but not the defines. This means they will not be colored and appear as normal text. To fix this, edit the new SPL template file. To associate these defines to the original statement they replace, we will add them immediately after it. They could have been added anywhere else in the list though. So, the keyword section would now have:
   <keyword>END</keyword>
   <keyword>end'if</keyword>
   <keyword>end'else</keyword>
   <keyword>end'while</keyword>
   <keyword>end'case</keyword>
   <keyword>end'do</keyword>
   <keyword>end'proc</keyword>
   <keyword>end'subr</keyword>
   <keyword>end'for</keyword>
   <keyword>ENTRY</keyword>
To have Qedit for Windows recognize the new template, you have to exit and start it up again. And you're done! The final results could look like this:

To read more Qedit for Windows tips, visit this compilation.

francois.desrochers@robelle.com
June 2002


Syntax Highlighting for Suprtool

By François Desrochers

In a previous article, we have explained how to customize a language template to fit your Qedit for Windows environment. Today, we will show you how to add Suprtool commands to an existing language template.

Typically, Suprtool commands are embedded in job streams among MPE commands. These job streams are usually JOB files so the corresponding language would be job.xml. The standard JOB language template that is distributed with Qedit for Windows only contains MPE commands. If you work a lot with Suprtool, it is nice to have its commands highlighted as well. We have put together an add-on file which contains everything you need. The file is regular text file called suprtoolkeywords.txt.

Here's what you need to do to update the JOB language template. Note: you can customize the language template of your choice. It doesn't have to be this one.

  1. Download suprtoolkeywords.txt to your PC.
  2. Open the language template file with your favorite editor. The template files are usually stored in the \robelle\qedit\system\language directory (the default install directory).
  3. Open the Suprtool keyword file.
  4. Select the comment lines and copy them to the clipboard.
  5. Go back to the language template and paste these lines in the Comments section. They can be pasted anywhere between the Comments and /Comments XML tags.
  6. Go to the Suprtool keyword file, select all the Keyword lines and copy them to the clipboard.
  7. Go back to the language template and paste these lines with the other Keyword entries. They can be pasted anywhere (before, in between or after).
  8. Save the language template.
  9. If you have used Qedit for Windows to edit the files, you have to exit and restart it.

francois.desrochers@robelle.com
February 2003