INCLAN: syntax: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
m (1 revision)
No edit summary
Line 1: Line 1:
== Synopsis ==


Usage: syntax {''format''}
syntax {''format''}
 
== Description ==


The statement "syntax" analyzes the command line parameters of the  
The statement "syntax" analyzes the command line parameters of the  
Line 7: Line 10:
cations are removed from the list of command line parameters and  
cations are removed from the list of command line parameters and  
assigned to a new local variable.
assigned to a new local variable.
Possible ''format'' items are:
Possible ''format'' items are:


  ''name''=[=]''type''[=''default'']   named parameter with the given ''name'',
;''name''=[=]''type''[=''default'']: named parameter with the given ''name'', ''type'', and, optionally, ''default''
                                ''type'', and, optionally, ''default''


  ''name''{|''name''}               literal option with the ''name'', or
;''name''{|''name''}: literal option with the ''name'', or one out of a mutually exclusive list of names
                                one out of a mutually exclusive list
                                of names


  **                             allows for additional parameters that
;**: allows for additional parameters that do not match with one of the ''formats''
                                do not match with one of the ''formats''


  *                             same as "**" except that additional
;*: same as "**" except that additional parameters must not contain an "=" sign
                                parameters must not contain an "=" sign


A ''format'' must not contain blanks. A ''name'' may contain a "*" to  
A ''format'' must not contain blanks. A ''name'' may contain a "*" to  

Revision as of 10:42, 30 January 2009

Synopsis

syntax {format}

Description

The statement "syntax" analyzes the command line parameters of the current macro. This statement can only be called within a macro. Command line parameters that match with one of the format specifi- cations are removed from the list of command line parameters and assigned to a new local variable.

Possible format items are:

name=[=]type[=default]
named parameter with the given name, type, and, optionally, default
name{|name}
literal option with the name, or one out of a mutually exclusive list of names
    • allows for additional parameters that do not match with one of the formats
  • same as "**" except that additional parameters must not contain an "=" sign

A format must not contain blanks. A name may contain a "*" to indicate how much it can be abbreviated. By default, all unambiguous abbreviations are allowed. The optional second "=" sign after a name indicates that a parameter that matches name but doesnt contain an "=" sign is not recognized, otherwise (with one "=" sign after name, an error occurs in this situation). Parameters that appear before "*" or "**" can be specified as positional parameters without giving their name; parameters following "*" or "**" must always be given with their name. A type can be one of the following:

 *                             anything
 [limit'[=]]@i[[=]limit]  integer expression in given range
 [limit'[=]]@r[[=]limit]  real expression in given range
 name{|name}               list of mutually exclusive literals
 @fextension                 a filename that will be extended with
                               the given extension, if necessary
                               (extension can also be $name to 
                               denote the value of a preceding 
                               parameter)