Try OpenEdge Now
skip to main content
Object-oriented Programming
Preface : Examples of syntax descriptions
 

Examples of syntax descriptions

In this example, ACCUM is a keyword, and aggregate and expression are variables:

Syntax

ACCUM aggregate expression
FOR is one of the statements that can end with either a period or a colon, as in this example:
FOR EACH Customer NO-LOCK:
  DISPLAY Customer.Name.
END.
In this example, STREAM stream, UNLESS-HIDDEN, and NO-ERROR are optional:

Syntax

DISPLAY [ STREAM stream ] [ UNLESS-HIDDEN ] [ NO-ERROR ]
In this example, the outer (small) brackets are part of the language, and the inner (large) brackets denote an optional item:

Syntax

INITIAL [ constant [ , constant ] ]
A called external procedure must use braces when referencing compile-time arguments passed by a calling procedure, as shown in this example:

Syntax

{ &argument-name }
In this example, EACH, FIRST, and LAST are optional, but you can choose only one of them:

Syntax

PRESELECT [ EACH | FIRST | LAST ] record-phrase
In this example, you must include two expressions, and optionally you can include more. Multiple expressions are separated by commas:

Syntax

MAXIMUM ( expression , expression [ , expression ] ... )
In this example, you must specify MESSAGE and at least one expression or SKIP [ ( n ) ], and any number of additional expression or SKIP [ ( n ) ] is allowed:

Syntax

MESSAGE { expression | SKIP [ ( n ) ] } ...
In this example, you must specify {include-file, then optionally any number of argument or &argument-name = "argument-value", and then terminate with }:

Syntax

{ include-file
    [ argument | &argument-name = "argument-value" ] ... }
* Long syntax descriptions split across lines
* Complex syntax descriptions with both required and optional elements