PS-SyntaxDoc for RemObjects Pascal Script
PS-SyntaxDoc is a documentation generator for RemObjects Pascal Script engine.
It supports various documentation modes, from a simple syntax overview, to the SynEdit code-completion templates and XML output.
RemObjects Pascal Script is a popular scripting engine for Delphi developers, that is widely used and very well-rated.
PS-SyntaxDoc is an extension for this scripting engine, that lets you generate a full description of the syntax of your scripting interface and provide your developers and end-users with a better overview of the possibilities of your product.
How to use it:
PS-SyntaxDoc generator is declared as a Delphi function named MakePSSyntaxDoc, located in the unit "psSyntaxDoc.pas". You can find this file inside the distribution ZIP archive.
The usage is very simple, because you only need to call the MakePSSyntaxDoc function from within the OnBeforeOutput event of your TPSScript component's compiler object.
1. Add the "psSyntaxDoc" unit to the uses clause of your program.
2. Define the following function somewhere in your program:
function psCompilerBeforeOutput(Sender: TPSPascalCompiler): Boolean; var s:string; begin Result:=True; if MakePSSyntaxDoc(Sender, s, sdmXml) then with TStringList.create do begin Text := s; SaveToFile('C:\Temp\MySyntax.xml'); Free; end; end;
3. Assign this function to an OnBeforeOutput event of TPSScript component's compiler:
MyPSScript.Comp.OnBeforeOutput := psCompilerBeforeOutput;
And that's all. Now the syntax documentation is generated every time you compile your script and it is saved into the MySyntax.xml file.
Of course, you can define your own processing conditions, but the generation (performed by the MakePSSyntaxDoc function) must be executed from within the mentioned OnBeforeOutput event.
See the parameters of MakePSSyntaxDoc function to learn more about syntax generation options (such as documentation mode and filtering options).
A few outputs of this generator are available in a "Samples" folder of the distribution ZIP archive. These are the outputs of documentation for product "pdScript", that is available on our site too.
To create documentation in HTML format, use the XML output mode and transform it by an XSLT template. The distribution package contains a sample template "Xslt\PascalScript.xsl" (requires MSXML).
The PS-SyntaxDoc has been tested on Delphi version 2009, but it should work also on all newer versions (and with some small modifications also on the previous versions from Delphi 7 to 2007). If you will have any suggestions, ideas or problems with using it, please feel free to contact us.
PS-SyntaxDoc is distributed as a FREEWARE WITH SOURCE. This source code can be freely used in any application.