Navigation:  Software Configuration Tab > General Configuration > Crew Pricing > Scripted Crew Method >

Pascal

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text
hmtoggle_plus1Syntax

Program -> [PROGRAM Ident ';']

          [UsesClause]        

          Block '.'          

 

UsesClause -> USES (String/,)... ';'

 

Block -> [DeclSection]...  

        CompoundStmt      

 

DeclSection -> ConstSection        

           -> VarSection          

           -> ProcedureDeclSection

 

ConstSection -> CONST (ConstantDecl)...

 

ConstantDecl -> Ident '=' Expression ';'

 

VarSection -> VAR (VarList ';')...

 

VarList -> Ident/','... ':' TypeIdent [InitValue]

 

TypeIdent -> Ident  

         -> Array  

 

Array -> ARRAY '[' ArrayDim/','... ']' OF Ident  

 

ArrayDim -> Expression..Expression  

        -> Expression              

 

InitValue -> '=' Expression  

 

Expression -> SimpleExpression [RelOp SimpleExpression]...

 

SimpleExpression -> ['-'] Term [AddOp Term]...

 

Term -> Factor [MulOp Factor]...

 

Factor -> Designator                    

      -> UnsignedNumber                

      -> String                        

      -> '(' Expression ')'            

      -> NOT Factor                    

      -> '[' SetConstructor ']'        

 

SetConstructor -> SetNode/','...  

 

 

SetNode -> Expression ['..' Expression]  

 

RelOp -> '>'  

     -> '<'  

     -> '<='  

     -> '>='  

     -> '<>'  

     -> '='  

     -> IN    

     -> IS    

 

AddOp -> '+'  

     -> '-'  

     -> OR  

     -> XOR  

 

MulOp -> '*'

     -> '/'    

     -> DIV    

     -> MOD    

     -> AND

     -> SHL    

     -> SHR    

 

Designator -> ['@'] Ident ['.' Ident | '[' ExprList ']' | '(' ExprList ')']...  

 

ExprList -> Expression/','...  

 

Statement -> [SimpleStatement | StructStmt]  

 

StmtList -> Statement/';'...  

 

SimpleStatement -> Designator                    

               -> Designator ':=' Expression    

               -> BREAK | CONTINUE | EXIT        

 

StructStmt -> CompoundStmt        

          -> ConditionalStmt    

          -> LoopStmt            

          -> TryStmt            

          -> WithStmt            

 

CompoundStmt -> BEGIN StmtList END  

 

ConditionalStmt -> IfStmt    

               -> CaseStmt  

 

IfStmt -> IF Expression THEN Statement [ELSE Statement]

 

CaseStmt -> CASE Expression OF CaseSelector/';'... [ELSE Statement] [';'] END  

 

CaseSelector -> SetConstructor ':' Statement

 

LoopStmt -> RepeatStmt  

        -> WhileStmt  

        -> ForStmt    

 

RepeatStmt -> REPEAT StmtList UNTIL Expression  

 

WhileStmt -> WHILE Expression DO Statement  

 

ForStmt -> FOR Ident ':=' Expression ToDownto Expression DO Statement  

 

ToDownto -> (TO | DOWNTO)  

 

TryStmt -> TRY StmtList (FINALLY | EXCEPT) StmtList END  

 

WithStmt -> WITH (Designator/,..) DO Statement  

 

ProcedureDeclSection -> ProcedureDecl  

                    -> FunctionDecl  

 

ProcedureDecl -> ProcedureHeading ';'  

                Block ';'            

 

ProcedureHeading -> PROCEDURE Ident [FormalParameters]  

 

FunctionDecl -> FunctionHeading ';'  

               Block ';'

 

FunctionHeading -> FUNCTION Ident [FormalParameters] ':' Ident

 

FormalParameters -> '(' FormalParam/';'... ')'

 

FormalParm -> [VAR | CONST] VarList

hmtoggle_plus1Structure

The PascalScript structure is the same as in Object Pascal language:

 

#language PascalScript // this is optional

program MyProgram;     // this is optional

 

var                    // var section

 i, j: Integer;

 

const                  // const section

 pi = 3.14159;

 

procedure p1;          // procedures and function

var

 i: Integer;

 

 procedure p2;        // nested procedure

 begin

 end;

 

begin

end;

 

begin                  // main procedure that will be executed.

end.

hmtoggle_plus1Data Types

PascalScript maps some types to standard types:

Byte      | Same as Integer type

Word      |

Integer   |

Longint   |

Cardinal  |

TColor    |

 

Boolean   | Boolean type

 

Real      | Same as Extended type

Single    |

Double    |

Extended  |

TDate     |

TTime     |

TDateTime |

 

Char      | Char type

 

String    | String type

 

Variant   | Same as Variant type

Pointer   |

 

Array     | Array type

Note: Not all of these types can be assign-compatible. Like in Object Pascal, you can't assign Extended or String to an Integer. Only one type - the Variant - can be assigned to all the types and can get value from any type.