PSPad's language support system consists of 4 major components:
- Context clip definition
.DEF
files in theContext
folder - User Highlighter definition
.INI
files in theSyntax
folder - New file template
Default.[fileExtension]
files in theTemplate
folder - Language compiler settings and supported parameters
Context clip definition files
What are clips?
This is PSPad's crude attempt at implementing real Intellisense. You invoke it by Pressing Shf-Ctrl-Space. Every clip consists of a name, a description and statement or parameter syntax. The name and description is displayed in the clip list that pops up when you invoke it. Choose a line, press Enter, and the selected clip's content is inserted at the cursor position. The content of a clip can be an unlimited number of lines and the structure of the clip in the definition is kept when it is inserted into your file.
Clip Definition File Format
.DEF
file syntax: [name |x description]*shortcut. Lines beginning with a semicolon (;) are comments and are ignored.
- [Â - This a required character.
- name - This is the name of the clip that will appear in the clip list and will appear in a bold font.
- |Â - This is a required character that separates the clip name from the description.
- XÂ - This (optional) character sets the colour that the clip entry will appear as in the list.
Choose one of:- MÂ - Maroon
- RÂ - Red
- NÂ - Navy
- BÂ - Blue
- PÂ - Purple
- FÂ - Fuchsia
- GÂ - Green
- DÂ - Dark gray
- *Â - This character is optional and is only required if a shortcut or hotkey is to be defined for the clip.
- Shortcut - This entry is only required if a shortcut or hotkey is defined. If multiple keys are required for the hotkey then they should be key1+key2. (See Keyboard commands)
The clip content starts on the line immediately after the definition and continues until the start of the next definition or the end of the file.
The content is entered into your file exactly as it is entered here. There are 2 special characters that you can use in your content; | and § (ALT+167). When your clip is used the cursor will be placed at the position occupied by the | character. If you include this character more than once in your clip content then only the first position will be used. If you have any text highlighted in your file when you call the clip and the clip's content includes the § character then that character will replace the selected text. You can use the § character multiple times; each occurrence will be replaced with the selected text in your file.
You can add comments to the clip definition by starting the line with a semicolon ;. If your clip content needs to include a line that starts with a colon, enter two colons ;;.
Note: You cannot have a line in your clip content that starts with the open square bracket, [ character as this marks the beginning of the next clip definition.
Example:
[Alert Alert]*Ctrl+Alt+A|
alert("§|");
User Highlighter definition files
What are User Highlighters?
User highlighter .INI
files implement PSPad's syntax highlighting. When you finish typing a language keyword,
for example, PSPad will let you know that you spelled it correctly by coloring the word.
User Highlighter file format
;PSPad user highLighter definition file. Uncommented entries mean they are obvious or undocumented
[Settings]
Name=VBscript.NET
HTMLGroup=0
Label=1
FileType=*.dsh
CommentString='
; list of allowed comment delimiters
SlashComment=1
REMComment=1
Preprocessors=1
IndentChar=
UnIndentChar=
TabWidth=2
DoubleQuote=1
EscString=1
EscChar=\
KeyWordChars=
; last 3 characters are the file extension
CodeExplorer=ftDSH
DocComment=
; You must include the equals sign (=) at the end of each word
[KeyWords]
AddHandler=
AddressOf=
Alias=
And=
AndAlso=
Ansi=
As=
Assembly=
Auto=
Binary=
ByRef=
ByVal=
Call=
Case=
Catch=
[ReservedWords]
Array=
ArrayList=
BaseDataList=
Boolean=
Template files
Language Compiler Settings in the PSPAD.INI File and Supported Compiler Parameters
; Comments are ignored. Uncommented lines are either obvious or undocumented. [Windows Shell Script] Filter=Windows shell script (*.cmd;*.bat;*.nt)|*.cmd;*.bat;*.nt ; these 2 lines mean indent with 2 spaces HLTabWidth=2 HLRealTabs=0 RightEdge=0 IndentChar= UnIndentChar= DocComment= ; the full path of the compiler executable Compilator File=cmd.exe ; compiler parameters. These can get tricky to get right. See below for a complete list of them. Compilator Param=| /c %File%| Compilator LOG= Compilator Run= Compilator Help= Compilator SaveAll=0 Compilator ParsLog= ; set to 1 to get the STDOUT of the compiler Compilator Capture=1 Compilator HideOutput=0 ; set to 1 so save all files before compiling Compilator ProgSaveAll=1 Compilator DefaultDir= [...]
List of Supported Compiler Parameters
%File%
Full path name, including drive specifier, of current file.
Example:
C:\MyProg.exe "%File%"
Becomes:
C:\MyProg.exe "C:\Documents and Settings\user\This File.txt"
%Dir%
Full path, including drive specifier, of directory in which current file is saved.
Example:
C:\MyProg.exe -o "%Dir%" ...
Becomes:
C:\MyProg.exe -o "C:\Documents and Settings\user\"
%DosFile%
Short path name, including drive specifier, of current file.
Example:
C:\MyProg.exe "%File%"
Becomes:
C:\MyProg.exe "C:\DOCUME~1\user\MYDOCU~1\ThisFi~1.txt"
%DosDir%
Full short< path, including drive specifier, of directory in which current file is saved.
Example:
C:\MyProg.exe -o "%Dir%" ...
Becomes:
C:\MyProg.exe -o "C:\DOCUME~1\user\MYDOCU~1\"
%Name%
Name, without extension, of current file.
Example:
C:\MyProg.exe "%Name%"
Becomes:
C:\MyProg.exe "This File"
%Ext%
Extension of current file name.
Example:
C:\MyProg.exe -e %Ext%
Becomes:
C:\MyProg.exe -e .txt
%Project%
Current project name.
Example:
C:\MyProg.exe -p "%Project%"
Becomes:
C:\MyProg.exe -p "New Project"
%ProjectDir%
Current project file path.
Example:
C:\MyProg.exe -p "%ProjectDir%"
Becomes:
C:\MyProg.exe -p "c:\projectfile.ppr"
%PSPath%
PSPad application path.
Example:
C:\MyProg.exe -p "%PSPath%"
Becomes:
C:\MyProg.exe -p "C:\Program Files\PSPad\"
%URLFile%
Full path name, including drive specifier, of current file preceded by "file://localhost/"
Example:
C:\MyProg.exe "%URLFile%"
Becomes:
C:\MyProg.exe "file://localhost/C:/Documents and Settings/user/This File.txt"
%HttpFile%
Full path name, including drive specifier, of current file preceded by "http://localhost/"
Example:
C:\MyProg.exe "%HttpFile%"
Becomes:
C:\MyProg.exe "http://localhost/C:/Documents and Settings/user/This File.txt"
%PHPFile%
If start of path of current file matches value of setting in "Settings > Program Settings > Internet > Document Root" then the variable will be replaced with the value "http://localhost/" + the path relative to Document Root. Otherwise variable equates to %File%.
Example:
Assume the Document Root is set to "C:\Inetpub\wwwroot" and the current file path is "C:\Inetpub\wwwroot\test.htm" C:\MyProg.exe "%PHPFile%"
Becomes:
C:\MyProg.exe "http://localhost/MySite/text.htm"
%SelText%
Currently selected text.
%Input%
Prompt user to enter value.
Note: If "Cancel" is pressed when prompt is displayed, command will not be run. To run command with no value, delete any text in prompt's input box and press "OK"%Word%
Word at current cursor position.
%Line%
Line number of current cursor position.
%AppData%
Path where applications store data by default.
%HomePath%
Path to the user's home directory.
Example:
C:\MyProg.exe -p "%HomePath%"
Becomes:
C:\MyProg.exe -p "\Documents and Settings\UserName"
%Temp%
Default temporary directory used by applications for current user.
Example:
C:\MyProg.exe -p "%Temp%"
Becomes:
C:\MyProg.exe -p "C:\DOCUME~1\UserName\LOCALS~1\Temp"
%UserProfile%
Path of profile for current user.
Example:
C:\MyProg.exe -p "%UserProfile%"
Becomes:
C:\MyProg.exe -p "C:\Documents and Settings\UserName"
%WinDir%
Path of operating system directory.
Example:
C:\MyProg.exe -p "%WinDir%"
Becomes:
C:\MyProg.exe -p "C:\WINDOWS"