PeopleCode Syntax Quick Reference
Typographical Conventions
The following topic describes typographical conventions that apply to PeopleCode and are used throughout PeopleSoft documentation:Typographical Conventions
PeopleCode Syntax
The following table describes the complete syntax for the PeopleCode language:
| 
 Term  | 
 Syntax  | 
|---|---|
| 
 Program  | 
 ImportList (DeclList TopStList | ClassDefn )  | 
| 
 ImportList  | 
 [ ImportDecl ‘;’ ]...  | 
| 
 ImportDecl  | 
 ‘import’ PackageName [ ‘:’ ‘*’ ]  | 
| 
 PackageName  | 
 Id [ ‘:’ Id ]...  | 
| 
 ClassDefn  | 
 ClassDecl [ ‘;’ ExtDecls ] [ ‘;’ MethodDefns ]  | 
| 
 ClassDecl  | 
 ‘class’| ‘interface’' Id [ Extends ] [ ClassPublics ] [ ClassProtecteds ] [ ClassPrivates ] ‘end-class’ | ‘end-interface’  | 
| 
 Extends  | 
 ‘extends’ | ‘implements’ QualifiedId  | 
| 
 QualifiedId  | 
 [ PackageName ‘:’ ] Id  | 
| 
 ClassPublics  | 
 ClassPublic [ ‘;’ ClassPublic ]...  | 
| 
 ClassPublic  | 
 MethodDecl | PropertyDecl  | 
| 
 MethodDecl  | 
 ‘method’ Id ‘(’ [ MethodParameters ] ‘)’ [ 'abstract' ] [ ‘returns’ PeopleCodeType ]  | 
| 
 MethodParameters  | 
 MethodParameter [ ‘,’ MethodParameter ]...  | 
| 
 MethodParameter  | 
 ‘&’ Id ‘as’ PeopleCodeType [ ‘out’ ]  | 
| 
 PropertyDecl  | 
 ‘property’ PeopleCodeType Id [ (‘get’ [ ‘set’ ] | 'abstract' ) | ‘readonly’ ]  | 
| 
 ClassPrivates  | 
 ‘private’ [ ClassPrivate [ ‘;’ ClassPrivate ]... ]  | 
| 
 ClassPrivate  | 
 MethodDecl | InstanceDecl | ConstantDecl  | 
| 
 ClassProtecteds  | 
 ‘protected’ [ ClassProtected [ ‘;’ ClassProtected ]... ]  | 
| 
 ClassProtected  | 
 MethodDecl | InstanceDecl | ConstantDecl  | 
| 
 InstanceDecl  | 
 ‘instance’ VarDeclare  | 
| 
 ExtDecls  | 
 ExtDecl [ ‘;’ ExtDecl ]...  | 
| 
 MethodDefns  | 
 MethodDefn [ ‘;’ MethodDefn ]...  | 
| 
 MethodDefn  | 
 MethodMethod | GetMethod | SetMethod  | 
| 
 MethodMethod  | 
 ‘method’ Id StList ‘end-method’  | 
| 
 GetMethod  | 
 ‘get’ Id StList ‘end-get’  | 
| 
 SetMethod  | 
 ‘set’ Id StList ‘end-set’  | 
| 
 TopStList  | 
 TopStmt [ ‘;’ TopStmt ]...  | 
| 
 TopStmt  | 
 Stmt  | 
| 
 StList  | 
 Stmt [ ‘;’ Stmt ]...  | 
| 
 Stme  | 
 [ LValue [ Assign ] | If | Evaluate | While | Repeat | For | Accept | Break | Return | Exit | Error | Warning | Try | Throw | LocalDecl ]  | 
| 
 Assign  | 
 ‘=’ Expression  | 
| 
 If  | 
 ‘if’ LogicalExpression ‘then’ StList [ ‘else’ StList ] ‘end-if’  | 
| 
 Evaluate  | 
 ‘evaluate’ Expression [ WhenExpr... StList ]... [ ‘when-other’ StList ] ‘end-evaluate’  | 
| 
 WhenExpr  | 
 ‘when’ [ RelOp ] Expression  | 
| 
 While  | 
 ‘while’ LogicalExpression StList ‘end-while’  | 
| 
 Repeat  | 
 ‘repeat’ StList ‘until’ LogicalExpression  | 
| 
 For  | 
 ‘for’ Variable ‘=’ Expression ‘to’ Expression [ ‘step’ Expression ] StList ‘end-for’  | 
| 
 Accept  | 
 ‘accept’  | 
| 
 Return  | 
 ‘return’ [ Expression ]  | 
| 
 Break  | 
 ‘break'  | 
| 
 Exit  | 
 ‘exit’ [ Expression ]  | 
| 
 Warning  | 
 ‘warning’ Expression  | 
