![]() | ![]() | ![]() | ![]() | ![]() |
Switch /Syntax:Spec |
This is a PPWIZARD command line switch. You can set up your own default switches in the "PPWIZARD_OPTIONS" environment variable or in project files.
For some output extensions or file types PPWIZARD automatically checks the syntax of the generated files. You can turn this off, on, or tweek the output using this switch.
The syntax checking typically works by executing code which returns a specific return code if a certain 'unusual' parameter is passed. REXX, VBS and some other languages go through a loading step where syntax is validated, if this fails the code will never get executed. This is why we add a little stub to return a specific return code. The stub does not get in the way because if is never accidently invoked.
If you use this switch you will probably want to also use "/DeleteOnError:NO", so you can examine the code if an error is detected.
The first and last characters of the "Spec" defines the delimiter being used to delimit the following values:
Note that currently rexx code gets checked by an alternative method, there is also no mechanism to turn off on the #output command.
Use of Header File |
If the test command value starts with '@' and there is no return code or lines then this indicates that a file should be read to create the stub code and set the command and expected return code values.
If your header file included conditional generation of the header based on the extension of the output file then it could make sense to use a "*" rule.
You header should output the syntax checking stub and should also set these rexx variables:
Examples |
The following shows how syntax checking for files with the extension ".VBS" can be turned off:
/syntax:~/VBS/~
The following shows how a file can be included to add syntax checking code for multiple extensions (first removes existing VBS code):
/syntax:~/VBS/~ /syntax:~/*/@c:\tmp\syntax.h~
The following is an example of what the "hyntax.h" file could look like:
;--- Determine what we wish to do ------------------------------------------- #NextId #info 'in syntax.h' #DefineRexx '' ;---- Get extension (if not unix then make upper case) ------------------- @@Extn = _filespec('EXTN', '<?OutputFile>'); #if ['<?OpSys>' <> 'UNIX'] @@Extn = translate(@@Extn); ;;Make upper case #endif ;---- Want a comment? --- select ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% when @@EXTN = "VBS" then ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% do ;--- VB SCRIPT --- @@Code = 'if Wscript.Arguments.Count = 1 then if Wscript.Arguments(0) = "!CheckSyntax!" then wscript.quit(21924)'; OutSyntaxRc = '21924'; OutSyntaxCmd = 'cscript.exe "{?}" //NOLOGO !CheckSyntax!' OutSyntaxMsg = "Note that you must not use VBSCRIPT's OPTION command without modifying or disabling the syntax checking code!"; end; ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% otherwise ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% do ;--- Don't want any syntax checking code --- @@Code = ''; ;--- Return reserved variables with "empty" values --- OutSyntaxRc = ''; OutSyntaxCmd = ''; OutSyntaxMsg = ''; end; end #DefineRexx ;--- Any syntax checking code to generate? ---------------------------------*/ #if [@@Code <> ''] ;--- This code returns a specific return code when passed specific parameter --- <??@@Code> #endif
If you add any extensions (Perl etc) please consider sending them to me so I can update the documentation fo others.
![]() | ![]() | ![]() | ![]() | ![]() |