Difference between revisions of "LavishScript:Syntax"

From Lavish Software Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
== Overview ==
+
== Simple Command ==
LavishScript syntax is broken into several separate sections, each with their own syntax.
+
A Simple Command is made up of a Command Name, and any Parameters given to it.  Parameters are ''optional''.
* Command
 
: A full command is made up of the actual command and parametersThis describes the syntax for the actual command.
 
* Parameters
 
: Parameters are the complement to a command, providing the command with extra information such as a search string or a message to send to a chat channel
 
* Data
 
: Data consists of [[LavishScript:Top-Level Objects|Top-Level Objects]], [[LavishScript:Data Types|Data Type]] members and methods, and indices
 
* Index
 
: Indices are used inside Data and by certain specific commands
 
  
== Comamnd ==
+
Possible forms are as follows
 +
*<tt><Command Name></tt><br>
 +
*<tt><Command Name> [Parameters]</tt>
 +
=== Examples ===
 +
<tt>LSVersion</tt>
 +
In this example, "LSVersion" is the Command Name
 +
<tt>DeclareVariable MyBool bool local false</tt>
 +
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 <tt>[</tt>, 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 <tt>:</tt>, 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 ==
 +
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 parsed (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.
  
 
== Data ==
 
== Data ==
 +
Data begin with <tt>${</tt> and end with <tt>}</tt>.  Inside this, possible forms are as follows:
 +
*<tt><Object></tt>
 +
*<tt><Object>'''.'''<Member></tt>
 +
*<tt><Object>''':'''<Method></tt>
 +
*<tt><Object>'''('''cast''')'''</tt>
 +
*<tt><Object>'''['''Index''']'''</tt>
 +
These forms are <tt>recursive</tt>.  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 <tt>[</tt> and end with <tt>]</tt>.  Inside this, each ''dimension'' is described and separated by a comma.  If a comma or ] must be used within a single dimension, double quotes (<tt>"</tt>) are used around the dimension.  Dimensions are interpreted as dimensions for arrays, or individual parameters where applicable.
 +
 +
== Complex Command ==
 +
Complex commands are commands and their parameters, with other special possibilities such as command lists, "pipelining" and input and output redirection.
  
== Index ==
+
A Pipeline has the following possible forms:
 +
*<tt><Simple Command></tt>
 +
*<tt><Simple Command> '''<''' file.txt</tt>
 +
*<tt><Simple Command> '''>''' file.txt</tt>
 +
*<tt><Simple Command> '''>>''' file.txt</tt>
 +
*<tt><Simple Command>'''|'''<Simple Command></tt>
 +
(or any mix of < > >> and | forms, which will be interpreted left to right)
 +
A Command List is described as follows:
 +
*<tt><Pipeline>;<Pipeline></tt>
 +
Command lists are interpreted from left to right

Revision as of 06:22, 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 parsed (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.

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.

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