| 
 Error  | 
 ‘error’ Expression  | 
| 
 Try  | 
 ‘try’ StList ( ‘catch’ QualifiedId ‘&’ Id StList )... ‘end-try’  | 
| 
 Throw  | 
 ‘throw’ Expresssion  | 
| 
 LocalDecl  | 
 ‘local’ PeopleCodeType ‘&’ Id [ ( ',' ‘&’ Id)... | ‘=’ Expression ]  | 
| 
 Continue  | 
 'Continue'  | 
| 
 LogicalExpression  | 
 LogicalTerm [ ‘or’ LogicalTerm ]...  | 
| 
 LogicalTerm  | 
 Relation [ ‘and’ Relation ]...  | 
| 
 Relation  | 
 ‘not’ Relation | Expression [ Relop Expression ]  | 
| 
 Relop  | 
 ‘not’ Relop | ‘<’ | ‘<=’ | ‘=’ | ‘>=’ | ‘>’ | ‘!=’ | ‘<>’  | 
| 
 Expression  | 
 Term [ ( ‘+’ | ‘-’ | ‘|’ ) Term ]...  | 
| 
 Term  | 
 Power [ ( ‘*’ | ‘/’ ) Power ]...  | 
| 
 Power  | 
 Primary [ ‘**’ Primary ]...  | 
| 
 Primary  | 
 LValue [ ‘as’ QualifiedId ] | Number | String | ‘true’ | ‘false’ | 'null' | ‘-’ Primary | ‘create’ QualifiedId Call  | 
| 
 LValue  | 
 LValueStart [ LValueObject | LValueSubscript ]...  | 
| 
 LValueStart  | 
 Variable | Id Call | '@' Primary | '%' BuiltinVar | ‘(’ LogicalExpression ‘)’  | 
| 
 LValueObject  | 
 '.' Id [ Call ] | Call  | 
| 
 LValueSubscript  | 
 '[' Expression [ ',' Expression ]... ']'  | 
| 
 Variable  | 
 ‘&’ Id | Id [ ‘.’ ( Id | String ) ] | ‘^’  | 
| 
 Call  | 
 ‘(’ [ Expression [ ‘,’ Expression ]... ] ‘)’  | 
| 
 Constant  | 
 Number | String | ‘true’ | ‘false’ | 'null' | QualifiedId ‘:’ Id  | 
| 
 DecList  | 
 [ Decl ‘;’ ]...  | 
| 
 Decl  | 
 ‘local’ VarDeclare | ‘function’ Function | ConstDecl | ExtDecl  | 
| 
 VarDeclare  | 
 PeopleCodeType ‘&’ Id [ ‘,’ ‘&’ Id ]...  | 
| 
 Function  | 
 Id [ ‘(’ InternalParameters ‘)’ ] [ ‘returns’ PeopleCodeType ] [ ‘noexport’ ] [ ‘doc’ String ] TopStList ‘end-function’  | 
| 
 InternalParameters  | 
 [ InternalParameter [ ‘,’ InternalParameter ]... ]  | 
| 
 InternalParameter  | 
 ‘&’ Id [ ‘as’ PeopleCodeType ]  | 
| 
 ConstDecl  | 
 ‘constant’ ‘&’ Id ‘=’ ( Number | String | ‘true’ | ‘false’ | 'null' )  | 
| 
 ExtDecl  | 
 ‘global’ VarDeclare | ‘component’ VarDeclare | ‘declare’ Declare  | 
| 
 Declare  | 
 ‘function’ Id ( ‘library’ DeclareLibrary | ‘peoplecode’ DeclarePC )  | 
| 
 DeclareLibrary  | 
 String [ ‘alias’ String ] [ ‘(’ ExternalParameters ‘)’ ] [ ‘returns’ ExternalType [ ‘as’ PeopleCodeType ] ]  | 
| 
 ExternalParameters  | 
 [ ExternalParameter [ ‘,’ ExternalParameter ]... ]  | 
| 
 ExternalParameter  | 
 ExternalType [ ‘value’ | ‘ref’ ] [ ‘as’ PeopleCodeType ]  | 
| 
 DeclarePC  | 
 Variable EventType  | 
| 
 PeopleCode Type  | 
 [ ‘array’ ‘of’ ]... ( ‘number’ | ‘string’ | ‘date’ | ‘time’ | ‘datetime’ | ‘any’ | ‘boolean’ | ‘object’ | ‘array’ | ‘integer’ | ‘float’ | QualifiedId )  | 
| 
 ExternalType  | 
 ‘boolean’ | ‘integer’ | ‘long’ | ‘uinteger’ | ‘ulong’ | ‘string’ | ‘lstring’ | ‘ustring’ | ‘float’ | ‘double’  |