NotePadPP and AFL

10
Feb. 21, 2009 Installing and customizing AFL syntax file for NotePad++ This will be very short instructions for installation and customization of the AFL syntax file for NotePad++. This was last tested under NotePad++ version 5.2 under WinXP. NotePad++ has native syntax definitions for a number of languages. It also has the capability for the syntax definition of other languages. This can be done in two ways. The way that will be used is the “User Defined” facility. This is the most desirable because it has an associated user interface that I’ll show in a minute. The first step after the installation of NotePad++ is to install the version of the userDefineLang.xml file that is customized for AFL. It is assumed that the XML file for AFL is being added to an installation of NotePad++ that has no other user defined languages. Merging of the AFL related XML content with other user defined languages is beyond the scope of this brief explanation. So, do the following to get started - 1. Locate the application data directory associated with the Windows user - %APPDATA%\NotePad++\ . On my system, for example, this is – C:\Documents and Settings\Bruce Robinson\ Application Data\Notepad++\

description

How to Setup Notepad for use with Amibroker AFL

Transcript of NotePadPP and AFL

Feb

Feb. 21, 2009

Installing and customizing AFL syntax file for NotePad++

This will be very short instructions for installation and customization of the AFL syntax file for NotePad++. This was last tested under NotePad++ version 5.2 under WinXP.

NotePad++ has native syntax definitions for a number of languages. It also has the capability for the syntax definition of other languages. This can be done in two ways. The way that will be used is the User Defined facility. This is the most desirable because it has an associated user interface that Ill show in a minute.

The first step after the installation of NotePad++ is to install the version of the userDefineLang.xml file that is customized for AFL.

It is assumed that the XML file for AFL is being added to an installation of NotePad++ that has no other user defined languages. Merging of the AFL related XML content with other user defined languages is beyond the scope of this brief explanation.So, do the following to get started -1. Locate the application data directory associated with the Windows user - %APPDATA%\NotePad++\ . On my system, for example, this is

C:\Documents and Settings\Bruce Robinson\Application Data\Notepad++\

This directory will contain user specific session and configuration info.

Place/overwrite the following file in that directory with the customized version.

userDefineLang.xml

2. Locate the directory where NotePad++ was installed and navigate to the following subdirectory

C:\Program Files\Notepad++\plugins\APIs\

This is the directory for the XML files for auto-completion for the languages.Plact the following file in that directory

Afl.xml

Now, restart NotePad++. When you load a file with an AFL extension, it will be syntax highlighted. The basic installation is that simple.

You will find that you will want to customize the definitions for a number of reasons

Change the font and size

Change the highlighting

Add new reserved words

Etc.

The intent here is to show you where to find the various customization features to get you going. This is not a detailed explanation of the options. Most are fairly obvious, although a couple are not. My suggestion would be to search the NotePad++ postings for explanation of the few complicated features.

3. So, with that, the first non-AFL thing that you will probably want to do is to set the global font and size. This is done in the Style Configurator which is accessed from the menus by

Settings / Style Configurator

This will yield the following dialog

Note that Ive set Lucida Console 10 as the global font and size.

Use your particular preference here.4. Now, lets turn to the task of customizing the AFL syntax definitions. NotePad++ unfortunately has some quirks and limitation which will be listed at the end, BUT, it has a good user interface for accessing the definitions. It is accessed by the menus

View / User Define Dialog

This will yield a large, multi-tabbed dialog. Note how this dialog can be used to define multiple languages. AFL must be selected from the drop down. The extension is also specified here. Once that is done, there are 4 tabs. Characters for code folding are set on the first

5. The second tab contains the keyword lists. These were current in 2008 but will need to be augmented with some of the new AFL reserved words.

6. The third tab defines line and block comments and also the number format.

7. Lastly, operators are defined on the fourth tab

Notes and Limitations

With initial definition of AFL syntax displayed, there are a couple of issues that may be related to limitations of NotePad++. One is minor and the other can be a somewhat significant limitation.

1. When / and * are defined as operators, AFL block comments are not correctly recognized. The workaround is just to not use / and * in the operator list. This slightly affects the color coding if spacing is not used.2. Doing #1 allows the block comment start and end tags /* and */ to be correctly recognized. BUT, it does not allow folding of block comments. This is a desirable feature, and a brief search for a setup fix did not yield one. This can be worked around by enclosing the block comment in braces. For example,

{

/*

This is a comment

*/

}

This is cumbersome, though. So, if anyone discovers a fix, please advise.

Mods

One quick note about mods. Changes become effective immediately when using the User Define dialogs. There is no Save function. So, if you want to try something, keep a backup of you existing userDefineLang.xml file.