IDL includes the following tokens:
IDL ignores white space, including spaces, horizontal and vertical tabs, newlines, form feeds, and comments, except where necessary to separate tokens.
A comment is used for program description. You can include comments in two forms in IDL:
/* This is a comment. */
You can also use line comments that start with a doubleslash (//) and end at the end of the line:
//This is also a comment.
An identifier is a sequence of alphabetic (a-z, A-Z) and numeric (0-9) characters. Identifiers can include underscores. Identifiers must start with an alphabetic character, are case sensitive, and can be of any length. Two identifiers that differ only in case cannot both appear within the same scope of an IDL.
The following words are reserved keywords in IDL and must be written exactly as shown.
any | double | interface | raises | typedef |
attribute | enum | long | readonly | unsigned |
boolean | exception | module | sequence | union |
case | FALSE | native | short | void |
char | fixed | Object | string | wchar |
const | float | octet | strstruct | wstring |
context | in | oneway | switch | |
default | inout | out | TRUE |
Literals can be categorized as follows:
Integer literals are sequences of one or more digits.
First number | Indicates the number is | Example |
---|---|---|
1-9 | Decimal | 16 |
0 | Octal | 020 |
0x or 0X | Hexadecimal | 0x10 |
A character literal is one or more characters (alphabetic, digit, space, formatting literal, graphic literal, or nongraphic literal) enclosed by single quotes, such as 'x'. The character literal, which has type char
, is an 8-bit quantity. You must use escape-sequence patterns for the following characters:
Description | Escape Sequence |
---|---|
newline | /n |
horizontal tab | /t |
vertical tab | /v |
backspace | /b |
carriage return | /r |
form feed | /f |
alert | /a |
backslash | // |
question mark | /? |
single quote | /' |
double quote | /" |
octal number | /ooo |
hexadecimal number | /xhh |
Floating-point literals comprise an integer, decimal point, fraction, an "e" or "E", and an optionally signed integer exponent. Either the integer or fraction but not both may be missing; either the decimal point or the letter "e" or "E" and the exponent but not both may be missing.
The following are examples of floating-point literals:
A string literal is a sequence of zero or more characters enclosed within double quotes (" ").
The following are examples of string literals: