Difference between revisions of "LavishScript:Syntax"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 19: Line 19:
  
 
== Parameters ==
 
== Parameters ==
Parameters are words separated by spaces.  If an individual parameter must itself include a space, or certain special characters should not be interpreted as part of a complex command, double quotes (<tt>"</tt>) should be used around the parameter.  Data are valid in any parameter, and will be processed (potentially becoming multiple parameters) unless the command name indicates a command that instructs otherwise (in which case the data will be treated as a single word).  If data are parsed, they will be replaced with the "To String" value of the final resulting object.
+
Parameters are words separated by spaces.  If an individual parameter must itself include a space, or certain special characters should not be interpreted as part of a complex command, double quotes (<tt>"</tt>) should be used around the parameter.  Data are valid in any parameter, and will be processed (potentially becoming multiple parameters) unless the command name indicates a command that instructs otherwise (in which case the data will be treated as a single word).  If data are processed, they will be replaced with the "To String" value of the final resulting object.
  
 
== Data ==
 
== Data ==

Revision as of 06:25, 24 February 2005

Simple Command

A Simple Command is made up of a Command Name, and any Parameters given to it. Parameters are optional.

Possible forms are as follows

  • <Command Name>
  • <Command Name> [Parameters]

Examples

LSVersion

In this example, "LSVersion" is the Command Name

DeclareVariable MyBool bool local false

In this example, "DeclareVariable" is the Command Name, and "MyBool bool local false" are the parameters

Command Name

A command name is a single word. The only "special" character that has any effect in a command name is [, which will be used as an Index, for use with data methods. Quotes do not have an effect on spaces, as they would with parameters or indices, but will be stripped if they surround the single word. Data are not processed as part of the command name.

If the command name is found to contain a :, the command name is assumed to be that of a data method. In such cases, any parameters following the command are ignored, and the command is considered successful, whether or not the method is successfully processed.

If the command name is not assumed to be a method, it will first be checked for a matching alias, and then for an actual command. Aliases must match completely, though actual commands can be shortened and will resolve to the first matching command alphabetically.

Parameters

Parameters are words separated by spaces. If an individual parameter must itself include a space, or certain special characters should not be interpreted as part of a complex command, double quotes (") should be used around the parameter. Data are valid in any parameter, and will be processed (potentially becoming multiple parameters) unless the command name indicates a command that instructs otherwise (in which case the data will be treated as a single word). If data are processed, they will be replaced with the "To String" value of the final resulting object.

Data

Data begin with ${ and end with }. Inside this, possible forms are as follows:

  • <Object>
  • <Object>.<Member>
  • <Object>:<Method>
  • <Object>(cast)
  • <Object>[Index]

These forms are recursive. Every Member, Method, or cast results in an Object for which the form can be continued. Indices have special rules, as described below.

Indices

Indices begin with [ and end with ]. Inside this, each dimension is described and separated by a comma. If a comma or ] must be used within a single dimension, double quotes (") are used around the dimension. Dimensions are interpreted as dimensions for arrays, or individual parameters where applicable. Data are processed in indices (possibly becoming multiple dimensions if the result contains a comma), unless used in a parameter to a command that instructs otherwise (in which case the data will be processed as a term in a single dimension).

Complex Command

Complex commands are commands and their parameters, with other special possibilities such as command lists, "pipelining" and input and output redirection.

A Pipeline has the following possible forms:

  • <Simple Command>
  • <Simple Command> < file.txt
  • <Simple Command> > file.txt
  • <Simple Command> >> file.txt
  • <Simple Command>|<Simple Command>

(or any mix of < > >> and | forms, which will be interpreted left to right) A Command List is described as follows:

  • <Pipeline>;<Pipeline>

Command lists are interpreted from left to right